Check-in [3fc6a2107a]
Overview
Comment:Merged in support for creating a static KitDLL
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:3fc6a2107a69003c949af4bf9a4e160c6ccb20d1
User & Date: rkeene on 2016-02-24 20:52:23
Other Links: manifest | tags
Context
2016-02-24
21:45
Corrected an issue where the KitDLL file cannot be located cause initialization to fail check-in: 9c7bd6cad1 user: rkeene tags: trunk
20:52
Merged in support for creating a static KitDLL check-in: 3fc6a2107a user: rkeene tags: trunk
20:41
Create a Tcl_Init() symbol if we are creating a static libtclkit Closed-Leaf check-in: e6ab988ad4 user: rkeene tags: feature-kitdll-static
20:00
Added Tcl 8.5.19 to the web interface check-in: f71b69d91f user: rkeene tags: trunk
Changes

Modified README from [c5d7d876b1] to [b457bfcb27].

   142    142   			itcl thread
   143    143   
   144    144   	10. KC_TCL_STATICPKGS
   145    145   		Set this variable to the value "1" to attempt to force the
   146    146   		packages included in the "pkgs" directory of Tcl 8.6+
   147    147   		to be compiled statically
   148    148   
          149  +	11. KITCREATOR_STATIC_KITDLL
          150  +		Set this variable to the value "1" to build a static KitDLL.
          151  +		This only has an affect when KITCREATOR_PKGS specifies that
          152  +		"kitdll" is to be built (e.g., KITCREATOR_PKGS='kitdll')
          153  +
   149    154   
   150    155   Cross compiling Environment Variables:
   151    156   
   152    157   	1. CC  
   153    158   		C compiler   e.g. i686-pc-mingw32-gcc
   154    159   
   155    160   	2. CXX

Modified kitsh/build.sh from [fe33f09af3] to [cb53c1165d].

   111    111   	fi
   112    112   
   113    113   	# Cleanup
   114    114   	rm -f kit kit.exe tclsh tclsh.exe
   115    115   
   116    116   	# Determine if target is KitDLL or KitSH
   117    117   	if [ "${KITTARGET}" = "kitdll" ]; then
   118         -		CONFIGUREEXTRA="${CONFIGUREEXTRA} --enable-kitdll"
          118  +		if [ "${KITCREATOR_STATIC_KITDLL}" = '1' ]; then
          119  +			CONFIGUREEXTRA="${CONFIGUREEXTRA} --enable-kitdll=static"
          120  +		else
          121  +			CONFIGUREEXTRA="${CONFIGUREEXTRA} --enable-kitdll"
          122  +		fi
   119    123   	fi
   120    124   
   121    125   	# Compile Kit
   122    126   	if [ -z "${ZLIBDIR}" ]; then
   123    127   		echo "Running: ./configure --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}"
   124    128   
   125    129   		./configure --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA}
................................................................................
   164    168   	if [ "${KITTARGET}" = "kitdll" ]; then
   165    169   		## Find the library created
   166    170   		for chkkittarget in libtclkit*.*; do
   167    171   			if [ ! -f "${chkkittarget}" ]; then
   168    172   				continue
   169    173   			fi
   170    174   
   171         -			if echo "${chkkittarget}" | egrep '\.(lib|def|a)$'; then
          175  +			if echo "${chkkittarget}" | egrep '\..*\.(lib|def|a)$'; then
   172    176   				continue
   173    177   			fi
   174    178   
   175    179   			KITTARGET_NAME="./${chkkittarget}"
   176    180   
   177    181   			break
   178    182   		done

Modified kitsh/buildsrc/kitsh-0.0/Makefile.common.in from [93d968f811] to [bfce9994ae].

    12     12   EXTRA_OBJS = @EXTRA_OBJS@
    13     13   LDRUNPATH = @LDRUNPATH@
    14     14   EXTRA_KIT_DEPS = @EXTRA_KIT_DEPS@
    15     15   EXTRA_VFS_OBJS = @EXTRA_VFS_OBJS@
    16     16   TCLSH_NATIVE = tclsh
    17     17   LDFLAGS_ADD = @LDFLAGS_ADD@
    18     18   DIR2C_FLAGS = @DIR2C_FLAGS@
           19  +AR = @AR@
           20  +RANLIB = @RANLIB@
    19     21   
    20     22   # Build targets
    21     23   ## VFS Build
    22     24   cvfs_data_tcl.o: cvfs_data_tcl.c
    23     25   cvfs_data_tcl.c: dir2c.tcl starpack.vfs cvfs_data.c
    24     26   	"$(TCLSH_NATIVE)" dir2c.tcl tcl starpack.vfs $(DIR2C_FLAGS) > cvfs_data_tcl.c
    25     27   
