I find myself doing a custom binutils for someone, and couldn't get modern
GDB to build against the standard cygwin versions of tcl/tk, so needed new
ones in a hurry: thank you Yaakov and the ports helpers.  I decided to fix the
DLL prefix lib->cyg in the makefile and  while I was at it fixed the install
directory for it.

  Attached: the resulting *.src.patches, which roll-up and replace the
existing -ports 8.5-* patches, and the modified .cygport scripts just to show
what I changed there, though they're a bit untidy to actually go in.

  I don't know where Chuck is with all this stuff.  Chuck, where are you with
all this stuff?  You may have already sorted it, but it only took about 20
minutes of makefile hackery, so I didn't even stop to go through my old
emails.  Here it is, in case it's useful to anyone.

    cheers,
      DaveK
--- origsrc/tcl8.5.6/generic/tclLoad.c	2008-11-14 00:22:39.000000000 +0000
+++ src/tcl8.5.6/generic/tclLoad.c	2009-10-20 21:35:11.656250000 +0100
@@ -310,6 +310,12 @@ Tcl_LoadObjCmd(
 			&& (pkgGuess[2] == 'b')) {
 		    pkgGuess += 3;
 		}
+#ifdef __CYGWIN__
+		if ((pkgGuess[0] == 'c') && (pkgGuess[1] == 'y')
+			&& (pkgGuess[2] == 'g')) {
+		    pkgGuess += 3;
+		}
+#endif
 		for (p = pkgGuess; *p != 0; p += offset) {
 		    offset = Tcl_UtfToUniChar(p, &ch);
 		    if ((ch > 0x100)
--- origsrc/tcl8.5.6/unix/Makefile.in	2008-12-22 14:16:08.000000000 +0000
+++ src/tcl8.5.6/unix/Makefile.in	2009-10-20 21:35:11.656250000 +0100
@@ -47,9 +47,12 @@ LIB_RUNTIME_DIR		= $(libdir)
 # Directory in which to install the program tclsh:
 BIN_INSTALL_DIR		= $(INSTALL_ROOT)$(bindir)
 
-# Directory in which to install libtcl.so or libtcl.a:
+# Directory in which to install libtcl.a:
 LIB_INSTALL_DIR		= $(INSTALL_ROOT)$(libdir)
 
+# Directory in which to install libtcl.so:
+SHARED_LIB_INSTALL_DIR	= @SHARED_LIB_INSTALL_DIR@
+
 # Path name to use when installing library scripts.
 SCRIPT_INSTALL_DIR	= $(INSTALL_ROOT)$(TCL_LIBRARY)
 
@@ -711,7 +714,7 @@ install-strip:
 # (e.g. if installing as root).
 
 install-binaries: binaries
-	@for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" ; \
+	@for i in "$(LIB_INSTALL_DIR)" "$(SHARED_LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" ; \
 	    do \
 	    if [ ! -d "$$i" ] ; then \
 		echo "Making directory $$i"; \
@@ -723,9 +726,9 @@ install-binaries: binaries
 	@if test ! -x $(SRC_DIR)/../unix/install-sh; then \
 	    chmod +x $(SRC_DIR)/../unix/install-sh; \
 	    fi
-	@echo "Installing $(LIB_FILE) to $(LIB_INSTALL_DIR)/"
+	@echo "Installing $(LIB_FILE) to $(SHARED_LIB_INSTALL_DIR)/"
 	@@INSTALL_LIB@
-	@chmod 555 "$(LIB_INSTALL_DIR)"/$(LIB_FILE)
+	@chmod 555 "$(SHARED_LIB_INSTALL_DIR)"/$(LIB_FILE)
 	@if test "$(TCL_BUILD_EXP_FILE)" != ""; then \
 	    echo "Installing $(TCL_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \
 	    $(INSTALL_DATA) $(TCL_BUILD_EXP_FILE) \
--- origsrc/tcl8.5.6/unix/configure.in	2008-12-22 14:16:08.000000000 +0000
+++ src/tcl8.5.6/unix/configure.in	2009-10-20 21:35:11.656250000 +0100
@@ -707,7 +707,8 @@ fi
 
 TCL_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
 TCL_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}
-eval "TCL_LIB_FILE=libtcl${LIB_SUFFIX}"
+TCL_SHARED_LIB_PREFIX=${SHARED_LIB_PREFIX}
+eval "TCL_LIB_FILE=${SHARED_LIB_PREFIX}tcl${LIB_SUFFIX}"
 
 # tclConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
 # since on some platforms TCL_LIB_FILE contains shell escapes. 
@@ -787,8 +788,8 @@ else
         eval "TCL_EXP_FILE=libtcl${TCL_EXPORT_FILE_SUFFIX}"
     
         if test "$GCC" = "yes" ; then
-            TCL_BUILD_LIB_SPEC="-Wl,-bI:`pwd | sed -e 's/ /\\\\ /g'`/${TCL_BUILD_EXP_FILE} -L`pwd | sed -e 's/ /\\\\ /g'`"
-            TCL_LIB_SPEC="-Wl,-bI:${libdir}/${TCL_EXP_FILE} -L${libdir}"
+            TCL_BUILD_LIB_SPEC="-Wl,`pwd | sed -e 's/ /\\\\ /g'`/${TCL_BUILD_EXP_FILE} -L`pwd | sed -e 's/ /\\\\ /g'`"
+            TCL_LIB_SPEC="-L${libdir} -ltcl${TCL_VERSION}${TCL_DBGX}"
         else
             TCL_BUILD_LIB_SPEC="-bI:`pwd | sed -e 's/ /\\\\ /g'`/${TCL_BUILD_EXP_FILE}"
             TCL_LIB_SPEC="-bI:${libdir}/${TCL_EXP_FILE}"
@@ -796,6 +797,7 @@ else
     fi
 fi
 VERSION='${VERSION}'
+eval "CFG_TCL_SHARED_LIB_PREFIX=${TCL_SHARED_LIB_PREFIX}"
 eval "CFG_TCL_SHARED_LIB_SUFFIX=${TCL_SHARED_LIB_SUFFIX}"
 eval "CFG_TCL_UNSHARED_LIB_SUFFIX=${TCL_UNSHARED_LIB_SUFFIX}"
 eval "CFG_TCL_EXPORT_FILE_SUFFIX=${TCL_EXPORT_FILE_SUFFIX}"
@@ -869,6 +871,7 @@ AC_SUBST(TCL_BUILD_STUB_LIB_SPEC)
 AC_SUBST(TCL_BUILD_STUB_LIB_PATH)
 
 AC_SUBST(TCL_SRC_DIR)
+AC_SUBST(CFG_TCL_SHARED_LIB_PREFIX)
 AC_SUBST(CFG_TCL_SHARED_LIB_SUFFIX)
 AC_SUBST(CFG_TCL_UNSHARED_LIB_SUFFIX)
 AC_SUBST(CFG_TCL_EXPORT_FILE_SUFFIX)
@@ -882,6 +885,7 @@ AC_SUBST(TCL_BUILD_EXP_FILE)
 AC_SUBST(TCL_EXP_FILE)
 
 AC_SUBST(TCL_LIB_VERSIONS_OK)
+AC_SUBST(TCL_SHARED_LIB_PREFIX)
 AC_SUBST(TCL_SHARED_LIB_SUFFIX)
 AC_SUBST(TCL_UNSHARED_LIB_SUFFIX)
 
@@ -901,6 +905,7 @@ AC_SUBST(TCL_MODULE_PATH)
 AC_SUBST(TCL_LIBRARY)
 AC_SUBST(PRIVATE_INCLUDE_DIR)
 AC_SUBST(HTML_DIR)
+AC_SUBST(SHARED_LIB_INSTALL_DIR)
 
 AC_SUBST(EXTRA_CC_SWITCHES)
 AC_SUBST(EXTRA_APP_CC_SWITCHES)
--- origsrc/tcl8.5.6/unix/installManPage	2008-12-22 14:16:08.000000000 +0000
+++ src/tcl8.5.6/unix/installManPage	2009-10-20 21:35:11.656250000 +0100
@@ -3,7 +3,7 @@
 ZIP=:
 while true; do
     case $1 in
-        -s | --symlinks  )      S="-s ";;
+        -s | --symlinks  )      SYM="-s ";;
         -z | --compress  )    ZIP=$2;  shift ;;
 	-e | --extension )      Z=$2;  shift ;;
 	-s | --suffix    ) SUFFIX=$2;  shift ;;
