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