--- /dev/null
+Patch by Sergei Golovan allows to find tclConfig.sh in /usr/share/tcltk/tcl8.5
+and tkConfig.sh in /usr/share/tcltk/tk8.5 where they are located in Debian
+installation.
+
+--- tcl8.5-8.5.8.orig/unix/tcl.m4
++++ tcl8.5-8.5.8/unix/tcl.m4
+@@ -93,6 +93,7 @@
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
++ `ls -d /usr/share/tcltk/tcl8.5 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tclConfig.sh" ; then
+@@ -223,6 +224,7 @@
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
++ `ls -d /usr/share/tcltk/tk8.5 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tkConfig.sh" ; then
--- /dev/null
+Patch by Chris Waters fixes installing of several manual pages which
+aren't installed by upstream script but are referenced inside other
+manual pages.
+
+--- tcl8.5-8.5.8.orig/unix/installManPage
++++ tcl8.5-8.5.8/unix/installManPage
+@@ -48,8 +48,16 @@
+ *.n) SECTION=n ;;
+ esac
+
++NAME=`basename $MANPAGE .$SECTION`
+ SRCDIR=`dirname $MANPAGE`
+
++SPECIALS="DString Thread Notifier RegExp"
++for n in $SPECIALS; do
++ if [ "$NAME" = "$n" ] ; then
++ NAMES="$n $NAMES"
++ fi
++done
++
+ FIRST=""
+ for f in $NAMES; do
+ f=$f.$SECTION$SUFFIX
--- /dev/null
+http://sourceforge.net/tracker/index.php?func=detail&aid=2902010&group_id=10894&atid=110894
+
+--- generic/tclStrToD.c.orig
++++ generic/tclStrToD.c
+@@ -71,9 +71,10 @@
+
+ /*
+ * MIPS floating-point units need special settings in control registers
+- * to use gradual underflow as we expect.
++ * to use gradual underflow as we expect. This fix is for the MIPSpro
++ * compiler.
+ */
+-#if defined(__mips)
++#if defined(__sgi) && defined(_COMPILER_VERSION)
+ #include <sys/fpu.h>
+ #endif
+ /*
+@@ -2166,7 +2167,7 @@
+ } bitwhack;
+ #endif
+
+-#if defined(__mips)
++#if defined(__sgi) && defined(_COMPILER_VERSION)
+ union fpc_csr mipsCR;
+
+ mipsCR.fc_word = get_fpc_csr();
--- /dev/null
+Patch by Sergei Golovan (originally by Mike Markley and Chris Waters) fixes
+building on non-linux Debian architectures.
+
+--- tcl8.5-8.5.8.orig/unix/configure
++++ tcl8.5-8.5.8/unix/configure
+@@ -6536,6 +6536,9 @@
+ if test "`uname -s`" = "AIX" ; then
+ tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
+ fi
++ if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
++ system=NetBSD-Debian
++ fi
+ fi
+ fi
+
+@@ -7340,7 +7343,7 @@
+ fi
+
+ ;;
+- Linux*)
++ Linux*|GNU*|NetBSD-Debian)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+--- tcl8.5-8.5.8.orig/unix/Makefile.in
++++ tcl8.5-8.5.8/unix/Makefile.in
+@@ -172,6 +172,7 @@
+ SHLIB_LD = @SHLIB_LD@
+ SHLIB_CFLAGS = @SHLIB_CFLAGS@
+ SHLIB_LD_LIBS = @SHLIB_LD_LIBS@
++SHLIB_LD_FLAGS = @SHLIB_LD_FLAGS@
+ TCL_SHLIB_LD_EXTRAS = @TCL_SHLIB_LD_EXTRAS@
+
+ SHLIB_SUFFIX = @SHLIB_SUFFIX@
+--- tcl8.5-8.5.8.orig/unix/tcl.m4
++++ tcl8.5-8.5.8/unix/tcl.m4
+@@ -962,6 +962,9 @@
+ if test "`uname -s`" = "AIX" ; then
+ tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
+ fi
++ if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
++ tcl_cv_sys_version=NetBSD-Debian
++ fi
+ fi
+ fi
+ ])
+@@ -1422,7 +1425,7 @@
+ ])
+ ])
+ ;;
+- Linux*)
++ Linux*|GNU*|NetBSD-Debian)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
--- /dev/null
+Patch by Chris Waters removes -rpath from search flags and adds -soname
+to library build options.
+
+--- tcl8.5-8.5.8.orig/unix/configure
++++ tcl8.5-8.5.8/unix/configure
+@@ -7351,6 +7351,9 @@
+ # get rid of the warnings.
+ #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+
++ # following line added by CW for Debian GNU/Linux
++ TCL_SHLIB_LD_EXTRAS="-Wl,-soname,\${TCL_LIB_FILE}.0"
++
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+--- tcl8.5-8.5.8.orig/unix/Makefile.in
++++ tcl8.5-8.5.8/unix/Makefile.in
+@@ -729,7 +729,10 @@
+ fi
+ @echo "Installing $(LIB_FILE) to $(LIB_INSTALL_DIR)/"
+ @@INSTALL_LIB@
+- @chmod 555 "$(LIB_INSTALL_DIR)"/$(LIB_FILE)
++ mv "$(LIB_INSTALL_DIR)"/$(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE).0
++ ln -sf $(LIB_FILE).0 "$(LIB_INSTALL_DIR)"/$(LIB_FILE)
++ ln -sf "$(LIB_INSTALL_DIR)"/$(LIB_FILE).0 ./
++ @chmod 555 "$(LIB_INSTALL_DIR)"/$(LIB_FILE).0
+ @if test "$(TCL_BUILD_EXP_FILE)" != ""; then \
+ echo "Installing $(TCL_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \
+ $(INSTALL_DATA) $(TCL_BUILD_EXP_FILE) \
+--- tcl8.5-8.5.8.orig/unix/tcl.m4
++++ tcl8.5-8.5.8/unix/tcl.m4
+@@ -1433,6 +1433,9 @@
+ # get rid of the warnings.
+ #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+
++ # following line added by CW for Debian GNU/Linux
++ TCL_SHLIB_LD_EXTRAS="-Wl,-soname,\${TCL_LIB_FILE}.0"
++
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
--- /dev/null
+--- tcl8.5-8.5.8.orig/unix/configure
++++ tcl8.5-8.5.8/unix/configure
+@@ -18808,7 +18808,7 @@
+
+ eval "TCL_LIB_FILE=${TCL_LIB_FILE}"
+
+-TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)'
++test -z "$TCL_LIBRARY" && TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)'
+ PRIVATE_INCLUDE_DIR='$(includedir)'
+ HTML_DIR='$(DISTDIR)/html'
+
+--- tcl8.5-8.5.8.orig/unix/configure.in
++++ tcl8.5-8.5.8/unix/configure.in
+@@ -734,7 +734,7 @@
+
+ eval "TCL_LIB_FILE=${TCL_LIB_FILE}"
+
+-TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)'
++test -z "$TCL_LIBRARY" && TCL_LIBRARY='$(prefix)/lib/tcl$(VERSION)'
+ PRIVATE_INCLUDE_DIR='$(includedir)'
+ HTML_DIR='$(DISTDIR)/html'
+
--- /dev/null
+Patch by Sergei Golovan allows to specify TCL_PACKAGE_PATH at configure stage
+without adding /usr/lib to it. It helps to put the policy compliant value to
+::tcl_pkgPath variable and to TCL_PACKAGE_PATH variable in tclConfig.sh.
+
+--- tcl8.5-8.5.8.orig/unix/configure
++++ tcl8.5-8.5.8/unix/configure
+@@ -18945,9 +18945,9 @@
+ 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}"
++ test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir} ${prefix}/lib"
+ else
+- TCL_PACKAGE_PATH="${prefix}/lib ${TCL_PACKAGE_PATH}"
++ test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib"
+ fi
+
+ #--------------------------------------------------------------------
+--- tcl8.5-8.5.8.orig/unix/configure.in
++++ tcl8.5-8.5.8/unix/configure.in
+@@ -833,9 +833,9 @@
+ 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}"
++ test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${libdir} ${prefix}/lib"
+ else
+- TCL_PACKAGE_PATH="${prefix}/lib ${TCL_PACKAGE_PATH}"
++ test -z "$TCL_PACKAGE_PATH" && TCL_PACKAGE_PATH="${prefix}/lib"
+ fi
+
+ #--------------------------------------------------------------------
--- /dev/null
+Patch by Chris Waters sets paths which are normally point to a directory
+with Tcl sources to a subdirectory of /usr/include/tcl8.4 (debian/rules
+puts private Tcl headers there).
+
+--- tcl8.5-8.5.8.orig/unix/tclConfig.sh.in
++++ tcl8.5-8.5.8/unix/tclConfig.sh.in
+@@ -111,7 +111,7 @@
+
+ # String to pass to linker to pick up the Tcl library from its
+ # build directory.
+-TCL_BUILD_LIB_SPEC='@TCL_BUILD_LIB_SPEC@'
++TCL_BUILD_LIB_SPEC='@TCL_LIB_SPEC@'
+
+ # String to pass to linker to pick up the Tcl library from its
+ # installed directory.
+@@ -146,7 +146,7 @@
+ # different place than the directory containing the source files, this
+ # points to the location of the sources, not the location where Tcl was
+ # compiled.
+-TCL_SRC_DIR='@TCL_SRC_DIR@'
++TCL_SRC_DIR='@includedir@/tcl-private'
+
+ # List of standard directories in which to look for packages during
+ # "package require" commands. Contains the "prefix" directory plus also
+@@ -164,14 +164,14 @@
+
+ # String to pass to linker to pick up the Tcl stub library from its
+ # build directory.
+-TCL_BUILD_STUB_LIB_SPEC='@TCL_BUILD_STUB_LIB_SPEC@'
++TCL_BUILD_STUB_LIB_SPEC='@TCL_STUB_LIB_SPEC@'
+
+ # String to pass to linker to pick up the Tcl stub library from its
+ # installed directory.
+ TCL_STUB_LIB_SPEC='@TCL_STUB_LIB_SPEC@'
+
+ # Path to the Tcl stub library in the build directory.
+-TCL_BUILD_STUB_LIB_PATH='@TCL_BUILD_STUB_LIB_PATH@'
++TCL_BUILD_STUB_LIB_PATH='@TCL_STUB_LIB_PATH@'
+
+ # Path to the Tcl stub library in the install directory.
+ TCL_STUB_LIB_PATH='@TCL_STUB_LIB_PATH@'
+++ /dev/null
-inherit native
-include tcl_8.4.19.bb
-
-do_stage() {
- oe_libinstall -a libtclstub8.4 ${STAGING_LIBDIR}
- oe_libinstall -so libtcl8.4 ${STAGING_LIBDIR}
- sed -i "s+${WORKDIR}+${STAGING_INCDIR}+g" tclConfig.sh
- sed -i "s,-L${libdir},," tclConfig.sh
- install -d ${STAGING_BINDIR}/
- install -m 0755 tclConfig.sh ${STAGING_BINDIR}
- install -m 0755 tclsh ${STAGING_BINDIR}/tclsh8.4
- ln -s -f tclsh8.4 ${STAGING_BINDIR}/tclsh
- cd ..
- for dir in compat generic unix
- do
- install -d ${STAGING_INCDIR}/tcl${PV}/$dir
- install -m 0644 $dir/*.h ${STAGING_INCDIR}/tcl${PV}/$dir/
- done
- install -m 0644 generic/tcl.h ${STAGING_INCDIR}
- install -m 0644 generic/tclDecls.h ${STAGING_INCDIR}
- install -m 0644 generic/tclPlatDecls.h ${STAGING_INCDIR}
-}
--- /dev/null
+DESCRIPTION = "Tool Command Language"
+HOMEPAGE = "http://tcl.sourceforge.net"
+SECTION = "devel/tcltk"
+LICENSE = "tcl"
+PR = "r9"
+
+# no idea why we need this
+DEPENDS = "tcl-native"
+DEPENDS_virtclass-native = ""
+
+SRC_URI = "\
+ ${SOURCEFORGE_MIRROR}/tcl/tcl${PV}-src.tar.gz \
+ file://confsearch.diff;patch=1;pnum=2 \
+ file://manpages.diff;patch=1;pnum=2 \
+ file://non-linux.diff;patch=1;pnum=2 \
+ file://rpath.diff;patch=1;pnum=2 \
+ file://tcllibrary.diff;patch=1;pnum=2 \
+ file://tclpackagepath.diff;patch=1;pnum=2 \
+ file://tclprivate.diff;patch=1;pnum=2 \
+# file://mips-tclstrtod.patch;patchdir=..;striplevel=0 \
+"
+SRC_URI[md5sum] = "7f123e53b3daaaba2478d3af5a0752e3"
+SRC_URI[sha256sum] = "6b090c1024038d0381e1ccfbd6d5c0f0e6ef205269ceb9d28bd7bd7ac5bbf4a7"
+
+S = "${WORKDIR}/tcl${PV}/unix"
+
+inherit autotools binconfig
+
+EXTRA_OECONF = "--enable-threads"
+
+do_configure_append() {
+ echo > ../compat/fixstrtod.c
+}
+
+do_compile_prepend_pn-tcl () {
+ sed -i -e 's:./tclsh :tclsh :g' Makefile
+}
+
+do_install_append() {
+ # Stage a few extra headers to make tk happy
+ install -d ${D}${includedir}/tcl-${PV}/generic
+ install -m 0644 ../generic/*.h ${D}${includedir}/tcl-${PV}/generic
+ install -m 0644 *.h ${D}${includedir}/tcl-${PV}/generic
+ install -d ${D}${includedir}/tcl-${PV}/unix
+ install -m 0644 *Unix*.h ${D}${includedir}/tcl-${PV}/unix/
+ rm -f ${D}${includedir}/regex.h
+ ln -sf tclsh8.5 ${D}${bindir}/tclsh
+ # trick: We set it to incorrect value but binconfig will fix it
+ # correctly for both target and staging package.
+ sed -i 's:${includedir}/tcl-private:${STAGING_INCDIR}/tcl-${PV}:' ${D}${libdir}/tclConfig.sh
+}
+
+PACKAGES =+ "${PN}-lib"
+
+FILES_${PN}-lib = "${libdir}/libtcl8.5.so.*"
+FILES_${PN} += "${libdir}/tcl*"
+FILES_${PN}-dev += "${libdir}/tclConfig.sh"
+
+BINCONFIG_GLOB = "*Config.sh"
+BBCLASSEXTEND = "native"
--- /dev/null
+Patch by Sergei Golovan allows to find tclConfig.sh in /usr/share/tcltk/tcl8.5
+and tkConfig.sh in /usr/share/tcltk/tk8.5 where they are located in Debian
+installation.
+
+--- tk8.5-8.5.8.orig/unix/configure
++++ tk8.5-8.5.8/unix/configure
+@@ -1431,6 +1431,7 @@
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
++ `ls -d /usr/share/tcltk/tcl8.5 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tclConfig.sh" ; then
+--- tk8.5-8.5.8.orig/unix/tcl.m4
++++ tk8.5-8.5.8/unix/tcl.m4
+@@ -93,6 +93,7 @@
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
++ `ls -d /usr/share/tcltk/tcl8.5 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tclConfig.sh" ; then
+@@ -223,6 +224,7 @@
+ `ls -d ${prefix}/lib 2>/dev/null` \
+ `ls -d /usr/local/lib 2>/dev/null` \
+ `ls -d /usr/contrib/lib 2>/dev/null` \
++ `ls -d /usr/share/tcltk/tk8.5 2>/dev/null` \
+ `ls -d /usr/lib 2>/dev/null` \
+ ; do
+ if test -f "$i/tkConfig.sh" ; then
--- /dev/null
+--- /tmp/configure.in 2010-05-19 13:29:03.000000000 +0200
++++ unix/configure.in 2010-05-19 13:42:05.000000000 +0200
+@@ -526,13 +526,9 @@
+ found_xft="yes"
+ dnl make sure package configurator (xft-config or pkg-config
+ dnl says that xft is present.
+- XFT_CFLAGS=`xft-config --cflags 2>/dev/null` || found_xft="no"
+- XFT_LIBS=`xft-config --libs 2>/dev/null` || found_xft="no"
+- if test "$found_xft" = "no" ; then
+ found_xft=yes
+ XFT_CFLAGS=`pkg-config --cflags xft 2>/dev/null` || found_xft="no"
+ XFT_LIBS=`pkg-config --libs xft 2>/dev/null` || found_xft="no"
+- fi
+ AC_MSG_RESULT([$found_xft])
+ dnl make sure that compiling against Xft header file doesn't bomb
+ if test "$found_xft" = "yes" ; then
--- /dev/null
+Patch by Chris Waters fixes installing of several manual pages which
+aren't installed by upstream script but are referenced inside other
+manual pages.
+
+--- tk8.5-8.5.8.orig/unix/installManPage
++++ tk8.5-8.5.8/unix/installManPage
+@@ -51,7 +51,16 @@
+ }' $MANPAGE`
+
+ SECTION=`echo $MANPAGE | sed 's/.*\(.\)$/\1/'`
++NAME=`basename $MANPAGE .$SECTION`
+ SRCDIR=`dirname $MANPAGE`
++
++SPECIALS="FindPhoto"
++for n in $SPECIALS; do
++ if [ "$NAME" = "$n" ] ; then
++ NAMES="$n $NAMES"
++ fi
++done
++
+ FIRST=""
+ for f in $NAMES; do
+ f=$f.$SECTION$SUFFIX
--- /dev/null
+Patch by Sergei Golovan (originally by Mike Markley and Chris Waters) fixes
+building on non-linux Debian architectures.
+
+--- tk8.5-8.5.8.orig/unix/configure
++++ tk8.5-8.5.8/unix/configure
+@@ -4742,6 +4742,9 @@
+ if test "`uname -s`" = "AIX" ; then
+ tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
+ fi
++ if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
++ tcl_cv_sys_version=NetBSD-Debian
++ fi
+ fi
+ fi
+
+@@ -5546,7 +5549,7 @@
+ fi
+
+ ;;
+- Linux*)
++ Linux*|GNU*|NetBSD-Debian)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
+--- tk8.5-8.5.8.orig/unix/tcl.m4
++++ tk8.5-8.5.8/unix/tcl.m4
+@@ -962,6 +962,9 @@
+ if test "`uname -s`" = "AIX" ; then
+ tcl_cv_sys_version=AIX-`uname -v`.`uname -r`
+ fi
++ if test "`uname -s`" = "NetBSD" -a -f /etc/debian_version ; then
++ tcl_cv_sys_version=NetBSD-Debian
++ fi
+ fi
+ fi
+ ])
+@@ -1422,7 +1425,7 @@
+ ])
+ ])
+ ;;
+- Linux*)
++ Linux*|GNU*|NetBSD-Debian)
+ SHLIB_CFLAGS="-fPIC"
+ SHLIB_LD_LIBS='${LIBS}'
+ SHLIB_SUFFIX=".so"
--- /dev/null
+Patch by Chris Waters removes -rpath from search flags and adds -soname
+to library build options.
+
+Also, it fixes Makefile.in to put correct Tk library filename to pkgIndex.tcl
+
+--- tk8.5-8.5.8.orig/unix/configure
++++ tk8.5-8.5.8/unix/configure
+@@ -5557,6 +5557,9 @@
+ # get rid of the warnings.
+ #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+
++ # following line added by CW for Debian GNU/Linux
++ TK_SHLIB_LD_EXTRAS="-Wl,-soname,\${TK_LIB_FILE}.0"
++
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
+--- tk8.5-8.5.8.orig/unix/Makefile.in
++++ tk8.5-8.5.8/unix/Makefile.in
+@@ -713,7 +713,7 @@
+ echo "if {[catch {package present Tcl 8.5.0}]} { return }";\
+ relative=`echo | awk '{ORS=" "; split("$(TK_PKG_DIR)",a,"/"); for (f in a) {print ".."}}'`;\
+ echo "package ifneeded Tk $(MAJOR_VERSION).$(MINOR_VERSION)$(PATCH_LEVEL)\
+- [list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\
++ [list load [file join $(LIB_RUNTIME_DIR) $(TK_LIB_FILE).0] Tk]";\
+ ) > "$(PKG_INDEX)"; \
+ fi
+ @echo "Installing $(LIB_FILE) to $(LIB_INSTALL_DIR)/"
+--- tk8.5-8.5.8.orig/unix/tcl.m4
++++ tk8.5-8.5.8/unix/tcl.m4
+@@ -1433,6 +1433,9 @@
+ # get rid of the warnings.
+ #CFLAGS_OPTIMIZE="${CFLAGS_OPTIMIZE} -D__NO_STRING_INLINES -D__NO_MATH_INLINES"
+
++ # following line added by CW for Debian GNU/Linux
++ TK_SHLIB_LD_EXTRAS="-Wl,-soname,\${TK_LIB_FILE}.0"
++
+ SHLIB_LD='${CC} -shared ${CFLAGS} ${LDFLAGS}'
+ DL_OBJS="tclLoadDl.o"
+ DL_LIBS="-ldl"
--- /dev/null
+--- tk8.5-8.5.8.orig/unix/configure
++++ tk8.5-8.5.8/unix/configure
+@@ -11070,7 +11070,7 @@
+ TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
+ fi
+
+-TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
++test -z "$TK_LIBRARY" && TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
+ PRIVATE_INCLUDE_DIR='$(includedir)'
+ HTML_DIR='$(DISTDIR)/html'
+ TK_PKG_DIR='tk$(VERSION)'
+--- tk8.5-8.5.8.orig/unix/configure.in
++++ tk8.5-8.5.8/unix/configure.in
+@@ -607,7 +607,7 @@
+ TCL_STUB_FLAGS="-DUSE_TCL_STUBS"
+ fi
+
+-TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
++test -z "$TK_LIBRARY" && TK_LIBRARY='$(prefix)/lib/tk$(VERSION)'
+ PRIVATE_INCLUDE_DIR='$(includedir)'
+ HTML_DIR='$(DISTDIR)/html'
+ TK_PKG_DIR='tk$(VERSION)'
--- /dev/null
+Patch by Chris Waters sets path which are normally point to a directory
+with Tk sources to a subdirectory of /usr/include/tcl8.4 (debian/rules
+puts private Tk headers there).
+
+--- tk8.5-8.5.8.orig/unix/tkConfig.sh.in
++++ tk8.5-8.5.8/unix/tkConfig.sh.in
+@@ -55,7 +55,7 @@
+
+ # String to pass to linker to pick up the Tk library from its
+ # build directory.
+-TK_BUILD_LIB_SPEC='@TK_BUILD_LIB_SPEC@'
++TK_BUILD_LIB_SPEC='@TK_LIB_SPEC@'
+
+ # String to pass to linker to pick up the Tk library from its
+ # installed directory.
+@@ -71,7 +71,7 @@
+ # different place than the directory containing the source files, this
+ # points to the location of the sources, not the location where Tk was
+ # compiled.
+-TK_SRC_DIR='@TK_SRC_DIR@'
++TK_SRC_DIR='@includedir@/tk-private'
+
+ # Needed if you want to make a 'fat' shared library library
+ # containing tk objects or link a different wish.
+@@ -86,14 +86,14 @@
+
+ # String to pass to linker to pick up the Tk stub library from its
+ # build directory.
+-TK_BUILD_STUB_LIB_SPEC='@TK_BUILD_STUB_LIB_SPEC@'
++TK_BUILD_STUB_LIB_SPEC='@TK_STUB_LIB_SPEC@'
+
+ # String to pass to linker to pick up the Tk stub library from its
+ # installed directory.
+ TK_STUB_LIB_SPEC='@TK_STUB_LIB_SPEC@'
+
+ # Path to the Tk stub library in the build directory.
+-TK_BUILD_STUB_LIB_PATH='@TK_BUILD_STUB_LIB_PATH@'
++TK_BUILD_STUB_LIB_PATH='@TK_STUB_LIB_PATH@'
+
+ # Path to the Tk stub library in the install directory.
+ TK_STUB_LIB_PATH='@TK_STUB_LIB_PATH@'
+++ /dev/null
-inherit native
-include tk_8.4.19.bb
-DEPENDS = "tcl-native"
-
-do_stage() {
- oe_libinstall -a libtkstub8.4 ${STAGING_LIBDIR}
- oe_libinstall -so libtk8.4 ${STAGING_LIBDIR}
- sed -i "s+${WORKDIR}+${STAGING_INCDIR}+g" tkConfig.sh
- install -m 0755 tkConfig.sh ${STAGING_BINDIR}
- install -m 0755 wish ${STAGING_BINDIR}/wish8.4
- ln -s wish8.4 ${STAGING_BINDIR}/wish
- cd ..
- #for dir in compat generic unix
- #do
- # install -d ${STAGING_INCDIR}/tk${PV}/$dir
- #install -m 0644 $dir/*.h ${STAGING_INCDIR}/tk${PV}/$dir/
- #done
- install -m 0644 generic/tk.h ${STAGING_INCDIR}
- install -m 0644 generic/tkDecls.h ${STAGING_INCDIR}
- install -m 0644 generic/tkPlatDecls.h ${STAGING_INCDIR}
-
-}
--- /dev/null
+DESCRIPTION = "Tool Command Language ToolKit Extension"
+HOMEPAGE = "http://tcl.sourceforge.net"
+SECTION = "devel/tcltk"
+LICENSE = "tcl"
+DEPENDS = "tcl virtual/libx11 libxt"
+PR = "r3"
+
+DEPENDS_virtclass-native = "tcl-native libxt-native"
+
+SRC_URI = "\
+ ${SOURCEFORGE_MIRROR}/tcl/tk${PV}-src.tar.gz \
+ file://confsearch.diff;patch=1;pnum=2 \
+ file://manpages.diff;patch=1;pnum=2 \
+ file://non-linux.diff;patch=1;pnum=2 \
+ file://rpath.diff;patch=1;pnum=2 \
+ file://tklibrary.diff;patch=1;pnum=2 \
+ file://tkprivate.diff;patch=1;pnum=2 \
+ file://fix-xft.diff;patch=1 \
+"
+SRC_URI[md5sum] = "13bf90602e16fc530e05196431021dc6"
+SRC_URI[sha256sum] = "9737da5c30e631281062b6acbb4753840f9e95657c78e37657d9c520589ab2d4"
+
+S = "${WORKDIR}/tk${PV}/unix"
+
+inherit autotools
+
+EXTRA_OECONF = "\
+ --enable-threads \
+ --with-tcl=${STAGING_BINDIR_CROSS} \
+ --x-includes=${STAGING_INCDIR} \
+ --x-libraries=${STAGING_LIBDIR} \
+"
+
+do_install_append() {
+ mv libtk8.5.so libtk8.5.so.0
+ oe_libinstall -so libtk8.5 ${D}${libdir}
+ ln -sf wish8.5 ${D}${bindir}/wish
+}
+
+PACKAGES =+ "${PN}-lib"
+
+FILES_${PN}-lib = "${libdir}/libtk8.5.so.*"
+FILES_${PN} += "${libdir}/tk*"
+
+BINCONFIG_GLOB = "*Config.sh"
+BBCLASSEXTEND = "native"