@@ -18,7 +18,7 @@ fi
 
 MANPAGE=$1
 DIR=$2
-test -z "$S" && S="$DIR/"
+test -z "$SYM" && SYM="$DIR/"
 
 # A sed script to parse the alternative names out of a man page.
 #
@@ -58,10 +58,10 @@ for f in $NAMES; do
 	rm -f $DIR/$FIRST $DIR/$FIRST.*
 	sed -e "/man\.macros/r $SRCDIR/man.macros" -e "/man\.macros/d" \
 	    $MANPAGE > $DIR/$FIRST
-	chmod 444 $DIR/$FIRST
+	chmod 644 $DIR/$FIRST
 	$ZIP $DIR/$FIRST
     else
 	rm -f $DIR/$f $DIR/$f.*
-	ln $S$FIRST$Z $DIR/$f$Z
+	ln $SYM$FIRST$Z $DIR/$f$Z
     fi
 done
--- origsrc/tcl8.5.6/unix/tcl.m4	2008-12-22 14:16:08.000000000 +0000
+++ src/tcl8.5.6/unix/tcl.m4	2009-10-20 21:35:11.656250000 +0100
@@ -1133,6 +1133,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
     # is disabled by the user. [Bug 1016796]
     LDFLAGS_ARCH=""
     TCL_EXPORT_FILE_SUFFIX=""
