Check-in [df550ab43e]
Overview
Comment:More work on consolidating KitSH and KitDLL and supporting C-VFS
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | merge-kitdll-kitsh-common
Files: files | file ages | folders
SHA1: df550ab43e08326bab54c4eafc7625a88a037579
User & Date: rkeene on 2011-05-23 03:14:38
Other Links: branch diff | manifest | tags
Context
2011-05-23
10:53
Integrated KitDLL into KitSH check-in: a1a14e0aba user: rkeene tags: merge-kitdll-kitsh-common
03:14
More work on consolidating KitSH and KitDLL and supporting C-VFS check-in: df550ab43e user: rkeene tags: merge-kitdll-kitsh-common
2011-05-21
15:57
Added file missing from last commit check-in: ef0c50058f user: rkeene tags: merge-kitdll-kitsh-common
Changes

Modified kitsh/buildsrc/kitsh-0.0/Makefile.common.in from [b5f1011747] to [3d3c56cfe6].














1
2
3
4
5
6
7
8
9
10
11



















































TCLSH_NATIVE = tclsh

# Build targets
## VFS Build
vfs_kitdll_data_tcl.o: vfs_kitdll_data_tcl.c
vfs_kitdll_data_tcl.c: dir2c.tcl starpack.vfs vfs_kitdll_data.c
	"$(TCLSH_NATIVE)" dir2c.tcl tcl starpack.vfs > vfs_kitdll_data_tcl.c

## Tclkit Build
vfs_kitdll.tcl.h: vfs_kitdll.tcl
	"$(TCLSH_NATIVE)" ./stringify.tcl vfs_kitdll.tcl > vfs_kitdll.tcl.h






































>
>
>
>
>
>
>
>
>
>
>
>
>








|


>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
CC = @CC@
RC = @RC@
OBJCOPY = @OBJCOPY@
CFLAGS = @CFLAGS@ @SHOBJFLAGS@
CPPFLAGS = @CPPFLAGS@ @DEFS@
WISH_CFLAGS = @WISH_CFLAGS@
LDFLAGS = @LDFLAGS@
SHOBJLDFLAGS = @SHOBJLDFLAGS@
LIBS = @LIBS@
ARCHS = @ARCHS@
STRIPLIBS = @STRIPLIBS@ @EXTRA_OBJS@
EXTRA_OBJS = @EXTRA_OBJS@
EXTRA_KIT_DEPS = @EXTRA_KIT_DEPS@
TCLSH_NATIVE = tclsh

# Build targets
## VFS Build
vfs_kitdll_data_tcl.o: vfs_kitdll_data_tcl.c
vfs_kitdll_data_tcl.c: dir2c.tcl starpack.vfs vfs_kitdll_data.c
	"$(TCLSH_NATIVE)" dir2c.tcl tcl starpack.vfs > vfs_kitdll_data_tcl.c

## Tcl scripts that need to be converted to C headers
vfs_kitdll.tcl.h: vfs_kitdll.tcl
	"$(TCLSH_NATIVE)" ./stringify.tcl vfs_kitdll.tcl > vfs_kitdll.tcl.h

boot.tcl.h: boot.tcl
	"$(TCLSH_NATIVE)" ./stringify.tcl boot.tcl > boot.tcl.h

zipvfs.tcl.h: zipvfs.tcl
	"$(TCLSH_NATIVE)" ./stringify.tcl zipvfs.tcl > zipvfs.tcl.h

## Objects
kitInit.o: kitInit.c boot.tcl.h $(EXTRA_KIT_DEPS)
rechan.o: rechan.c
pwb.o: pwb.c
zlib.o: zlib.c

### Windows resources
kit.res.o: kit.rc kit.ico
	$(RC) -o kit.res.o $(CPPFLAGS) kit.rc

# Cleanup routines
clean:
	rm -f kit kit.res.o
	rm -f libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@
	rm -f $(OBJS)
	rm -f vfs_kitdll_data_tcl.c
	rm -f vfs_kitdll.tcl.h
	rm -f tclsh.o tclsh tclsh.exe
	rm -f wish.o wish wish.exe