................................................................................
    41     43   
    42     44   ### Windows resources
    43     45   kit.res.o: kit.rc tclkit.ico
    44     46   	$(RC) -o kit.res.o $(CPPFLAGS) kit.rc
    45     47   
    46     48   # Cleanup routines
    47     49   clean:
           50  +	rm -rf __TMP__
    48     51   	rm -f kit kit.res.o
    49     52   	rm -f libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@
    50     53   	rm -f $(OBJS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS)
    51     54   	rm -f cvfs_data_tcl.c cvfs_data_tcl.o
    52     55   	rm -f cvfs.tcl.h
    53     56   	rm -f tclsh.o tclsh tclsh.exe
    54     57   	rm -f wish.o wish wish.exe

Modified kitsh/buildsrc/kitsh-0.0/Makefile.kitdll.in from [05829b4d07] to [6164206d04].

     1      1   OBJS = kitInit.o rechan.o pwb.o zlib.o
     2      2   
     3      3   # Default target
     4         -all: libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@
            4  +all: @TARGET@
     5      5   
     6      6   -include Makefile.common
            7  +
            8  +kitdll: libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@
            9  +kitdll-static: libtclkit@KITDLL_LIB_VERSION@.a
     7     10   
     8     11   ## DLL Build
     9     12   libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@: $(OBJS) $(EXTRA_KIT_DEPS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS)
    10     13   	$(CC) $(CPPFLAGS) $(CFLAGS) -o libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(OBJS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) $(LDFLAGS) $(SHOBJLDFLAGS) @WHOLEARCHIVE@ $(ARCHS) @NOWHOLEARCHIVE@ $(LIBS) $(LDFLAGS_ADD)
    11     14   	-for striplib in $(STRIPLIBS); do $(OBJCOPY) --weaken "$${striplib}"; done
    12     15   	-mv libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@.safe; \
    13     16   		$(CC) $(CPPFLAGS) $(CFLAGS) -o libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(OBJS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) $(LDFLAGS) $(SHOBJLDFLAGS) @WHOLEARCHIVE@ $(ARCHS) @NOWHOLEARCHIVE@ $(LIBS) || \
    14     17   			mv libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@.safe libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@
    15     18   	-rm -f libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@.safe
    16     19   
           20  +## Static archive build
           21  +libtclkit@KITDLL_LIB_VERSION@.a: $(OBJS) $(EXTRA_KIT_DEPS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS)
           22  +	rm -f libtclkit@KITDLL_LIB_VERSION@.a.new
           23  +	rm -rf __TMP__
           24  +	mkdir __TMP__
           25  +	for arch in $(ARCHS); do ( cd __TMP__ && ar x ../$${arch} ); done
           26  +	$(OBJCOPY) --redefine-sym Tcl_Init=Tcl_InitReal __TMP__/tclInterp.o
           27  +	$(AR) cr libtclkit@KITDLL_LIB_VERSION@.a.new $(OBJS) $(EXTRA_OBJS) $(EXTRA_VFS_OBJS) __TMP__/*.o
           28  +	rm -rf __TMP__
           29  +	$(RANLIB) libtclkit@KITDLL_LIB_VERSION@.a.new
           30  +	mv libtclkit@KITDLL_LIB_VERSION@.a.new libtclkit@KITDLL_LIB_VERSION@.a
           31  +
    17     32   # Test driver
    18     33   tclsh.o: tclsh.c
    19         -tclsh: tclsh.o $(EXTRA_OBJS) libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@
           34  +tclsh: tclsh.o $(EXTRA_OBJS) @TARGET@
    20     35   	$(CC) $(CPPFLAGS) $(CFLAGS) -o tclsh tclsh.o $(EXTRA_OBJS) -L. -ltclkit@KITDLL_LIB_VERSION@ $(LDRUNPATH)
    21     36   
    22     37   wish.o: wish.c
    23     38   wish: wish.o $(EXTRA_OBJS) libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@
    24     39   	$(CC) $(CPPFLAGS) $(CFLAGS) $(WISH_CFLAGS) -o wish wish.o $(EXTRA_OBJS) -L. -ltclkit@KITDLL_LIB_VERSION@ $(LDRUNPATH)
           40  +
           41  +.PHONY: kitdll kitdll-static

Modified kitsh/buildsrc/kitsh-0.0/configure.ac from [42d57f3f66] to [77fa1a4052].

    13     13   EXTRA_KIT_DEPS=""
    14     14   AC_MSG_CHECKING([what target to build])
    15     15   AC_ARG_ENABLE(kitdll, AC_HELP_STRING([--enable-kitdll], [Enable building KitDLL instead of Tclkit (default: no)]), [
    16     16   	AS_CASE([$enableval],
    17     17   		[yes|kitdll], [
    18     18   			TARGET="kitdll"
    19     19   		],
           20  +		static, [
           21  +			TARGET="kitdll-static"
           22  +		],
    20     23   		no, [
    21     24   			true
    22     25   		], [
    23     26   			AC_MSG_RESULT([unknown])
    24     27   
    25     28   			AC_MSG_ERROR([Invalid option: $enableval])
    26     29   		]
    27     30   	)
    28     31   ])
    29     32   AC_MSG_RESULT([$TARGET])
           33  +AC_SUBST(TARGET)
    30     34   
    31     35   dnl Find the appropriate libraries to link to
    32     36   AC_SEARCH_LIBS(acos, m,, [ AC_MSG_WARN([Couldn't find acos (normally in libm)!]) ])
    33     37   AC_SEARCH_LIBS(dlsym, dl,, [ AC_MSG_WARN([Couldn't find dlsym (normally in libdl)!]) ])
    34     38   
    35     39   AS_IF([test "$TARGET" = "tclkit"], [
    36     40   	dnl We have Tclkit
           41  +	TARGET_BASE='tclkit'
    37     42   
    38     43   	dnl Specify local Appinit function
    39     44   	AC_DEFINE(TK_LOCAL_APPINIT, [TclKit_AppInit], [Tclkit appinit function])
           45  +
    40     46   ], [
    41     47   	dnl We have KitDLL
           48  +	TARGET_BASE='kitdll'
    42     49   
    43     50   	dnl Determine system information
    44     51   	DC_CHK_OS_INFO
    45     52   
    46     53   	dnl Determine how to create a shared object
    47     54   	DC_GET_SHOBJFLAGS
    48     55   
    49     56   	dnl Determine if we have "objcopy" available to weaken non-Tcl/Tk symbols
    50     57   	AC_CHECK_TOOL(OBJCOPY, objcopy, [:])
    51     58   
    52     59   	dnl Define KitDLL usage
    53     60   	AC_DEFINE([TCLKIT_DLL], [1], [Define if you are using a KitDLL rather than a Tclkit])
           61  +
           62  +	dnl Define a static KitDLL
           63  +	AS_IF([test "$TARGET" = "kitdll-static"], [
           64  +		AC_CHECK_TOOL(RANLIB, [ranlib], [:])
           65  +		AC_CHECK_TOOL(AR, [ar], [false MISSING AR])
           66  +
           67  +		AC_DEFINE([TCLKIT_DLL_STATIC], [1], [Define if you are building a static KitDLL])
           68  +	])
    54     69   ])
    55     70   
    56     71   dnl Figure out how to statically link to libgcc, if needed
    57     72   DC_STATIC_LIBGCC
    58     73   
    59     74   dnl Set linker rpath for tclsh/wish
    60     75   DC_SETLDRUNPATH([.])
................................................................................
   197    212   )
   198    213   
   199    214   AC_SUBST(EXTRA_KIT_DEPS)
   200    215   AC_SUBST(LDFLAGS_ADD)
   201    216   
   202    217   dnl Put correct Makefile template in place
   203    218   rm -f Makefile.in
   204         -cp Makefile.${TARGET}.in Makefile.in
          219  +cp Makefile.${TARGET_BASE}.in Makefile.in
   205    220   
   206    221   dnl Produce output
   207    222   AC_OUTPUT(Makefile Makefile.common)

Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [3cb384a768] to [f888dda2c4].

   567    567    * are ready to be used when invoked.
   568    568    */
   569    569   #ifdef TCLKIT_DLL
   570    570   void __attribute__((constructor)) _Tclkit_Init(void) {
   571    571   #else
   572    572   static void _Tclkit_Init(void) {
   573    573   #endif
          574  +	static int called = 0;
          575  +
          576  +	if (called) {
          577  +		return;
          578  +	}
          579  +
          580  +	called = 1;
          581  +
   574    582   	Tcl_StaticPackage(0, "tclkit::init", Tclkit_init_Init, NULL);
   575    583   
   576    584   	_Tclkit_Generic_Init();
   577    585   
   578    586   	return;
   579    587   }
          588  +
          589  +#if defined(TCLKIT_DLL) && defined(TCLKIT_DLL_STATIC)
          590  +int Tcl_InitReal(Tcl_Interp *interp);
          591  +
          592  +int Tcl_Init(Tcl_Interp *interp) {
          593  +	_Tclkit_Init();
          594  +
          595  +	return(Tcl_InitReal(interp));
          596  +}
          597  +#endif