+    SHARED_LIB_PREFIX="lib"
+    SHARED_LIB_INSTALL_DIR='$(INSTALL_ROOT)$(libdir)'
     UNSHARED_LIB_SUFFIX=""
     TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
     ECHO_VERSION='`echo ${VERSION}`'
@@ -1276,6 +1278,22 @@ dnl AC_CHECK_TOOL(AR, ar)
 	    CC_SEARCH_FLAGS=""
 	    LD_SEARCH_FLAGS=""
 	    ;;
+	CYGWIN*)
+	    SHLIB_CFLAGS="-DPIC -DDLL_EXPORT"
+	    SHLIB_LD='${CC} -shared'
+	    SHLIB_LD_LIBS='${LIBS}'
+	    SHLIB_SUFFIX=".dll"
+	    DL_OBJS="tclLoadDl.o"
+	    DL_LIBS=""
+	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+	    CC_SEARCH_FLAGS=""
+	    LD_SEARCH_FLAGS=""
+	    SHARED_LIB_PREFIX="cyg"
+	    SHARED_LIB_INSTALL_DIR='$(INSTALL_ROOT)$(bindir)'
+	    TCL_SHLIB_LD_EXTRAS='-Wl,--out-implib,${TCL_BUILD_EXP_FILE}'
+	    TCL_NEEDS_EXP_FILE=1
+	    TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.dll.a'
+	    ;;
 	dgux*)
 	    SHLIB_CFLAGS="-K PIC"
 	    SHLIB_LD='${CC} -G'
@@ -2060,6 +2078,7 @@ dnl # preprocessing tests use only CPPFL
 	case $system in
 	    AIX-*) ;;
 	    BSD/OS*) ;;
+	    CYGWIN*) ;;
 	    IRIX*) ;;
 	    NetBSD-*|FreeBSD-*) ;;
 	    Darwin-*) ;;