distclean: clean
	rm -f Makefile Makefile.in Makefile.common
	rm -f config.status config.log
	rm -f *~
	rm -rf autom4te.cache
	rm -rf starpack.vfs

mrproper: distclean
	rm -f configure config.h boot.tcl.h zipvfs.tcl.h

.PHONY: all clean distclean mrproper

Modified kitsh/buildsrc/kitsh-0.0/Makefile.kitdll.in from [9cd9dc1edd] to [d50a3331ee].

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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
CC = @CC@
OBJCOPY = @OBJCOPY@
CFLAGS = @CFLAGS@ @SHOBJFLAGS@ -Wall
CPPFLAGS = @CPPFLAGS@ @DEFS@ -DKITDLL_MAKE_LOADABLE=1
WISH_CFLAGS = @WISH_CFLAGS@
LDFLAGS = @LDFLAGS@
SHOBJLDFLAGS = @SHOBJLDFLAGS@
LIBS = @LIBS@
STATICLIBS = @ARCHS@
STRIPLIBS = @STRIPLIBS@ @EXTRA_OBJS@
OBJS = vfs_kitdll_data_tcl.o kitInit.o rechan.o pwb.o zlib.o
EXTRA_OBJS = @EXTRA_OBJS@
TCLSH_NATIVE = tclsh

# Default target
all: libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@

-include Makefile.common

## Tclkit Build
kitInit.o: kitInit.c vfs_kitdll.tcl.h

## Extensions
rechan.o: rechan.c
pwb.o: pwb.c
zlib.o: zlib.c

## DLL Build
libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@: $(OBJS) $(EXTRA_OBJS)
	-for striplib in $(STRIPLIBS); do $(OBJCOPY) --weaken "$${striplib}"; done
	$(CC) $(CPPFLAGS) $(CFLAGS) -o libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(OBJS) $(EXTRA_OBJS) $(LDFLAGS) $(SHOBJLDFLAGS) @WHOLEARCHIVE@ $(STATICLIBS) @NOWHOLEARCHIVE@ $(LIBS)

# 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@ -Wl,-rpath,.

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@ -Wl,-rpath,.

# Cleanup routeines
clean:
	rm -f libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@
	rm -f $(OBJS)
	rm -f vfs_kitdll_data_tcl.c
	rm -f vfs_kitdll.tcl.h
	rm -f tclsh.o tclsh tclsh.exe
	rm -f wish.o wish wish.exe

distclean: clean
	rm -f config.status config.log
	rm -f *~
	rm -f Makefile Makefile.in Makefile.common
	rm -rf starpack.vfs

mrproper: distclean

.PHONY: all clean distclean
<
<
<
<
<
<
<
<
<
<

<
<






<
<
<
<
<
<
<
<

|

|









<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<










1


2
3
4
5
6
7








8
9
10
11
12
13
14
15
16
17
18
19
20





























OBJS = vfs_kitdll_data_tcl.o kitInit.o rechan.o pwb.o zlib.o



# Default target
all: libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@

-include Makefile.common









## DLL Build
libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@: $(OBJS) $(EXTRA_KIT_DEPS) $(EXTRA_OBJS)
	-for striplib in $(STRIPLIBS); do $(OBJCOPY) --weaken "$${striplib}"; done
	$(CC) $(CPPFLAGS) $(CFLAGS) -o libtclkit@KITDLL_LIB_VERSION@.@SHOBJEXT@ $(OBJS) $(EXTRA_OBJS) $(LDFLAGS) $(SHOBJLDFLAGS) @WHOLEARCHIVE@ $(ARCHS) @NOWHOLEARCHIVE@ $(LIBS)

# 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@ -Wl,-rpath,.

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@ -Wl,-rpath,.



















