Index: README ================================================================== --- README +++ README @@ -139,11 +139,14 @@ Additionally, any bundled packages (in the "pkgs" directory) are excluded. This typically includes (as of Tcl 8.6): itcl thread - Also, TclOO is removed from Tcl 8.6 forcefully. + 10. KC_TCL_STATICPKGS + Set this variable to the value "1" to attempt to force the + packages included in the "pkgs" directory of Tcl 8.6+ + to be compiled statically Cross compiling Environment Variables: 1. CC ADDED tcl/patchscripts/force-static-pkgs.sh Index: tcl/patchscripts/force-static-pkgs.sh ================================================================== --- /dev/null +++ tcl/patchscripts/force-static-pkgs.sh @@ -0,0 +1,23 @@ +#! /usr/bin/env bash + +if [ "${KC_TCL_STATICPKGS}" != '1' ]; then + exit 0 +fi + +for makefile in {unix,win,macosx}/Makefile.in; do + sed 's@--enable-shared@--disable-shared CFLAGS="-fPIC" @g' "${makefile}" > "${makefile}.new" + cat "${makefile}.new" > "${makefile}" + rm -f "${makefile}.new" +done + +for pkgIndexFile in pkgs/*/pkgIndex*; do + sed 's@load \[file join [^]]*\]@load {}@;s@\(Thread.* \[list load {}\)\]@\1 Thread]@' "${pkgIndexFile}" > "${pkgIndexFile}.new" + cat "${pkgIndexFile}.new" > "${pkgIndexFile}" + rm -f "${pkgIndexFile}.new" +done + +for makefile in pkgs/*/Makefile*; do + sed 's@x\$(SHARED_BUILD)@x1@g' "${makefile}" > "${makefile}.new" + cat "${makefile}.new" > "${makefile}" + rm -f "${makefile}.new" +done