@@ -2075,7 +2094,7 @@ dnl # preprocessing tests use only CPPFL
     AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
         LIB_SUFFIX=${SHARED_LIB_SUFFIX}
         MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
-        INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
+        INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(SHARED_LIB_INSTALL_DIR)"/$(LIB_FILE)'
     ], [
         LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
 
--- origsrc/tcl8.5.6/unix/tclConfig.sh.in	2008-12-22 14:16:08.000000000 +0000
+++ src/tcl8.5.6/unix/tclConfig.sh.in	2009-10-20 21:35:11.671875000 +0100
@@ -127,6 +127,10 @@ TCL_INCLUDE_SPEC='@TCL_INCLUDE_SPEC@'
 # example.
 TCL_LIB_VERSIONS_OK='@TCL_LIB_VERSIONS_OK@'
 
+# String that can be evaluated to generate the "lib" part of a shared
+# library name "libxxx".  On most systems this is just "lib".
+TCL_SHARED_LIB_PREFIX='@CFG_TCL_SHARED_LIB_PREFIX@'
+
 # String that can be evaluated to generate the part of a shared library
 # name that comes after the "libxxx" (includes version number, if any,
 # extension, and anything else needed).  May depend on the variables
slot=${PV_MAJ_MIN}

DESCRIPTION="Tcl language interpreter"
HOMEPAGE="http://tcl.tk/";
SRC_URI="mirror://sourceforge/tcl/${PN}${PV}-src.tar.gz"
#PATCH_URI="${slot}-cygwin.patch"

SRC_DIR="${PN}${PV}"

DIFF_EXCLUDES='aclocal.m4 configure'

src_compile() {
        cd ${S}/unix
        #WANT_AUTOMAKE="1.4" 
        aclocal -I . || error "aclocal failed"
        #WANT_AUTOCONF="2.5" 
        autoconf || error "autoconf failed"

        mkdir -p ${B}/unix
        cd ${B}/unix
        cygconf --includedir=/usr/include/tcl${slot}
        cygmake -j1
        cygmake libtcl${slot}.a STUB_LIB_FILE=libtcl${slot}.a 
STUB_LIB_OBJS=\${OBJS}
}

src_install() {
        cd ${B}/unix
        cyginstall

        dolib libtcl${slot}.a
        #mv ${D}/usr/lib/libtcl${slot}.dll ${D}/usr/bin

        sed -i \
                -e 
"s,^TCL_BUILD_LIB_SPEC='-L.*/unix,TCL_BUILD_LIB_SPEC='-L/usr/lib," \
                -e "s,^TCL_SRC_DIR='.*',TCL_SRC_DIR='/usr/include/tcl${slot}'," 
\
                -e 
"s,^TCL_BUILD_STUB_LIB_SPEC='-L.*/unix,TCL_BUILD_STUB_LIB_SPEC='-L/usr/lib," \
                -e 
"s,^TCL_BUILD_STUB_LIB_PATH='.*/unix,TCL_BUILD_STUB_LIB_PATH='/usr/lib," \
                -e "s,^TCL_CC_SEARCH_FLAGS='\(.*\)',TCL_CC_SEARCH_FLAGS=''," \
                -e "s,^TCL_LD_SEARCH_FLAGS='\(.*\)',TCL_LD_SEARCH_FLAGS=''," \
                ${D}/usr/lib/tclConfig.sh || error

        mv ${D}/usr/lib/tclConfig.sh ${D}/usr/lib/tcl${slot}/

        # install private headers
        insinto /usr/include/tcl${slot}/unix
        doins ${S}/unix/*.h
        insinto /usr/include/tcl${slot}/generic
        doins ${S}/generic/*.h

        # make the default tcl version
        dosym tclsh${slot} /usr/bin/tclsh
        dosym tcl${slot}/tclConfig.sh /usr/lib/tclConfig.sh
#       mv ${D}/usr/include/tcl${slot}/*.h ${D}/usr/include/
}
--- origsrc/tk8.5.6/generic/default.h	2004-03-17 18:15:42.000000000 +0000
+++ src/tk8.5.6/generic/default.h	2009-10-20 23:09:48.578125000 +0100
@@ -16,8 +16,7 @@
 #ifndef _DEFAULT
 #define _DEFAULT
 
-#if defined(__WIN32__) || defined(_WIN32) || \
-    defined(__CYGWIN__) || defined(__MINGW32__)
+#if defined(__WIN32__) || defined(_WIN32) || defined(__MINGW32__)
 #   include "tkWinDefault.h"
 #else
 #   if defined(MAC_OSX_TK)
--- origsrc/tk8.5.6/unix/Makefile.in	2008-12-22 18:52:02.000000000 +0000
+++ src/tk8.5.6/unix/Makefile.in	2009-10-20 23:09:48.593750000 +0100
@@ -57,9 +57,12 @@ LIB_RUNTIME_DIR		= $(libdir)
 # Directory in which to install the program wish:
 BIN_INSTALL_DIR		= $(INSTALL_ROOT)$(bindir)
 
-# Directory in which to install the .a or .so binary for the Tk library:
+# Directory in which to install the .a binary for the Tk library:
 LIB_INSTALL_DIR		= $(INSTALL_ROOT)$(libdir)
 
+# Directory in which to install the .so binary for the Tk library:
+SHARED_LIB_INSTALL_DIR	= @SHARED_LIB_INSTALL_DIR@
+
 # Path name to use when installing library scripts.
 SCRIPT_INSTALL_DIR	= $(INSTALL_ROOT)$(TK_LIBRARY)
 
@@ -688,7 +691,7 @@ install-strip:
 # possible (e.g. if installing as root).
 
 install-binaries: $(TK_LIB_FILE) $(TK_STUB_LIB_FILE) $(TK_BUILD_EXP_FILE) wish
-	@for i in "$(LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" "$(PKG_INSTALL_DIR)"; \
+	@for i in "$(LIB_INSTALL_DIR)" "$(SHARED_LIB_INSTALL_DIR)" "$(BIN_INSTALL_DIR)" "$(PKG_INSTALL_DIR)"; \
 	    do \
 	    if [ ! -d "$$i" ] ; then \
 		echo "Making directory $$i"; \
@@ -710,9 +713,9 @@ install-binaries: $(TK_LIB_FILE) $(TK_ST
 		[list load [file join \$$dir $${relative}$(TK_LIB_FILE)] Tk]";\
 	    ) > "$(PKG_INDEX)"; \
 	    fi
-	@echo "Installing $(LIB_FILE) to $(LIB_INSTALL_DIR)/"
+	@echo "Installing $(LIB_FILE) to $(SHARED_LIB_INSTALL_DIR)/"
 	@@INSTALL_LIB@
-	@chmod 555 "$(LIB_INSTALL_DIR)"/$(LIB_FILE)
+	@chmod 555 "$(SHARED_LIB_INSTALL_DIR)"/$(LIB_FILE)
 	@if test "$(TK_BUILD_EXP_FILE)" != ""; then \
 	    echo "Installing $(TK_EXP_FILE) to $(LIB_INSTALL_DIR)/"; \
 	    $(INSTALL_DATA) $(TK_BUILD_EXP_FILE) \
--- origsrc/tk8.5.6/unix/configure.in	2008-12-22 18:52:02.000000000 +0000
+++ src/tk8.5.6/unix/configure.in	2009-10-20 23:09:48.593750000 +0100
@@ -546,7 +546,8 @@ AC_C_CHAR_UNSIGNED
 
 eval eval "TK_UNSHARED_LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}"
 eval eval "TK_SHARED_LIB_SUFFIX=${SHARED_LIB_SUFFIX}"
-eval "TK_LIB_FILE=libtk${LIB_SUFFIX}"
+eval "TK_SHARED_LIB_PREFIX=${SHARED_LIB_PREFIX}"
+eval "TK_LIB_FILE=${TK_SHARED_LIB_PREFIX}tk${LIB_SUFFIX}"
 
 # tkConfig.sh needs a version of the _LIB_SUFFIX that has been eval'ed
 # since on some platforms TK_LIB_FILE contains shell escapes. 
@@ -646,8 +647,8 @@ else
         eval "TK_EXP_FILE=libtk${TCL_EXPORT_FILE_SUFFIX}"
     
         if test "$GCC" = "yes" ; then
-            TK_BUILD_LIB_SPEC="-Wl,-bI:`pwd | sed -e 's/ /\\\\ /g'`/${TK_BUILD_EXP_FILE} -L`pwd | sed -e 's/ /\\\\ /g'`"
-            TK_LIB_SPEC="-Wl,-bI:${libdir}/${TK_EXP_FILE} -L${libdir}"
+            TK_BUILD_LIB_SPEC="-Wl,`pwd | sed -e 's/ /\\\\ /g'`/${TK_BUILD_EXP_FILE} -L`pwd | sed -e 's/ /\\\\ /g'`"
+            TK_LIB_SPEC="-L${libdir} -ltk${TK_VERSION}\${TK_DBGX}"
         else
             TK_BUILD_LIB_SPEC="-bI:`pwd | sed -e 's/ /\\\\ /g'`/${TK_BUILD_EXP_FILE}"
             TK_LIB_SPEC="-bI:${libdir}/${TK_EXP_FILE}"
@@ -719,6 +720,7 @@ AC_SUBST(TK_BUILD_STUB_LIB_PATH)
 AC_SUBST(TK_SRC_DIR)
 
 AC_SUBST(TK_SHARED_BUILD)
+AC_SUBST(TK_SHARED_LIB_PREFIX)
 AC_SUBST(LD_LIBRARY_PATH_VAR)
 
 AC_SUBST(TK_BUILD_LIB_SPEC)
@@ -733,6 +735,7 @@ AC_SUBST(LOCALES)
 AC_SUBST(TK_WINDOWINGSYSTEM)
 AC_SUBST(TK_PKG_DIR)
 AC_SUBST(TK_LIBRARY)
+AC_SUBST(SHARED_LIB_INSTALL_DIR)
 AC_SUBST(PRIVATE_INCLUDE_DIR)
 AC_SUBST(HTML_DIR)
 
--- origsrc/tk8.5.6/unix/installManPage	2008-12-22 18:52:02.000000000 +0000
+++ src/tk8.5.6/unix/installManPage	2009-10-20 23:09:48.593750000 +0100
@@ -3,7 +3,7 @@
 ZIP=:
 while true; do
     case $1 in
-        -s | --symlinks  )      S="-s ";;
+        -s | --symlinks  )      SYM="-s ";;
         -z | --compress  )    ZIP=$2;  shift ;;
 	-e | --extension )      Z=$2;  shift ;;
 	-s | --suffix    ) SUFFIX=$2;  shift ;;
@@ -18,7 +18,7 @@ fi
 
 MANPAGE=$1
 DIR=$2
-test -z "$S" && S="$DIR/"
+test -z "$SYM" && SYM="$DIR/"
 
 # A sed script to parse the alternative names out of a man page.
 #
@@ -64,6 +64,6 @@ for f in $NAMES; do
 	$ZIP $DIR/$FIRST
     else
 	rm -f $DIR/$f $DIR/$f.*
-	ln $S$FIRST$Z $DIR/$f$Z
+	ln $SYM$FIRST$Z $DIR/$f$Z
     fi
 done
--- origsrc/tk8.5.6/unix/tcl.m4	2008-12-22 18:52:02.000000000 +0000
+++ src/tk8.5.6/unix/tcl.m4	2009-10-20 23:09:48.593750000 +0100
@@ -289,6 +289,7 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
     fi
 
     # eval is required to do the TCL_DBGX substitution
+    eval "TCL_INCLUDE_SPEC=\"${TCL_INCLUDE_SPEC}\""
     eval "TCL_LIB_FILE=\"${TCL_LIB_FILE}\""
     eval "TCL_STUB_LIB_FILE=\"${TCL_STUB_LIB_FILE}\""
 
@@ -336,6 +337,8 @@ AC_DEFUN([SC_LOAD_TCLCONFIG], [
     AC_SUBST(TCL_BIN_DIR)
     AC_SUBST(TCL_SRC_DIR)
 
+    AC_SUBST(TCL_INCLUDE_SPEC)
+
     AC_SUBST(TCL_LIB_FILE)
     AC_SUBST(TCL_LIB_FLAG)
     AC_SUBST(TCL_LIB_SPEC)
@@ -1133,6 +1136,8 @@ AC_DEFUN([SC_CONFIG_CFLAGS], [
     # is disabled by the user. [Bug 1016796]
     LDFLAGS_ARCH=""
     TCL_EXPORT_FILE_SUFFIX=""
+    SHARED_LIB_PREFIX="lib"
+    SHARED_LIB_INSTALL_DIR='$(INSTALL_ROOT)$(libdir)'
     UNSHARED_LIB_SUFFIX=""
     TCL_TRIM_DOTS='`echo ${VERSION} | tr -d .`'
     ECHO_VERSION='`echo ${VERSION}`'
@@ -1276,6 +1281,23 @@ dnl AC_CHECK_TOOL(AR, ar)
 	    CC_SEARCH_FLAGS=""
 	    LD_SEARCH_FLAGS=""
 	    ;;
+	CYGWIN*)
+	    SHLIB_CFLAGS=""
+	    SHLIB_LD='${CC} -shared -Wl,--enable-auto-image-base'
+	    TK_SHLIB_LD_EXTRAS='-Wl,--out-implib,${TK_BUILD_EXP_FILE}'
+	    SHLIB_LD_LIBS='${LIBS}'
+	    SHLIB_SUFFIX=".dll"
+	    CFLAGS_OPTIMIZE=-O2
+	    CC_SEARCH_FLAGS=""
+	    LD_SEARCH_FLAGS=""
+	    SHARED_LIB_PREFIX="cyg"
+	    SHARED_LIB_INSTALL_DIR='$(INSTALL_ROOT)$(bindir)'
+	    DL_OBJS="tclLoadDl.o"
+	    DL_LIBS=""
+	    LDFLAGS="$LDFLAGS -Wl,--export-dynamic"
+	    TCL_NEEDS_EXP_FILE=1
+	    TCL_EXPORT_FILE_SUFFIX='${VERSION}\$\{DBGX\}.dll.a'
+	    ;;
 	dgux*)
 	    SHLIB_CFLAGS="-K PIC"
 	    SHLIB_LD='${CC} -G'
@@ -2060,6 +2082,7 @@ dnl # preprocessing tests use only CPPFL
 	case $system in
 	    AIX-*) ;;
 	    BSD/OS*) ;;
+	    CYGWIN*) ;;
 	    IRIX*) ;;
 	    NetBSD-*|FreeBSD-*) ;;
 	    Darwin-*) ;;
@@ -2075,7 +2098,7 @@ dnl # preprocessing tests use only CPPFL
     AS_IF([test "${SHARED_BUILD}" = 1 -a "${SHLIB_SUFFIX}" != ""], [
         LIB_SUFFIX=${SHARED_LIB_SUFFIX}
         MAKE_LIB='${SHLIB_LD} -o [$]@ ${OBJS} ${SHLIB_LD_LIBS} ${TCL_SHLIB_LD_EXTRAS} ${TK_SHLIB_LD_EXTRAS} ${LD_SEARCH_FLAGS}'
-        INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(LIB_INSTALL_DIR)"/$(LIB_FILE)'
+        INSTALL_LIB='$(INSTALL_LIBRARY) $(LIB_FILE) "$(SHARED_LIB_INSTALL_DIR)"/$(LIB_FILE)'
     ], [
         LIB_SUFFIX=${UNSHARED_LIB_SUFFIX}
 
--- origsrc/tk8.5.6/unix/tkConfig.sh.in	2008-12-22 18:52:02.000000000 +0000
+++ src/tk8.5.6/unix/tkConfig.sh.in	2009-10-20 23:09:48.593750000 +0100
@@ -36,6 +36,10 @@ TK_LIB_FILE='@TK_LIB_FILE@'
 # Additional libraries to use when linking Tk.
 TK_LIBS='@XLIBSW@ @XFT_LIBS@ @LIBS@ @TCL_LIBS@'
 
+# String that can be evaluated to generate the "lib" part of a shared
+# library name "libxxx".  On most systems this is just "lib".
+TK_SHARED_LIB_PREFIX='@CFG_TCL_SHARED_LIB_PREFIX@'
+
 # Top-level directory in which Tk's platform-independent files are
 # installed.
 TK_PREFIX='@prefix@'
slot=${PV_MAJ_MIN}

DESCRIPTION="Tcl X11 GUI Toolkit"
HOMEPAGE="http://tcl.tk/";
SRC_URI="mirror://sourceforge/tcl/${PN}${PV}-src.tar.gz"
#PATCH_URI="${slot}-cygwin.patch"

SRC_DIR="${PN}${PV}"

DIFF_EXCLUDES='aclocal.m4 configure'

src_compile() {
        cd ${S}/unix
        WANT_AUTOMAKE=1.4 aclocal -I . || error
        WANT_AUTOCONF=2.5 autoconf || error

        mkdir -p ${B}/unix
        cd ${B}/unix
        cygconf --includedir=/usr/include/tcl${slot} 
--with-tcl=/usr/lib/tcl${slot}
        cygmake -j1
        cygmake libtk${slot}.a STUB_LIB_FILE=libtk${slot}.a 
STUB_LIB_OBJS=\${OBJS}
}

src_install() {
        cd ${B}/unix
        cyginstall

        dolib libtk${slot}.a
        #mv ${D}/usr/lib/libtk${slot}.dll ${D}/usr/bin

        sed -i \
                -e 
"s,^TK_BUILD_LIB_SPEC='-L.*/unix,TK_BUILD_LIB_SPEC='-L/usr/lib," \
                -e "s,^TK_SRC_DIR='.*',TK_SRC_DIR='/usr/include/tcl${slot}'," \
                -e 
"s,^TK_BUILD_STUB_LIB_SPEC='-L.*/unix,TK_BUILD_STUB_LIB_SPEC='-L/usr/lib," \
                -e 
"s,^TK_BUILD_STUB_LIB_PATH='.*/unix,TK_BUILD_STUB_LIB_PATH='/usr/lib," \
                -e "s,^TK_CC_SEARCH_FLAGS='\(.*\)',TK_CC_SEARCH_FLAGS=''," \
                -e "s,^TK_LD_SEARCH_FLAGS='\(.*\)',TK_LD_SEARCH_FLAGS=''," \
                ${D}/usr/lib/tkConfig.sh || error

        mv ${D}/usr/lib/tkConfig.sh ${D}/usr/lib/tk${slot}/tkConfig.sh

        # fix Tk location in pkgIndex.tcl
        sed -i -e 's#\.\. libtk#.. .. bin libtk#' 
${D}/usr/lib/tk${slot}/pkgIndex.tcl

        # install private headers
        insinto /usr/include/tcl${slot}/unix
        doins ${S}/unix/*.h
        insinto /usr/include/tcl${slot}/generic
        doins ${S}/generic/*.h

        # make this the default Tk version
        dosym wish${slot}.exe /usr/bin/wish
        dosym tk${slot}/tkConfig.sh /usr/lib/tkConfig.sh
}
------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay 
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Cygwin-ports-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cygwin-ports-general

Reply via email to