--- /dev/null
+diff -up tcl8.5.7/../library/auto.tcl.old tcl8.5.7/library/auto.tcl
+--- tcl8.5.7/../library/auto.tcl.old 2006-11-03 01:34:52.000000000 +0100
++++ tcl8.5.7/../library/auto.tcl 2009-05-18 10:28:16.337102378 +0200
+@@ -85,6 +85,13 @@ proc tcl_findLibrary {basename version p
+ lappend dirs $value
+ }
+
++ # 2a. As a sibling of Tcl's script directory
++ if {[catch {
++ ::tcl::pkgconfig get scriptdir,runtime
++ } value] == 0} {
++ lappend dirs [file join [file dirname $value] $basename$version]
++ }
++
+ # 3. Relative to auto_path directories. This checks relative to the
+ # Tcl library as well as allowing loading of libraries added to the
+ # auto_path that is not relative to the core library or binary paths.
+diff -up tcl8.5.7/../library/init.tcl.old tcl8.5.7/library/init.tcl
+--- tcl8.5.7/../library/init.tcl.old 2009-04-10 18:54:51.000000000 +0200
++++ tcl8.5.7/../library/init.tcl 2009-05-18 10:25:25.904853164 +0200
+@@ -48,16 +48,11 @@ if {![info exists auto_path]} {
+ }
+ namespace eval tcl {
+ variable Dir
+- foreach Dir [list $::tcl_library [file dirname $::tcl_library]] {
++ foreach Dir [list $::tcl_library] {
+ if {$Dir ni $::auto_path} {
+ lappend ::auto_path $Dir
+ }
+ }
+- set Dir [file join [file dirname [file dirname \
+- [info nameofexecutable]]] lib]
+- if {$Dir ni $::auto_path} {
+- lappend ::auto_path $Dir
+- }
+ catch {
+ foreach Dir $::tcl_pkgPath {
+ if {$Dir ni $::auto_path} {
+diff -up tcl8.5.7/../unix/configure.in.old tcl8.5.7/unix/configure.in
+--- tcl8.5.7/../unix/configure.in.old 2009-04-15 21:30:05.000000000 +0200
++++ tcl8.5.7/../unix/configure.in 2009-05-18 10:21:30.987855050 +0200
+@@ -833,9 +833,9 @@ if test "$FRAMEWORK_BUILD" = "1" ; then
+ test -z "$TCL_MODULE_PATH" && \
+ TCL_MODULE_PATH="~/Library/Tcl /Library/Tcl /System/Library/Tcl"
+ elif test "$prefix/lib" != "$libdir"; then
+- TCL_PACKAGE_PATH="${libdir} ${prefix}/lib ${TCL_PACKAGE_PATH}"
++ TCL_PACKAGE_PATH="${libdir}/tcl8.5 ${prefix}/share/tcl8.5 ${TCL_PACKAGE_PATH}"
+ else
+- TCL_PACKAGE_PATH="${prefix}/lib ${TCL_PACKAGE_PATH}"
++ TCL_PACKAGE_PATH="${libdir}/tcl8.5 ${prefix}/share/tcl8.5 ${TCL_PACKAGE_PATH}"
+ fi
+
+ #--------------------------------------------------------------------
--- /dev/null
+--- tcl8.5.0/../unix/tcl.m4.conf 2007-12-20 10:48:05.000000000 +0100
++++ tcl8.5.0/../unix/tcl.m4 2007-12-20 10:48:52.000000000 +0100
+@@ -1427,12 +1427,12 @@ dnl AC_CHECK_TOOL(AR, ar)
+ # get rid of the warnings.
+ #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+
+- SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
++ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS} -fPIC -Wl,-soname,${@}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+ AS_IF([test $doRpath = yes], [
+- CC_SEARCH_FLAGS='-Wl,-rpath,${LIB_RUNTIME_DIR}'])
++ CC_SEARCH_FLAGS=''])
+ LD_SEARCH_FLAGS=${CC_SEARCH_FLAGS}
+ AS_IF([test "`uname -m`" = "alpha"], [CFLAGS="$CFLAGS -mieee"])
+ AS_IF([test $do64bit = yes], [
+@@ -1464,7 +1464,7 @@ dnl AC_CHECK_TOOL(AR, ar)
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+
+- SHLIB_LD='${CC} -shared'
++ SHLIB_LD='${CC} ${CFLAGS} -shared -fPIC'
+ DL_OBJS=""
+ DL_LIBS="-ldl"
+ LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
--- /dev/null
+diff -up tcl8.5.7/../unix/Makefile.in.old tcl8.5.7/unix/Makefile.in
+--- tcl8.5.7/../unix//Makefile.in.old 2009-04-15 21:30:05.000000000 +0200
++++ tcl8.5.7/../unix/Makefile.in 2009-07-16 08:27:32.758444459 +0200
+@@ -569,7 +569,7 @@ objs: ${OBJS}
+
+
+ tclsh: ${TCLSH_OBJS} ${TCL_LIB_FILE}
+- ${CC} ${CFLAGS} ${LDFLAGS} ${TCLSH_OBJS} @TCL_BUILD_LIB_SPEC@ ${LIBS} @EXTRA_TCLSH_LIBS@ \
++ ${CC} ${CFLAGS} ${LDFLAGS} -fPIC ${TCLSH_OBJS} @TCL_BUILD_LIB_SPEC@ ${LIBS} @EXTRA_TCLSH_LIBS@ \
+ ${CC_SEARCH_FLAGS} -o tclsh
+
+ # Resetting the LIB_RUNTIME_DIR below is required so that the generated
--- /dev/null
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007, 2008 Michael Tremer & Christian Schmidt #
+# #
+# This program is free software: you can redistribute it and/or modify #
+# it under the terms of the GNU General Public License as published by #
+# the Free Software Foundation, either version 3 of the License, or #
+# (at your option) any later version. #
+# #
+# This program is distributed in the hope that it will be useful, #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
+# GNU General Public License for more details. #
+# #
+# You should have received a copy of the GNU General Public License #
+# along with this program. If not, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
+
+###############################################################################
+# Definitions
+###############################################################################
+
+include $(PKGROOT)/Include
+
+PKG_NAME = tcl
+PKG_VER = 8.5.8
+PKG_REL = 0
+
+PKG_MAINTAINER =
+PKG_GROUP = Development/Languages
+PKG_URL = http://tcl.sourceforge.net/
+PKG_LICENSE = TCL
+PKG_SUMMARY = Tool Command Language, pronounced tickle.
+
+PKG_BUILD_DEPS+= autoconf automake
+
+define PKG_DESCRIPTION
+ The Tcl (Tool Command Language) provides a powerful platform for\
+ creating integration applications that tie together diverse \
+ applications, protocols, devices, and frameworks.
+endef
+
+PKG_TARBALL = tcl$(PKG_VER)-src.tar.gz
+
+CONFIGURE_OPTIONS += \
+ --disable-nls \
+ --enable-shared
+
+DIR_APP = /usr/src/tcl$(PKG_VER)/unix
+
+define STAGE_PREPARE_CMDS
+ cd $(DIR_APP) && autoconf
+endef
+
+define STAGE_INSTALL_CMDS
+ cd $(DIR_APP) && make install-private-headers
+ ln -sf tclsh8.5 $(BUILDROOT)/usr/bin/tclsh
+endef