Modified kitsh/buildsrc/kitsh-0.0/Makefile.tclkit.in from [2493fcdddc] to [fe7827b4fe].

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
CC = @CC@
RC = @RC@
CFLAGS = @CFLAGS@ @DEFS@ -DTK_LOCAL_APPINIT=TclKit_AppInit
CPPFLAGS = @CPPFLAGS@ @DEFS@ -DTK_LOCAL_APPINIT=TclKit_AppInit
LDFLAGS = @LDFLAGS@
LIBS = @LIBS@
ARCHS = @ARCHS@
OBJS = kitInit.o main.o pwb.o rechan.o zlib.o winMain.o
EXTRA_OBJS = @EXTRA_OBJS@

all: kit

-include Makefile.common

kit.res.o: kit.rc kit.ico
	$(RC) -o kit.res.o $(CPPFLAGS) kit.rc

kit: $(OBJS) $(EXTRA_OBJS) $(ARCHS)
	$(CC) $(CPPFLAGS) $(CFLAGS) -o kit $(OBJS) $(EXTRA_OBJS) $(ARCHS) $(LDFLAGS) $(LIBS)

boot.tcl.h: boot.tcl
	"$(TCLSH_NATIVE)" ./stringify.tcl boot.tcl > boot.tcl.h

zipvfs.tcl.h: zipvfs.tcl
	"$(TCLSH_NATIVE)" ./stringify.tcl zipvfs.tcl > zipvfs.tcl.h

clean:
	rm -f kit $(OBJS) kit.res.o

distclean: clean
	rm -f config.h Makefile Makefile.in Makefile.common config.log config.status
	rm -rf autom4te.cache

mrproper: distclean
	rm -f configure config.h boot.tcl.h zipvfs.tcl.h

.PHONY: all clean distclean
<
<
<
<
<
<
<

<





<
<
<
|

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







1

2
3
4
5
6



7
8

























OBJS = kitInit.o main.o pwb.o rechan.o zlib.o winMain.o


all: kit

-include Makefile.common




kit: $(OBJS) $(EXTRA_OBJS) $(EXTRA_KIT_DEPS) $(ARCHS)
	$(CC) $(CPPFLAGS) $(CFLAGS) -o kit $(OBJS) $(EXTRA_OBJS) $(ARCHS) $(LDFLAGS) $(LIBS)


















Modified kitsh/buildsrc/kitsh-0.0/aclocal.m4 from [c050f768b5] to [4ab5fc6711].

164
165
166
167
168
169
170



171
172
173
174
175
176
177
		ARCHS="${ARCHS} ${libfiles}"

		AC_MSG_RESULT([${libfiles}])

		if test "${libfilesnostub}" != ""; then
			if test "${proj}" = "mk4tcl"; then
				AC_DEFINE(KIT_INCLUDES_MK4TCL, [1], [Specify this if you link against mkt4tcl])



				DC_DO_STATIC_LINK_LIBCXX
			fi
			if test "${proj}" = "tk"; then
				DC_DO_TK
				AC_DEFINE(KIT_INCLUDES_TK, [1], [Specify this if we link statically to Tk])
				if test -n "${TK_VERSION}"; then
					AC_DEFINE_UNQUOTED(KIT_TK_VERSION, "${TK_VERSION}${TK_PATCH_LEVEL}", [Specify the version of Tk])







>
>
>







164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
		ARCHS="${ARCHS} ${libfiles}"

		AC_MSG_RESULT([${libfiles}])

		if test "${libfilesnostub}" != ""; then
			if test "${proj}" = "mk4tcl"; then
				AC_DEFINE(KIT_INCLUDES_MK4TCL, [1], [Specify this if you link against mkt4tcl])

				kc_cv_feature_kit_includes_mk4tcl='1'

				DC_DO_STATIC_LINK_LIBCXX
			fi
			if test "${proj}" = "tk"; then
				DC_DO_TK
				AC_DEFINE(KIT_INCLUDES_TK, [1], [Specify this if we link statically to Tk])
				if test -n "${TK_VERSION}"; then
					AC_DEFINE_UNQUOTED(KIT_TK_VERSION, "${TK_VERSION}${TK_PATCH_LEVEL}", [Specify the version of Tk])

