Index: kitsh/build.sh ================================================================== --- kitsh/build.sh +++ kitsh/build.sh @@ -113,11 +113,11 @@ # Cleanup rm -f kit kit.exe tclsh tclsh.exe # Determine if target is KitDLL or KitSH if [ "${KITTARGET}" = "kitdll" ]; then - CONFIGUREEXTRA="${CONFIGUREEXTRA} --enable-kitdll" + CONFIGUREEXTRA="${CONFIGUREEXTRA} --enable-kitdll=static" fi # Compile Kit if [ -z "${ZLIBDIR}" ]; then echo "Running: ./configure --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}" @@ -166,11 +166,11 @@ for chkkittarget in libtclkit*.*; do if [ ! -f "${chkkittarget}" ]; then continue fi - if echo "${chkkittarget}" | egrep '\.(lib|def|a)$'; then + if echo "${chkkittarget}" | egrep '\..*\.(lib|def|a)$'; then continue fi KITTARGET_NAME="./${chkkittarget}" Index: kitsh/buildsrc/kitsh-0.0/Makefile.common.in ================================================================== --- kitsh/buildsrc/kitsh-0.0/Makefile.common.in +++ kitsh/buildsrc/kitsh-0.0/Makefile.common.in @@ -14,10 +14,12 @@ EXTRA_KIT_DEPS = @EXTRA_KIT_DEPS@ EXTRA_VFS_OBJS = @EXTRA_VFS_OBJS@ TCLSH_NATIVE = tclsh LDFLAGS_ADD = @LDFLAGS_ADD@ DIR2C_FLAGS = @DIR2C_FLAGS@ +AR = @AR@ +RANLIB = @RANLIB@ # Build targets ## VFS Build cvfs_data_tcl.o: cvfs_data_tcl.c cvfs_data_tcl.c: dir2c.tcl starpack.vfs cvfs_data.c @@ -43,10 +45,11 @@ kit.res.o: kit.rc tclkit.ico $(RC) -o kit.res.o $(CPPFLAGS) kit.rc # Cleanup routines clean: + rm -rf __TMP__ rm -f kit kit.res.o rm -f libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ rm -f $(OBJS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) rm -f cvfs_data_tcl.c cvfs_data_tcl.o rm -f cvfs.tcl.h Index: kitsh/buildsrc/kitsh-0.0/Makefile.kitdll.in ================================================================== --- kitsh/buildsrc/kitsh-0.0/Makefile.kitdll.in +++ kitsh/buildsrc/kitsh-0.0/Makefile.kitdll.in @@ -1,11 +1,14 @@ OBJS = kitInit.o rechan.o pwb.o zlib.o # Default target -all: libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ +all: @TARGET@ -include Makefile.common + +kitdll: libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ +kitdll-static: libtclkit@KITDLL_LIB_VERSION@.a ## DLL Build libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@: $(OBJS) $(EXTRA_KIT_DEPS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) $(CC) $(CPPFLAGS) $(CFLAGS) -o libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(OBJS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) $(LDFLAGS) $(SHOBJLDFLAGS) @WHOLEARCHIVE@ $(ARCHS) @NOWHOLEARCHIVE@ $(LIBS) $(LDFLAGS_ADD) -for striplib in $(STRIPLIBS); do $(OBJCOPY) --weaken "$${striplib}"; done @@ -12,13 +15,27 @@ -mv libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@.safe; \ $(CC) $(CPPFLAGS) $(CFLAGS) -o libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(OBJS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) $(LDFLAGS) $(SHOBJLDFLAGS) @WHOLEARCHIVE@ $(ARCHS) @NOWHOLEARCHIVE@ $(LIBS) || \ mv libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@.safe libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ -rm -f libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@.safe +## Static archive build +libtclkit@KITDLL_LIB_VERSION@.a: $(OBJS) $(EXTRA_KIT_DEPS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) + rm -f libtclkit@KITDLL_LIB_VERSION@.a.new + rm -rf __TMP__ + mkdir __TMP__ + for arch in $(ARCHS); do ( cd __TMP__ && ar x ../$${arch} ); done + $(OBJCOPY) --redefine-sym Tcl_Init=Tcl_InitReal __TMP__/tclInterp.o + $(AR) cr libtclkit@KITDLL_LIB_VERSION@.a.new $(OBJS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) __TMP__/*.o + rm -rf __TMP__ + $(RANLIB) libtclkit@KITDLL_LIB_VERSION@.a.new + mv libtclkit@KITDLL_LIB_VERSION@.a.new libtclkit@KITDLL_LIB_VERSION@.a + # Test driver tclsh.o: tclsh.c tclsh: tclsh.o $(EXTRA_OBJS) libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(CC) $(CPPFLAGS) $(CFLAGS) -o tclsh tclsh.o $(EXTRA_OBJS) -L. -ltclkit@KITDLL_LIB_VERSION@ $(LDRUNPATH) wish.o: wish.c wish: wish.o $(EXTRA_OBJS) libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(CC) $(CPPFLAGS) $(CFLAGS) $(WISH_CFLAGS) -o wish wish.o $(EXTRA_OBJS) -L. -ltclkit@KITDLL_LIB_VERSION@ $(LDRUNPATH) + +.PHONY: kitdll kitdll-static Index: kitsh/buildsrc/kitsh-0.0/configure.ac ================================================================== --- kitsh/buildsrc/kitsh-0.0/configure.ac +++ kitsh/buildsrc/kitsh-0.0/configure.ac @@ -15,10 +15,13 @@ AC_ARG_ENABLE(kitdll, AC_HELP_STRING([--enable-kitdll], [Enable building KitDLL instead of Tclkit (default: no)]), [ AS_CASE([$enableval], [yes|kitdll], [ TARGET="kitdll" ], + static, [ + TARGET="kitdll-static" + ] no, [ true ], [ AC_MSG_RESULT([unknown]) @@ -25,10 +28,11 @@ AC_MSG_ERROR([Invalid option: $enableval]) ] ) ]) AC_MSG_RESULT([$TARGET]) +AC_SUBST(TARGET) dnl Find the appropriate libraries to link to AC_SEARCH_LIBS(acos, m,, [ AC_MSG_WARN([Couldn't find acos (normally in libm)!]) ]) AC_SEARCH_LIBS(dlsym, dl,, [ AC_MSG_WARN([Couldn't find dlsym (normally in libdl)!]) ]) @@ -49,10 +53,16 @@ dnl Determine if we have "objcopy" available to weaken non-Tcl/Tk symbols AC_CHECK_TOOL(OBJCOPY, objcopy, [:]) dnl Define KitDLL usage AC_DEFINE([TCLKIT_DLL], [1], [Define if you are using a KitDLL rather than a Tclkit]) + + dnl Define a static KitDLL + AS_IF([test "$TARGET" = "kitdll-static"], [ + AC_DEFINE([TCLKIT_DLL_STATIC], [1], [Define if you are building a static KitDLL]) + SHOBJE + ]) ]) dnl Figure out how to statically link to libgcc, if needed DC_STATIC_LIBGCC