Changes On Branch feature-kitdll-static

Changes In Branch feature-kitdll-static Excluding Merge-Ins

This is equivalent to a diff from f71b69d91f to e6ab988ad4

2016-02-24
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:26
Created a mechanism for specifying which KitDLL to build check-in: eb5004bca0 user: rkeene tags: feature-kitdll-static
20:08
Added start of KitDLL static building check-in: 44e46cf739 user: rkeene tags: feature-kitdll-static
20:07
Create new branch named "feature-kitdll-static" check-in: 59616a0e05 user: rkeene tags: feature-kitdll-static
20:00
Added Tcl 8.5.19 to the web interface check-in: f71b69d91f user: rkeene tags: trunk
19:59
Added some hashes for individual packages check-in: 3c71954242 user: rkeene tags: trunk

Modified README from [c5d7d876b1] to [b457bfcb27].

142
143
144
145
146
147
148





149
150
151
152
153
154
155
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160







+
+
+
+
+







			itcl thread

	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

	11. KITCREATOR_STATIC_KITDLL
		Set this variable to the value "1" to build a static KitDLL.
		This only has an affect when KITCREATOR_PKGS specifies that
		"kitdll" is to be built (e.g., KITCREATOR_PKGS='kitdll')


Cross compiling Environment Variables:

	1. CC  
		C compiler   e.g. i686-pc-mingw32-gcc

	2. CXX

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

111
112
113
114
115
116
117



118


119
120
121
122
123
124
125
111
112
113
114
115
116
117
118
119
120

121
122
123
124
125
126
127
128
129







+
+
+
-
+
+







	fi

	# Cleanup
	rm -f kit kit.exe tclsh tclsh.exe

	# Determine if target is KitDLL or KitSH
	if [ "${KITTARGET}" = "kitdll" ]; then
		if [ "${KITCREATOR_STATIC_KITDLL}" = '1' ]; then
			CONFIGUREEXTRA="${CONFIGUREEXTRA} --enable-kitdll=static"
		else
		CONFIGUREEXTRA="${CONFIGUREEXTRA} --enable-kitdll"
			CONFIGUREEXTRA="${CONFIGUREEXTRA} --enable-kitdll"
		fi
	fi

	# Compile Kit
	if [ -z "${ZLIBDIR}" ]; then
		echo "Running: ./configure --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}"

		./configure --with-tcl="${TCLCONFIGDIR}" ${CONFIGUREEXTRA}
164
165
166
167
168
169
170
171

172
173
174
175
176
177
178
168
169
170
171
172
173
174

175
176
177
178
179
180
181
182







-
+







	if [ "${KITTARGET}" = "kitdll" ]; then
		## Find the library created
		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}"

			break
		done

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

12
13
14
15
16
17
18


19
20
21
22
23
24
25
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27







+
+







EXTRA_OBJS = @EXTRA_OBJS@
LDRUNPATH = @LDRUNPATH@
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
	"$(TCLSH_NATIVE)" dir2c.tcl tcl starpack.vfs $(DIR2C_FLAGS) > cvfs_data_tcl.c

41
42
43
44
45
46
47

48
49
50
51
52
53
54
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57







+








### Windows resources
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
	rm -f tclsh.o tclsh tclsh.exe
	rm -f wish.o wish wish.exe

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

1
2
3
4

5
6



7
8
9
10
11
12
13
14
15
16












17
18
19

20
21
22
23
24


1
2
3

4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

34
35
36
37
38
39
40
41



-
+


+
+
+










+
+
+
+
+
+
+
+
+
+
+
+


-
+





+
+
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
	-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@
tclsh: tclsh.o $(EXTRA_OBJS) @TARGET@
	$(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

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

13
14
15
16
17
18
19



20
21
22
23
24
25
26
27
28
29

30
31
32
33
34
35
36

37
38
39

40
41

42
43
44
45
46
47
48
49
50
51
52
53








54
55
56
57
58
59
60
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75







+
+
+










+







+



+


+












+
+
+
+
+
+
+
+







EXTRA_KIT_DEPS=""
AC_MSG_CHECKING([what target to build])
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])

			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)!]) ])

AS_IF([test "$TARGET" = "tclkit"], [
	dnl We have Tclkit
	TARGET_BASE='tclkit'

	dnl Specify local Appinit function
	AC_DEFINE(TK_LOCAL_APPINIT, [TclKit_AppInit], [Tclkit appinit function])

], [
	dnl We have KitDLL
	TARGET_BASE='kitdll'

	dnl Determine system information
	DC_CHK_OS_INFO

	dnl Determine how to create a shared object
	DC_GET_SHOBJFLAGS

	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_CHECK_TOOL(RANLIB, [ranlib], [:])
		AC_CHECK_TOOL(AR, [ar], [false MISSING AR])

		AC_DEFINE([TCLKIT_DLL_STATIC], [1], [Define if you are building a static KitDLL])
	])
])

dnl Figure out how to statically link to libgcc, if needed
DC_STATIC_LIBGCC

dnl Set linker rpath for tclsh/wish
DC_SETLDRUNPATH([.])
197
198
199
200
201
202
203
204

205
206
207
212
213
214
215
216
217
218

219
220
221
222







-
+



)

AC_SUBST(EXTRA_KIT_DEPS)
AC_SUBST(LDFLAGS_ADD)

dnl Put correct Makefile template in place
rm -f Makefile.in
cp Makefile.${TARGET}.in Makefile.in
cp Makefile.${TARGET_BASE}.in Makefile.in

dnl Produce output
AC_OUTPUT(Makefile Makefile.common)

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

567
568
569
570
571
572
573








574
575
576
577
578
579










567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597







+
+
+
+
+
+
+
+






+
+
+
+
+
+
+
+
+
+
 * are ready to be used when invoked.
 */
#ifdef TCLKIT_DLL
void __attribute__((constructor)) _Tclkit_Init(void) {
#else
static void _Tclkit_Init(void) {
#endif
	static int called = 0;

	if (called) {
		return;
	}

	called = 1;

	Tcl_StaticPackage(0, "tclkit::init", Tclkit_init_Init, NULL);

	_Tclkit_Generic_Init();

	return;
}

#if defined(TCLKIT_DLL) && defined(TCLKIT_DLL_STATIC)
int Tcl_InitReal(Tcl_Interp *interp);

int Tcl_Init(Tcl_Interp *interp) {
	_Tclkit_Init();

	return(Tcl_InitReal(interp));
}
#endif