Modified kitsh/buildsrc/kitsh-0.0/configure.ac from [c9dbeb54a1] to [a84d1ae23f].

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
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
76
77
78
79
dnl What are we running
AC_INIT(kitsh, 0.0)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_AIX
AC_GNU_SOURCE

dnl Find out if we should build a DLL or an Executable
TARGET="tclkit"

AC_MSG_CHECKING([what target to build])
AC_ARG_ENABLE(kitdll, AC_HELP_STRING([--enable-kitdll], [Enable building KitDLL instead of Tclkit (default: no)]), [
	case "$enableval" in
		yes|kitdll)
			TARGET="kitdll"
			;;

		no)
			true
			;;
		*)

			AC_MSG_RESULT([unknown])

			AC_MSG_ERROR([Invalid option: $enableval])
			;;
	esac


])
AC_MSG_RESULT([$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)!]) ])

if test "$TARGET" = "tclkit"; then
	dnl Figure out how to statically link to libgcc, if needed
	DC_STATIC_LIBGCC
else



	dnl We have KitDLL

	dnl Determine system information
	DC_CHK_OS_INFO

	dnl Determine how to create a shared object
	DC_GET_SHOBJFLAGS

	dnl KitDLL always uses C-VFS
	AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage])

	dnl Define KitDLL usage
	AC_DEFINE([TCLKIT_DLL], [1], [Define if you are using a KitDLL rather than a Tclkit])
fi


dnl Find the appropriate Tcl headers and libraries
DC_DO_TCL

dnl Find archives we need to link to
DC_FIND_TCLKIT_LIBS

dnl Find extra objects we need to link as a part of "kit"
AC_SUBST(EXTRA_OBJS)

dnl Check for Windows Resource Compiler
AC_CHECK_TOOL([RC], [windres], [false])

dnl If we found the resource compiler, add "kit.res.o" to our list of objects to build
dnl (as long as the source for such an object exists)
if ! test "$RC" = "false"; then
	if test -f kit.rc; then
		EXTRA_OBJS="$EXTRA_OBJS kit.res.o"
	fi
fi



dnl Check for Tcl features
SAVE_LIBS="${LIBS}"
LIBS="${ARCHS} ${LIBS}"

dnl Determine if we have "Tcl_SetStartupScript" (8.6.x) or "TclSetStartupScriptPath" (8.4.x)
AC_CHECK_FUNCS(Tcl_SetStartupScript TclSetStartupScriptPath)












>


|
|

<
>
|

<
<
>



<
<
>
>







|


|
>
>
>













<
>















|
|

<
<
>
>







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
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
76
77
78
79
80
81
82
dnl What are we running
AC_INIT(kitsh, 0.0)

dnl Checks for programs.
AC_PROG_CC
AC_PROG_MAKE_SET
AC_PROG_INSTALL
AC_AIX
AC_GNU_SOURCE

dnl Find out if we should build a DLL or an Executable
TARGET="tclkit"
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"

		],
		no, [
			true


		], [
			AC_MSG_RESULT([unknown])

			AC_MSG_ERROR([Invalid option: $enableval])


		]
	)
])
AC_MSG_RESULT([$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 Figure out how to statically link to libgcc, if needed
	DC_STATIC_LIBGCC

	dnl Specify local Appinit function
	AC_DEFINE(DTK_LOCAL_APPINIT, [TclKit_AppInit], [Tclkit appinit function])
], [
	dnl We have KitDLL

	dnl Determine system information
	DC_CHK_OS_INFO

	dnl Determine how to create a shared object
	DC_GET_SHOBJFLAGS

	dnl KitDLL always uses C-VFS
	AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage])

	dnl Define KitDLL usage
	AC_DEFINE([TCLKIT_DLL], [1], [Define if you are using a KitDLL rather than a Tclkit])

])

dnl Find the appropriate Tcl headers and libraries
DC_DO_TCL

dnl Find archives we need to link to
DC_FIND_TCLKIT_LIBS

