Overview
Comment: | Updated to support building Mk4tcl dynamically when building KitDLL, but falling back to building statically. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: | 76ec61a4135798170ebd58e04bcd620ea456f079 |
User & Date: | rkeene on 2010-10-06 07:06:11 |
Other Links: | manifest | tags |
References
2010-10-06
| ||
16:47 | • Closed ticket [ff1065968a]: KitDLL needs to support static linking to Mk4tcl plus 2 other changes artifact: 6aa39ca867 user: rkeene | |
Context
2010-10-06
| ||
14:47 | KitCreator 0.5.2.x check-in: acfbaa597c user: rkeene tags: trunk, 0.5.2 | |
07:06 | Updated to support building Mk4tcl dynamically when building KitDLL, but falling back to building statically. check-in: 76ec61a413 user: rkeene tags: trunk | |
05:05 | KitCreator 0.5.1.x check-in: b0d82098c4 user: rkeene tags: trunk, 0.5.1 | |
Changes
Modified README from [723f4f4df1] to [4cc6a27d05].
79 79 4. STATICTK 80 80 Specify this as "1" to statically link to Tk. The default 81 81 action on most platforms is to dynamically link to Tk. When 82 82 building KitDLL, STATICTK is "1" by default. If you want to 83 83 enable dynamic linking of Tk with KitDLL you will have to 84 84 specify this as "-1". 85 85 86 - 5. STRIP 86 + 5. STATICMK4 87 + Specify this as "0" to attempt to create create the "mk4tcl" 88 + project as a shared object. If this fails, it will fall back 89 + to building statically. Specify it as "-1" to force building 90 + it as a shared object. Any other value, including being unset 91 + results in "mk4tcl" being built and linked statically. KitDILL 92 + sets this to variable to "0". If Metakit4 is built shared, it 93 + cannot be used for the kit storage for Tclkit. 94 + 95 + 6. STRIP 87 96 Specifies the tool you wish to be called to strip object files, 88 97 archives, and shared objects. The default is "strip". You 89 98 should probably set this if you are cross-compiling. 90 99 91 - 6. KITCREATOR_PKGS 100 + 7. KITCREATOR_PKGS 92 101 Specify which non-required packages to build. The default list 93 102 is: 94 103 tk itcl mk4tcl 95 104 96 105 If mk4tcl is not present a Zip-based storage mechanism will be 97 106 used instead. To specify that the default be used, do not set 98 107 this or set it to the empty string. To specify that no 99 108 non-required packages be built, set it to a string that 100 109 contains only white space. 101 110 102 111 If "kitdll" is specified in the list the target becomes KitDLL 103 112 and no Tclkit will built, but instead libtclkit. 104 113 105 - 7. KITCREATOR_MINENCODINGS 114 + 8. KITCREATOR_MINENCODINGS 106 115 Set this variable to a non-empty string to generate a Tclkit 107 116 without all encodings, only including the following: 108 117 ascii.enc cp1252.enc iso8859-1.enc iso8859-15.enc 109 118 iso8859-2.enc koi8-r.enc macRoman.enc 110 119 111 - 8. KITCREATOR_MINBUILD 120 + 9. KITCREATOR_MINBUILD 112 121 Set this variable to a non-empty string to exclude unnecessary 113 122 packages from Tcl build. This excludes the following packages: 114 123 tcltest 115 124 116 125 Kitsh Configure Options: 117 126 1. --enable-kit-storage={zip|mk4|auto} 118 127 Specify which type of storage to use with the Tclkit. The 119 128 default is to auto-detect. Auto-detection uses Mk4 if 120 - available, otherwise it falls back to Zip. 129 + available and built statically, otherwise it falls back to Zip. 121 130 122 131 ------------------- 123 132 Method of Operation 124 133 ------------------- 125 134 Summary: 126 135 1. "kitcreator" calls */build.sh 127 136 2. */build.sh downloads and compiles appropriate software
Modified kitcreator from [2a70843ef3] to [15de613872].
70 70 if [ "${STATICTK}" != "1" -a "${STATICTK}" != "-1" ]; then 71 71 echo 'Warning: Linking Tk statically because you are building KitDLL' 2>&1 72 72 echo ' Set STATICTK to -1 if you really want to link Tk dynamically.' >&2 73 73 74 74 STATICTK="1" 75 75 export STATICTK 76 76 fi 77 + 78 + if [ -z "${STATICMK4}" ]; then 79 + echo 'Warning: Linking Mk4tcl dynamically because you are building KitDLL' 2>&1 80 + echo ' Set STATICMK4 to 1 if you really want to link Mk4tcl statically.' >&2 81 + 82 + STATICMK4="0" 83 + export STATICMK4 84 + fi 77 85 fi 78 86 fi 79 87 80 88 failedpkgs="" 81 89 buildfailed="0" 82 90 for pkg in tcl tclvfs zlib ${KITCREATOR_PKGS} "${KITTARGET}"; do 83 91 echo -n "Building ${pkg} ..."
Modified kitdll/buildsrc/kitdll-0.0/aclocal.m4 from [269cb779e2] to [57e33ec54f].
235 235 ], [ 236 236 LIBS="${SAVE_LIBS}" 237 237 238 238 $3 239 239 ] 240 240 ) 241 241 ]) 242 + 243 +AC_DEFUN(DC_DO_STATIC_LINK_LIB, [ 244 + AC_MSG_CHECKING([for how to statically link to $1]) 245 + 246 + SAVELIBS="${LIBS}" 247 + staticlib="" 248 + found="0" 249 + dnl HP/UX uses -Wl,-a,archive -lstdc++ -Wl,-a,shared_archive 250 + dnl Linux and Solaris us -Wl,-Bstatic ... -Wl,-Bdynamic 251 + for trylink in "-Wl,-a,archive $2 -Wl,-a,shared_archive" "-Wl,-Bstatic $2 -Wl,-Bdynamic" "$2"; do 252 + LIBS="${SAVELIBS} ${trylink}" 253 + 254 + AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ 255 + staticlib="${trylink}" 256 + found="1" 257 + 258 + break 259 + ]) 260 + done 261 + 262 + if test "${found}" = "1"; then 263 + SAVELIBS=`echo "$SAVELIBS" | sed 's@ $2 @ @'` 264 + LIBS="${SAVELIBS} ${staticlib}" 265 + 266 + AC_MSG_RESULT([${staticlib}]) 267 + 268 + AC_SUBST(LIBS) 269 + 270 + $3 271 + else 272 + LIBS="${SAVELIBS}" 273 + 274 + AC_MSG_RESULT([cant]) 275 + 276 + $4 277 + fi 278 +]) 279 + 280 +AC_DEFUN(DC_DO_STATIC_LINK_LIBCXX, [ 281 + dnl Sun Studio uses -lCstd -lCrun, most platforms use -lstdc++ 282 + DC_DO_STATIC_LINK_LIB([C++ Library (Sun Studio)], [-lCstd -lCrun],, [ 283 + DC_DO_STATIC_LINK_LIB([C++ Library (UNIX)], [-lstdc++]) 284 + ]) 285 +]) 242 286 243 287 AC_DEFUN(DC_FIND_TCLKIT_LIBS, [ 244 288 DC_SETUP_TCL_PLAT_DEFS 245 289 246 290 WISH_CFLAGS="" 247 291 248 292 dnl We will need this for the Tcl project, which we will always have 249 293 DC_CHECK_FOR_WHOLE_ARCHIVE 250 294 251 - for proj in tcl tclvfs tk; do 295 + for proj in tcl tclvfs tk mk4tcl; do 252 296 AC_MSG_CHECKING([for libraries required for ${proj}]) 253 297 254 298 libdir="../../../${proj}/inst" 255 299 libfiles="`find "${libdir}" -name '*.a' 2>/dev/null | tr "\n" ' '`" 256 300 libfilesnostub="`find "${libdir}" -name '*.a' 2>/dev/null | grep -v 'stub' | tr "\n" ' '`" 257 301 258 302 for libfile in ${libfiles}; do ................................................................................ 266 310 DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $libfiles], [ 267 311 libfiles="${libfiles}" 268 312 ]) 269 313 ]) 270 314 fi 271 315 272 316 if test "${proj}" = "mk4tcl"; then 273 - if test -n "$libfilesnostub"; then 317 + if test -n "$libfiles"; then 274 318 AC_DEFINE(KIT_INCLUDES_MK4TCL, [1], [Specify this if you link against mkt4tcl]) 319 + DC_DO_STATIC_LINK_LIBCXX 275 320 fi 276 321 fi 277 322 278 323 if test "$proj" = "tk"; then 279 324 if test -n "$libfilesnostub"; then 280 325 DC_DO_TK 281 326 DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $libfilesnostub], [
Modified mk4tcl/build.sh from [92a8d1c751] to [9c93a36278].
62 62 # If we are building for Win32, we need to define "BUILD_tcl" so that 63 63 # TCL_STORAGE_CLASS gets defined as DLLEXPORT, to make static linking 64 64 # work 65 65 BUILDTYPE="$(basename "${TCLCONFIGDIR}")" 66 66 if [ "${BUILDTYPE}" = "win" ]; then 67 67 CPPFLAGS="${CPPFLAGS} -DBUILD_tcl=1" 68 68 export CPPFLAGS 69 + 70 + if [ "${STATICMK4}" != "-1" ]; then 71 + if [ "${STATICMK4}" = "0" ]; then 72 + echo 'Warning: Metakit4 fails to build shared on Win32, converting to static linking' 73 + 74 + STATICMK4="1" 75 + fi 76 + else 77 + STATICMK4="0" 78 + fi 79 + export STATICMK4 69 80 fi 70 81 71 - 72 - # If we are building for KitDLL, compile as shared 73 - isshared="0" 74 - if [ "${KITTARGET}" = "kitdll" ]; then 75 - isshared="1" 76 - 77 - echo "Running: ./configure --enable-shared --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --with-tcl=\"${TCLCONFIGDIR}/../generic\" ${CONFIGUREEXTRA}" 78 - ./configure --enable-shared --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --with-tcl="${TCLCONFIGDIR}/../generic" ${CONFIGUREEXTRA} 82 + # Try to build as a shared object if requested 83 + if [ "${STATICMK4}" = "0" ]; then 84 + tryopts="--enable-shared --disable-shared" 85 + elif [ "${STATICMK4}" = "-1" ]; then 86 + tryopts="--enable-shared" 79 87 else 80 - echo "Running: ./configure --disable-shared --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --with-tcl=\"${TCLCONFIGDIR}/../generic\" ${CONFIGUREEXTRA}" 81 - ./configure --disable-shared --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --with-tcl="${TCLCONFIGDIR}/../generic" ${CONFIGUREEXTRA} 88 + tryopts="--disable-shared" 82 89 fi 83 90 84 - echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\"" 85 - ${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" && \ 86 - ${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" install || ( 91 + for tryopt in $tryopts __fail__; do 92 + # Clean up, if needed 93 + make distclean >/dev/null 2>/dev/null 87 94 rm -rf "${INSTDIR}" 88 95 mkdir "${INSTDIR}" 89 96 90 - exit 1 91 - ) || exit 1 97 + if [ "${tryopt}" = "__fail__" ]; then 98 + exit 1 99 + fi 100 + 101 + if [ "${tryopt}" == "--enable-shared" ]; then 102 + isshared="1" 103 + else 104 + isshared="0" 105 + fi 106 + 107 + ( 108 + echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --with-tcl=\"${TCLCONFIGDIR}/../generic\" ${CONFIGUREEXTRA}" 109 + ./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --with-tcl="${TCLCONFIGDIR}/../generic" ${CONFIGUREEXTRA} 110 + 111 + echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\"" 112 + ${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" || exit 1 113 + 114 + echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" AR=\"${AR:-ar}\" RANLIB=\"${RANLIB:-ranlib}\" install" 115 + ${MAKE:-make} tcllibdir="${INSTDIR}/lib" AR="${AR:-ar}" RANLIB="${RANLIB:-ranlib}" install || exit 1 116 + ) || continue 117 + 118 + break 119 + done 120 + 121 + # Clean up "libmk4.*", it's not needed 122 + rm -f "${INSTDIR}/lib"/libmk4.* 92 123 124 + # If we are building a shared version of Mk4tcl, put it in the VFS directory 93 125 if [ "${isshared}" = "1" ]; then 94 - # If we are building a shared version of Mk4tcl, put it in the VFS directory 95 126 cp -r "${INSTDIR}/lib" "${OUTDIR}" 96 127 fi 97 128 98 129 exit 0 99 130 ) || exit 1 100 131 101 132 exit 0