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"