dnl Find extra objects we need to link as a part of "kit"
AC_SUBST(EXTRA_OBJS)

dnl Check for Windows Resource Compiler
AC_CHECK_TOOL([RC], [windres], [false])

dnl If we found the resource compiler, add "kit.res.o" to our list of objects to build
dnl (as long as the source for such an object exists)
AS_IF([test "$RC" != "false"], [
	AS_IF([test -f kit.rc], [
		EXTRA_OBJS="$EXTRA_OBJS kit.res.o"


	])
])

dnl Check for Tcl features
SAVE_LIBS="${LIBS}"
LIBS="${ARCHS} ${LIBS}"

dnl Determine if we have "Tcl_SetStartupScript" (8.6.x) or "TclSetStartupScriptPath" (8.4.x)
AC_CHECK_FUNCS(Tcl_SetStartupScript TclSetStartupScriptPath)
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
137

138
139
140
141

142
143
144
145
146
147


148
149



150


151




152






153
154
155
156
157









158

159


160




161
162
163
164
165

166
167
168
169
170
171
172
AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [
	CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}"
	CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}"
	LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}"
])

dnl Only needed for Tclkit
if test "$TARGET" = "tclkit"; then
	DC_DO_STATIC_LINK_LIB(zlib, -lz,, [
		DC_DO_STATIC_LINK_LIB(zlib, -lzlib,, [
			AC_SEARCH_LIBS(inflate, z zlib,, [
				AC_MSG_WARN([Couldn't find inflate (normally in zlib)!])
			])
		])
	])
fi


dnl Determine which storage mechanism to use
AC_MSG_CHECKING([which Tclkit Storage mechanism to use])

storage_mech="auto"
AC_ARG_ENABLE(kit-storage, AC_HELP_STRING([--enable-kit-storage={zip|mk4|cvfs}], [Specify storage mechanism to use for built-in VFS (default: auto)]), [
	case "$enableval" in
		mk4)
			storage_mech="mk4"

			AC_DEFINE([KIT_STORAGE_MK4], [1], [Define if you are going to use Metakit4 for kit storage])
			;;
		zip)
			storage_mech="zip"

			AC_DEFINE([KIT_STORAGE_ZIP], [1], [Define if you are going to use ZIP for kit storage])
			;;
		cvfs)
			storage_mech="cvfs"

			AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage])
			;;
		yes)
			# If they just want to enable kit storage, but nothing specifically, do nothing
			storage_mech="auto"
			;;

		auto)
			# Auto is how it works by default
			storage_mech="auto"
			;;

		no)
			# You can't disable kit storage
			AC_MSG_RESULT([fail])
			AC_MSG_ERROR([Kit Storage cannot be disabled])
			;;
		*)


			AC_MSG_RESULT([fail])
			AC_MSG_ERROR([Unknown kit storage type: $enableval])



			;;


	esac




])






AC_MSG_RESULT([$storage_mech])

dnl Verify sanity of storage mechanism
if ! test "$TARGET" = "tclkit"; then
	case "$storage_mech" in









		auto|cvfs)

			true


			;;




		*)
			AC_MSG_ERROR([Only "cvfs" and "auto" are valid storage mechanisms when building KitDLL])
			;;
	esac
fi


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

dnl Produce output
AC_OUTPUT(Makefile Makefile.common)







|







<
>






|
|

|
<
<
|

|
<
<
|

|
<
<
|


<
>
|


<
>
|



<
<
>
>


>
>
>
|
>
>
|
>
>
>
>
|
>
>
>
>
>
>


|
<
|
>
>
>
>
>
>
>
>
>
|
>
|
>
>
|
>
>
>
>
|
<
<
<
<
>







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
137

138
139
140
141
142


143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167

168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188




189
190
191
192
193
194
195
196
AC_ARG_WITH(zlib, AC_HELP_STRING([--with-zlib], [directory containing zlib]), [
	CPPFLAGS="${CPPFLAGS} -I${with_zlib}/include -I${with_zlib}"
	CFLAGS="${CFLAGS} -I${with_zlib}/include -I${with_zlib}"
	LDFLAGS="${LDFLAGS} -L${with_zlib}/lib -L${with_zlib}"
])

dnl Only needed for Tclkit
AS_IF([test "$TARGET" = "tclkit"], [
	DC_DO_STATIC_LINK_LIB(zlib, -lz,, [
		DC_DO_STATIC_LINK_LIB(zlib, -lzlib,, [
			AC_SEARCH_LIBS(inflate, z zlib,, [
				AC_MSG_WARN([Couldn't find inflate (normally in zlib)!])
			])
		])
	])

])

dnl Determine which storage mechanism to use
AC_MSG_CHECKING([which Tclkit Storage mechanism to use])

storage_mech="auto"
AC_ARG_ENABLE(kit-storage, AC_HELP_STRING([--enable-kit-storage={zip|mk4|cvfs}], [Specify storage mechanism to use for built-in VFS (default: auto)]), [
	AS_CASE(["$enableval"],
		mk4, [
			storage_mech="mk4"
		],


		zip, [
			storage_mech="zip"
		],


		cvfs, [
			storage_mech="cvfs"
		],


		yes, [
			# If they just want to enable kit storage, but nothing specifically, do nothing
			storage_mech="auto"

		],
		auto, [
			# Auto is how it works by default
			storage_mech="auto"

		],
		no, [
			# You can't disable kit storage
			AC_MSG_RESULT([fail])
			AC_MSG_ERROR([Kit Storage cannot be disabled])


		],
		[
			AC_MSG_RESULT([fail])
			AC_MSG_ERROR([Unknown kit storage type: $enableval])
		]
	)
])

dnl Explicitly define the storage mechanism
AS_IF([test "$storage_mech" = "auto"], [
	AS_IF([test "$TARGET" = 'tclkit'], [
		AS_IF([test "x$kc_cv_feature_kit_includes_mk4tcl" = 'x1'], [
			storage_mech="mk4"
		], [
			storage_mech="zip"
		])
	], [
		storage_mech="cvfs"
	])
])

dnl Note result
AC_MSG_RESULT([$storage_mech])

dnl Define appropriate macros for the storage mechanism

AS_CASE([$storage_mech],
	mk4, [
		AC_DEFINE([KIT_STORAGE_MK4], [1], [Define if you are going to use Metakit4 for kit storage])
	],
	zip, [
		AC_DEFINE([KIT_STORAGE_ZIP], [1], [Define if you are going to use ZIP for kit storage])

		dnl Add appropriate dependencies
		EXTRA_KIT_DEPS="zipvfs.tcl.h"
	],
	cvfs, [
		AC_DEFINE([KIT_STORAGE_CVFS], [1], [Define if you are going to use C-VFS for kit storage])

		dnl Define that C-VFS should be make [load]-able
		AC_DEFINE([KITDLL_MAKE_LOADABLE], [1], [Specify that the C-VFS should be able to be loaded])

		dnl Add appropriate dependencies
		EXTRA_KIT_DEPS="vfs_kitdll.tcl.h"
	]
)





AC_SUBST(EXTRA_KIT_DEPS)

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

dnl Produce output
AC_OUTPUT(Makefile Makefile.common)

Modified kitsh/buildsrc/kitsh-0.0/installvfs.tcl from [d2ae77312e] to [2fb8a7d1f7].

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
42
43
44
45
46
47
set kitfile [lindex $argv 0]
set vfsdir [lindex $argv 1]
if {[lindex $argv 2] != ""} {
	set opt_compression [lindex $argv 2]
}

# Determine what storage mechanism is being used
## This logic must be duplicated from "kitInit.c"
set fd [open Makefile r]
set data [read $fd]
close $fd

if {[string match "*KIT_STORAGE_ZIP*" $data]} {
	set tclKitStorage zip
}
if {[string match "*KIT_STORAGE_MK4*" $data]} {
	set tclKitStorage mk4
}
if {[string match "*KIT_STORAGE_CVFS*" $data]} {
	set tclKitStorage cvfs
}

if {![info exists tclKitStorage]} {
	if {[string match "*KIT_INCLUDES_MK4TCL*" $data]} {
		set tclKitStorage mk4
	} else {
		set tclKitStorage zip
	}
}

# Define procedures
proc copy_file {srcfile destfile} {
	switch -glob -- $srcfile {
		"*.tcl" - "*.txt" {
			set ifd [open $srcfile r]
			set ofd [open $destfile w]








<














<
<
<
<
<
<
<
<







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
set kitfile [lindex $argv 0]
set vfsdir [lindex $argv 1]
if {[lindex $argv 2] != ""} {
	set opt_compression [lindex $argv 2]
}

# Determine what storage mechanism is being used

set fd [open Makefile r]
set data [read $fd]
close $fd

if {[string match "*KIT_STORAGE_ZIP*" $data]} {
	set tclKitStorage zip
}
if {[string match "*KIT_STORAGE_MK4*" $data]} {
	set tclKitStorage mk4
}
if {[string match "*KIT_STORAGE_CVFS*" $data]} {
	set tclKitStorage cvfs
}









# Define procedures
proc copy_file {srcfile destfile} {
	switch -glob -- $srcfile {
		"*.tcl" - "*.txt" {
			set ifd [open $srcfile r]
			set ofd [open $destfile w]

116
117
118
119
120
121
122
123


124

		if {[catch {
			close $zipfd
		} err]} {
			puts stderr "Error while updating executable: $err"

			exit 1
		}
	}


}









>
>
|
>
107
108
109
110
111
112
113
114
115
116
117
118
		if {[catch {
			close $zipfd
		} err]} {
			puts stderr "Error while updating executable: $err"

			exit 1
		}
	}
	"cvfs" {
		# No-op
	}
}

Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [dd6f45df03] to [ae720616f1].

57
58
59
60
61
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
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
#  define KIT_INCLUDES_PWB 1
#endif
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
#  define KIT_INCLUDES_ZLIB 1
#endif

/* Determine which type of storage to use -- MK4, ZIP, or CVFS */
#if defined(KIT_STORAGE_MK4) && defined(KIT_STORAGE_ZIP)
#  undef KIT_STORAGE_ZIP
#endif
#if defined(KIT_STORAGE_MK4) && defined(KIT_STORAGE_CVFS)
#  ifdef TCLKIT_DLL
#    undef KIT_STORAGE_MK4
#  else
#    undef KIT_STORAGE_CVFS
#  endif
#endif
#if !defined(KIT_STORAGE_MK4) && !defined(KIT_STORAGE_ZIP) && !defined(KIT_STORAGE_CVFS)
#  ifdef TCLKIT_DLL
#    define KIT_STORAGE_CVFS 1
#  else
#    ifdef KIT_INCLUDES_MK4TCL
#      define KIT_STORAGE_MK4 1
#    else
#      define KIT_STORAGE_ZIP 1
#    endif
#  endif
#endif

#ifdef KIT_INCLUDES_ITCL
Tcl_AppInitProc	Itcl_Init;
#endif
#ifdef KIT_INCLUDES_MK4TCL
Tcl_AppInitProc	Mk4tcl_Init;
#endif
Tcl_AppInitProc Vfs_Init, Rechan_Init;







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







57
58
59
60
61
62
63























64
65
66
67
68
69
70
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 85
#  define KIT_INCLUDES_PWB 1
#endif
#if 10 * TCL_MAJOR_VERSION + TCL_MINOR_VERSION < 86
#  define KIT_INCLUDES_ZLIB 1
#endif
























#ifdef KIT_INCLUDES_ITCL
Tcl_AppInitProc	Itcl_Init;
#endif
#ifdef KIT_INCLUDES_MK4TCL
Tcl_AppInitProc	Mk4tcl_Init;
#endif
Tcl_AppInitProc Vfs_Init, Rechan_Init;