Check-in [df02b7cfd1]
Overview
Comment:Merge updates from trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | winFixes
Files: files | file ages | folders
SHA1: df02b7cfd1f7631a3894814488de6d37d5e5071a
User & Date: mistachkin on 2014-08-28 18:27:31
Other Links: branch diff | manifest | tags
Context
2014-08-28
20:06
Remove obsolete differences that are no longer needed. check-in: b5def69863 user: mistachkin tags: winFixes
18:27
Merge updates from trunk. check-in: df02b7cfd1 user: mistachkin tags: winFixes
18:13
Updated to clear DESTDIR as well, since it also breaks the build check-in: 90ea47d409 user: rkeene tags: trunk
2013-11-05
10:15
More progress on getting new version of zlib working. check-in: 07ceeb4833 user: mistachkin tags: winFixes
Changes

Added .fossil-settings/crnl-glob version [f35e2eb18c].





>
>
1
2
tcc/patches/all/tcltcc-0.4-fixloading.diff
tcc/patches/all/tcltcc-0.4-setincpath.diff

Added .fossil-settings/ignore-glob version [5261fbbc36].





















































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
build/test/kits
build/test/kits/*
build/web/queue
build/web/kitcreator.cgi
build/web/kitcreator.kit
itcl/build
itcl/build/*
itcl/build.log
itcl/inst
itcl/inst/*
itcl/out
itcl/out/*
itcl/src
itcl/src/*
kitsh/build
kitsh/build/*
kitsh/build.log
kitsh/buildsrc/kitsh-0.0/Makefile
kitsh/buildsrc/kitsh-0.0/autom4te.cache
kitsh/buildsrc/kitsh-0.0/autom4te.cache/*
kitsh/buildsrc/kitsh-0.0/boot.tcl.h
kitsh/buildsrc/kitsh-0.0/config.h
kitsh/buildsrc/kitsh-0.0/config.h.in
kitsh/buildsrc/kitsh-0.0/config.log
kitsh/buildsrc/kitsh-0.0/config.status
kitsh/buildsrc/kitsh-0.0/configure
kitsh/buildsrc/kitsh-0.0/kit
kitsh/buildsrc/kitsh-0.0/zipvfs.tcl.h
kitsh/buildsrc/kitsh-0.0/cvfs.tcl.h
kitsh/inst
kitsh/inst/*
kitsh/out
kitsh/out/*
mk4tcl/build
mk4tcl/build/*
mk4tcl/build.log
mk4tcl/inst
mk4tcl/inst/*
mk4tcl/out
mk4tcl/out/*
mk4tcl/src
mk4tcl/src/*
tcl/build
tcl/build/*
tcl/build.log
tcl/inst
tcl/inst/*
tcl/out
tcl/out/*
tcl/src
tcl/src/*
tclkit-*
tclkit-*/*
tclvfs/build
tclvfs/build/*
tclvfs/build.log
tclvfs/inst
tclvfs/inst/*
tclvfs/out
tclvfs/out/*
tclvfs/src
tclvfs/src/*
thread/build
thread/build/*
thread/build.log
thread/inst
thread/inst/*
thread/out
thread/out/*
thread/src
thread/src/*
tk/build
tk/build/*
tk/build.log
tk/inst
tk/inst/*
tk/out
tk/out/*
tk/src
tk/src/*
zlib/build
zlib/build/*
zlib/build.log
zlib/inst
zlib/inst/*
zlib/out
zlib/out/*
zlib/src
zlib/src/*
tcc4tcl/build
tcc4tcl/build/*
tcc4tcl/build.log
tcc4tcl/inst
tcc4tcl/inst/*
tcc4tcl/out
tcc4tcl/out/*
tcc4tcl/src
tcc4tcl/src/*
tls/build
tls/build/*
tls/build.log
tls/inst
tls/inst/*
tls/out
tls/out/*
tls/src
tls/src/*
kitdll/buildsrc/kitdll-0.0/starpack.vfs
kitdll/buildsrc/kitdll-0.0/starpack.vfs/*
kitdll/buildsrc/kitdll-0.0/test
kitdll/buildsrc/kitdll-0.0/configure
kitdll/buildsrc/kitdll-0.0/libtcl*.so
kitdll/buildsrc/kitdll-0.0/Makefile
kitdll/buildsrc/kitdll-0.0/*.o
kitdll/buildsrc/kitdll-0.0/config.log
kitdll/buildsrc/kitdll-0.0/config.status
kitdll/buildsrc/kitdll-0.0/vfs_kitdll_data_tcl.c
kitdll/buildsrc/kitdll-0.0/vfs_kitdll.tcl.h
kitdll/build/kitdll-*
kitdll/build/kitdll-*/*
kitdll/build.log
libtclkit-*.*

Modified README from [4484aed13d] to [1a63b72891].

137
138
139
140
141
142
143






























144
145
146
147
148
149
150
		packages from Tcl build.  This excludes the following packages:
			tcltest

		Additionally, any bundled packages (in the "pkgs" directory)
		are excluded.  This typically includes (as of Tcl 8.6):
			itcl thread































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.

--------------------







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







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
		packages from Tcl build.  This excludes the following packages:
			tcltest

		Additionally, any bundled packages (in the "pkgs" directory)
		are excluded.  This typically includes (as of Tcl 8.6):
			itcl thread

Cross compiling Environment Variables:

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

	2. CXX
		C++ compiler.  Required if you want to use mk4tcl. e.g. i686-pc-mingw32-g++
		If not required, you can set it to the string "false"

	3. AR
		Library creator e.g. i686-pc-mingw32-ar

	4. RANLIB
		Library post processing executable e.g. i686-pc-mingw32-ranlib

	5. STRIP
		Executable name to strip binaries e.g. i686-pc-mingw32-strip

	6. NM
		Executable used to dump names from the objects  e.g. i686-pc-mingw32-nm

	7. CC_FOR_BUILD, HOST_CC 
		Set this to the name of compiler on the host on which
		the cross compilation is being run.

On Windows we also need this:

	1. RC
		Resource compiler : e.g. i686-pc-mingw32-windres

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.

--------------------

Deleted build/fake-bin/uname version [482a7c7be3].

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
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
#! /usr/bin/env bash

if [ "$1" == "--fake" ]; then
	echo "true"

	exit 0
fi

# Some systems do not compile well with this fake uname in place
# provide the real uname for them.
case "${CROSS}" in
	mipsel-unknown-linux-uclibc)
		unset CROSS
		;;
esac

if [ -z "${CROSS}" ]; then
	# If not cross compiling, revert to system uname
	while [ "$(uname --fake 2>/dev/null)" == "true" -a -n "${PATH}" ]; do
		PATH="$(echo "${PATH}" | /usr/bin/sed 's@^[^:]*$@@;s@^[^:]*:@@')"

		export PATH
	done

	if [ -z "${PATH}" ]; then
		exit 1
	fi

	exec uname "$@"
fi

CROSS="$(echo "${CROSS}" | sed 's@-*$@@')"

# Determine release information
case "${CROSS}" in
	*-hpux11*)
		sysname="HP-UX"
		sysrelease="$(echo "${CROSS}" | sed 's@^.*-hpux@@')"
		;;
	*-solaris2*)
		sysname="SunOS"
		sysrelease="$(echo "${CROSS}" | sed 's@^.*-solaris@@;s@^2@5@')"
		;;
	*-linux*)
		sysname="Linux"
		sysrelease="2.6.5"
		;;
	*-netbsd*)
		sysname="NetBSD"
		sysrelease="$(echo "${CROSS}" | sed 's@^.*-netbsd@@;s@$@.0@')"
		;;
	*-freebsd*)
		sysname="FreeBSD"
		sysrelease="$(echo "${CROSS}" | sed 's@^.*-freebsd@@;s@$@.0-RELEASE@')"
		;;
esac

# Determine machine information
case "${CROSS}" in
	hppa64-*-hpux*)
		sysmachine="9000/859"
		;;
	i386-*-solaris*)
		sysmachine="i86pc"
		;;
	sparc-*-solaris*)
		sysmachine="sun4u"
		;;
	x86_64-*)
		sysmachine="x86_64"
		;;
	i?86-*)
		sysmachine="i686"
		;;
	ia64-*)
		sysmachine="ia64"
		;;
	arm-*|armel-*|armeb-*)
		sysmachine="armv7l"
		;;
	mipsel-*|mipseb-*)
		sysmachine="mips"
		;;
esac

for arg in $(echo "$@" | sed 's@.@ & @g'); do
	case "${arg}" in
		-)
			continue
			;;
		r)
			retval="${retval} ${sysrelease}"
			;;
		s)
			retval="${retval} ${sysname}"
			;;
		m)
			retval="${retval} ${sysmachine}"
			;;
		p)
			# XXX
			retval="${retval} ${syscpu}"
			;;
		n)
			retval="${retval} $(hostname)"
			;;
		a)
			retval="${sysname} $(hostname) ${sysrelease} ${sysversion} ${sysmachine} ${syscpu}"
			;;
	esac
done

echo "${retval}" | sed 's@^  *@@;s@  *$@@'
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<


































































































































































































































Modified build/make-kit-android-arm from [0fc5e40e1c] to [fdf5250c75].

1
2
3
4
5
6
#! /bin/sh

CROSS="arm-android9-linux-androideabi"
export CROSS

./build/make-kit-crosscompile "$@"





|
1
2
3
4
5
6
#! /bin/sh

CROSS="arm-android9-linux-androideabi"
export CROSS

./build/make-kit-crosscompile "$@" LDFLAGS=-static-libgcc

Modified build/make-kit-crosscompile from [bf7d466ffa] to [b5df8646bf].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /usr/bin/env bash

if [ -z "${CROSS}" ]; then
	echo 'Error: Environment variable CROSS is empty/unset.  Aborting.' >&2

	exit 1
fi

CCROOT="${HOME}/root/cross-compilers/${CROSS}"
CCROOTBIN="${CCROOT}/bin"

PATH="$(pwd)/build/fake-bin:${PATH}:${CCROOTBIN}"
AR="${CCROOTBIN}/${CROSS}-ar"
CC="${CCROOTBIN}/${CROSS}-gcc ${CC_ADD}"
CXX="${CCROOTBIN}/${CROSS}-g++ ${CC_ADD}"
RANLIB="${CCROOTBIN}/${CROSS}-ranlib"
if [ -z "${STRIP}" ]; then
	STRIP="${CCROOTBIN}/${CROSS}-strip"
fi











|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#! /usr/bin/env bash

if [ -z "${CROSS}" ]; then
	echo 'Error: Environment variable CROSS is empty/unset.  Aborting.' >&2

	exit 1
fi

CCROOT="${HOME}/root/cross-compilers/${CROSS}"
CCROOTBIN="${CCROOT}/bin"

PATH="${PATH}:${CCROOTBIN}"
AR="${CCROOTBIN}/${CROSS}-ar"
CC="${CCROOTBIN}/${CROSS}-gcc ${CC_ADD}"
CXX="${CCROOTBIN}/${CROSS}-g++ ${CC_ADD}"
RANLIB="${CCROOTBIN}/${CROSS}-ranlib"
if [ -z "${STRIP}" ]; then
	STRIP="${CCROOTBIN}/${CROSS}-strip"
fi

Modified build/make-kit-linux-amd64 from [8d7c7de31e] to [0524330c84].

1
2
3
4
5
6
7
#! /bin/sh

CROSS="x86_64-slackware-linux"
CC_ADD="-m64"
export CROSS CC_ADD

./build/make-kit-crosscompile "$@" --enable-64bit


|




1
2
3
4
5
6
7
#! /bin/sh

CROSS="x86_64-redhat5-linux"
CC_ADD="-m64"
export CROSS CC_ADD

./build/make-kit-crosscompile "$@" --enable-64bit

Added build/make-kit-linux-arm version [3eb7c634cf].













>
>
>
>
>
>
1
2
3
4
5
6
#! /bin/sh

CROSS="arm-slackware-linux-gnueabi"
export CROSS

./build/make-kit-crosscompile "$@"

Modified build/make-kit-linux-i386 from [c72ea56080] to [9b178664a5].

1
2
3

4
5
6
#! /bin/sh

CROSS="i486-slackware-linux"

export CROSS

./build/make-kit-crosscompile "$@"


|
>
|


1
2
3
4
5
6
7
#! /bin/sh

CROSS="x86_64-redhat5-linux"
CC_ADD='-m32'
export CROSS CC_ADD

./build/make-kit-crosscompile "$@"

Modified build/make-kit-linux-mipsel from [819d882cb2] to [285ebb90fe].

1
2
3



4
5
6
#! /bin/sh

CROSS="mipsel-unknown-linux-uclibc"



export CROSS

./build/make-kit-crosscompile "$@"


|
>
>
>
|


1
2
3
4
5
6
7
8
9
#! /bin/sh

CROSS="mips-unknown-linux-musl"
if ! echo " ${KITCREATOR_PKGS} " | grep ' kitdll ' >/dev/null; then
	KC_KITSH_LDFLAGS="${KC_KITSH_FLAGS} -static"
fi
export CROSS KC_KITSH_LDFLAGS

./build/make-kit-crosscompile "$@"

Modified build/make-minkit-static from [5ddd33e2a4] to [f5218669e8].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#! /bin/sh

# Set C compiler to diet libc
CC='diet gcc'
export CC

cat << \__EOF__ > tcl/patchscripts/dietlibc.sh
sed 's@^# *include *<string.h>$@&@;T s;p;s@string.h@strings.h@;:s' generic/tclInt.h > generic/tclInt.h.new && cat generic/tclInt.h.new > generic/tclInt.h
rm -f generic/tclInt.h.new
__EOF__

./build/make-minkit "$@" --disable-load --disable-threads

rm -f tcl/patchscripts/dietlibc.sh

exit 0



|


<
<
<
<
<


<
<

1
2
3
4
5
6





7
8


9
#! /bin/sh

# Set C compiler to diet libc
CC='x86_64-slackware-linux-musl-gcc'
export CC






./build/make-minkit "$@" --disable-load --disable-threads



exit 0

Modified build/makearch.info from [204d40c493] to [06f247e1b9].

12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# If set to "auto" it will be maintained in a file called .version
# in the source directory and the revision will be incremented
# each time a "makearch" is done.
#
# If @@SVNLCR@@ is used anywhere in this version number, it will be
# replaced with the highest last-changed-rev from the output of
#   svn info -R    (or 0)
VERS="0.7.0"

# Space sperated list of documents, if they exist, they will be
# prefixed with the contents of the DOC_HDR file and substitution
# will occur:
#     @@UTIL@@ becomes the utility name ${UTIL}
#     @@VERS@@ becomes the utility version
#     @@DATE@@ becomes the current date







|







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# If set to "auto" it will be maintained in a file called .version
# in the source directory and the revision will be incremented
# each time a "makearch" is done.
#
# If @@SVNLCR@@ is used anywhere in this version number, it will be
# replaced with the highest last-changed-rev from the output of
#   svn info -R    (or 0)
VERS="0.9.0"

# Space sperated list of documents, if they exist, they will be
# prefixed with the contents of the DOC_HDR file and substitution
# will occur:
#     @@UTIL@@ becomes the utility name ${UTIL}
#     @@VERS@@ becomes the utility version
#     @@DATE@@ becomes the current date

Modified build/test/test from [2dc0e708ac] to [af8be2e90b].

1
2
3
4
5
6
7
8
9
10
#! /bin/bash

VERSIONS="8.5.15 8.6.1 cvs_HEAD"

# Find the base directory
for x in 1 2 3 4 __fail__; do
	if [ "${x}" = "__fail__" ]; then
		echo 'Unable to find KitCreator, aborting.' >&2

		exit 1


|







1
2
3
4
5
6
7
8
9
10
#! /bin/bash

VERSIONS="8.5.15 8.6.2 cvs_HEAD"

# Find the base directory
for x in 1 2 3 4 __fail__; do
	if [ "${x}" = "__fail__" ]; then
		echo 'Unable to find KitCreator, aborting.' >&2

		exit 1
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
XVFB_PID="$(
	Xvfb :31 -screen 0 800x600x24 -nolisten tcp >/dev/null 2>/dev/null &
	echo "$!"
)"
DISPLAY=:31
export DISPLAY

if [ "${BIGBUILD}" = "1" ]; then
	kits="$(echo normal{,-zip,-nomk4}{,-threaded}{,-statictk,-notk} normal{,-threaded}{,-notk}{,-nomk4}{,-debug}-kitdll win32-i586{,-zip,-nomk4}{,-threaded}{,-notk} win32-i586{,-threaded}{,-notk}{,-nomk4}-kitdll min{,-static} {linux-mipsel-min}{,-debug}{,-kitdll} {linux-i386,solaris-i386,solaris-amd64,solaris-sparc,solaris-sparc64,freebsd-amd64,netbsd-amd64}{,-zip,-nomk4}{,-threaded}{,-statictk,-notk}{,debug} {solaris-i386,solaris-amd64,solaris-sparc,solaris-sparc64,freebsd-amd64,netbsd-amd64}{,-threaded}{,-notk}{,-nomk4}{,debug}-kitdll netbsd-i386{,-zip,-nomk4}{,-threaded}{,debug}-notk netbsd-i386{,-threaded}{,-nomk4}{,debug}-notk-kitdll android-arm-notk{,-debug} andoid-arm-notk{,-debug}-kitdll)"
else
	kits="normal normal-zip normal-threaded normal-threaded-zip normal-statictk normal-notk normal-threaded-notk normal-threaded-zip-notk normal-nomk4 normal-debug min min-static normal-kitdll normal-threaded-kitdll normal-notk-kitdll normal-nomk4-kitdll normal-nomk4-notk-kitdll normal-threaded-nomk4-kitdll normal-threaded-notk-nomk4-kitdll normal-debug-kitdll min-kitdll win32-i586 win32-i586-zip win32-i586-threaded win32-i586-threaded-zip win32-i586-notk win32-i586-threaded-notk win32-i586-nomk4 win32-i586-kitdll win32-i586-threaded-kitdll win32-i586-notk-kitdll win32-i586-nomk4-kitdll win32-i586-nomk4-notk-kitdll win32-i586-threaded-nomk4-kitdll win32-i586-threaded-notk-nomk4-kitdll win64-amd64 win64-amd64-zip win64-amd64-threaded win64-amd64-threaded-zip win64-amd64-notk win64-amd64-threaded-notk win64-amd64-nomk4 win64-amd64-kitdll win64-amd64-threaded-kitdll win64-amd64-notk-kitdll win64-amd64-nomk4-kitdll win64-amd64-nomk4-notk-kitdll win64-amd64-threaded-nomk4-kitdll win64-amd64-threaded-notk-nomk4-kitdll linux-mipsel-notk linux-mipsel-notk-kitdll linux-i386 linux-i386-debug linux-i386-kitdll linux-i386-debug-kitdll linux-i386-notk linux-i386-notk-debug linux-i386-notk-kitdll linux-i386-notk-debug-kitdll solaris-i386 solaris-i386-debug solaris-i386-kitdll solaris-i386-debug-kitdll solaris-amd64 solaris-amd64-debug solaris-amd64-kitdll solaris-amd64-debug-kitdll solaris-sparc solaris-sparc-debug solaris-sparc-kitdll solaris-sparc-debug-kitdll solaris-sparc64 solaris-sparc64-debug solaris-sparc64-kitdll solaris-sparc64-debug-kitdll freebsd-amd64 freebsd-amd64-debug freebsd-amd64-kitdll freebsd-amd64-debug-kitdll netbsd-i386-notk netbsd-i386-notk-debug netbsd-i386-notk-kitdll netbsd-i386-notk-debug-kitdll netbsd-amd64 netbsd-amd64-debug netbsd-amd64-kitdll netbsd-amd64-debug-kitdll android-arm-notk android-arm-notk-debug android-arm-notk-kitdll android-arm-notk-debug-kitdll"
fi

failed=""
for kit in $kits; do
	kitcreator="./kitcreator"
	args=""
	runnable="1"







|
|

|







65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
XVFB_PID="$(
	Xvfb :31 -screen 0 800x600x24 -nolisten tcp >/dev/null 2>/dev/null &
	echo "$!"
)"
DISPLAY=:31
export DISPLAY

if [ -z "${KC_TEST_KITS}" ]; then
	kits="linux-amd64 linux-amd64-zip linux-amd64-threaded linux-amd64-threaded-zip linux-amd64-statictk linux-amd64-notk linux-amd64-threaded-notk linux-amd64-threaded-zip-notk linux-amd64-nomk4 linux-amd64-debug min min-static linux-amd64-kitdll linux-amd64-threaded-kitdll linux-amd64-notk-kitdll linux-amd64-nomk4-kitdll linux-amd64-nomk4-notk-kitdll linux-amd64-threaded-nomk4-kitdll linux-amd64-threaded-notk-nomk4-kitdll linux-amd64-debug-kitdll min-kitdll win32-i586 win32-i586-zip win32-i586-threaded win32-i586-threaded-zip win32-i586-notk win32-i586-threaded-notk win32-i586-nomk4 win32-i586-kitdll win32-i586-threaded-kitdll win32-i586-notk-kitdll win32-i586-nomk4-kitdll win32-i586-nomk4-notk-kitdll win32-i586-threaded-nomk4-kitdll win32-i586-threaded-notk-nomk4-kitdll win64-amd64 win64-amd64-zip win64-amd64-threaded win64-amd64-threaded-zip win64-amd64-notk win64-amd64-threaded-notk win64-amd64-nomk4 win64-amd64-kitdll win64-amd64-threaded-kitdll win64-amd64-notk-kitdll win64-amd64-nomk4-kitdll win64-amd64-nomk4-notk-kitdll win64-amd64-threaded-nomk4-kitdll win64-amd64-threaded-notk-nomk4-kitdll linux-mipsel-notk linux-mipsel-notk-kitdll linux-i386 linux-i386-debug linux-i386-kitdll linux-i386-debug-kitdll linux-i386-notk linux-i386-notk-debug linux-i386-notk-kitdll linux-i386-notk-debug-kitdll solaris-i386 solaris-i386-debug solaris-i386-kitdll solaris-i386-debug-kitdll solaris-amd64 solaris-amd64-debug solaris-amd64-kitdll solaris-amd64-debug-kitdll solaris-sparc solaris-sparc-debug solaris-sparc-kitdll solaris-sparc-debug-kitdll solaris-sparc64 solaris-sparc64-debug solaris-sparc64-kitdll solaris-sparc64-debug-kitdll freebsd-amd64 freebsd-amd64-debug freebsd-amd64-kitdll freebsd-amd64-debug-kitdll netbsd-i386-notk netbsd-i386-notk-debug netbsd-i386-notk-kitdll netbsd-i386-notk-debug-kitdll netbsd-amd64 netbsd-amd64-debug netbsd-amd64-kitdll netbsd-amd64-debug-kitdll android-arm-notk android-arm-notk-debug android-arm-notk-kitdll android-arm-notk-debug-kitdll"
else
	kits="${KC_TEST_KITS}"
fi

failed=""
for kit in $kits; do
	kitcreator="./kitcreator"
	args=""
	runnable="1"
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
		win32|win32-*)
			kitcreator="./build/make-kit-win32"
			xcompile="1"
			runnable="1"
			kitruncmd="wine"
			;;
		win64|win64-*)
			kitcreator="./build/make-kit-win32"
			xcompile="1"
			runnable="1"
			kitruncmd="wine64"
			;;
		linux-mipsel-min|linux-mipsel-min-kitdll)
			kitcreator="./build/make-kit-linux-mipsel"
			runnable="0"
			xcompile="1"
			notk="1"
			iszip="1"





			;;
		linux-i386|linux-i386-*)
			kitcreator="./build/make-kit-linux-i386"
			xcompile="1"

			;;
		android-arm|android-arm-*|\
		linux-mipsel|linux-mipsel-*|\
		linux-amd64|linux-amd64-*|\
		solaris-i386|solaris-i386-*|\
		solaris-amd64|solaris-amd64-*|\
		solaris-sparc|solaris-sparc-*|\
		solaris-sparc64|solaris-sparc64-*|\
		freebsd-amd64|freebsd-amd64-*|\
		netbsd-i386|netbsd-i386-*|\
		netbsd-amd64|netbsd-amd64-*|\







|










>
>
>
>
>




>



<







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
		win32|win32-*)
			kitcreator="./build/make-kit-win32"
			xcompile="1"
			runnable="1"
			kitruncmd="wine"
			;;
		win64|win64-*)
			kitcreator="./build/make-kit-win64"
			xcompile="1"
			runnable="1"
			kitruncmd="wine64"
			;;
		linux-mipsel-min|linux-mipsel-min-kitdll)
			kitcreator="./build/make-kit-linux-mipsel"
			runnable="0"
			xcompile="1"
			notk="1"
			iszip="1"
			;;
		linux-amd64|linux-amd64-*)
			kitcreator="./build/make-kit-linux-amd64"
			xcompile="0"
			runnable="1"
			;;
		linux-i386|linux-i386-*)
			kitcreator="./build/make-kit-linux-i386"
			xcompile="1"
			runnable="0"
			;;
		android-arm|android-arm-*|\
		linux-mipsel|linux-mipsel-*|\

		solaris-i386|solaris-i386-*|\
		solaris-amd64|solaris-amd64-*|\
		solaris-sparc|solaris-sparc-*|\
		solaris-sparc64|solaris-sparc64-*|\
		freebsd-amd64|freebsd-amd64-*|\
		netbsd-i386|netbsd-i386-*|\
		netbsd-amd64|netbsd-amd64-*|\
217
218
219
220
221
222
223
224

225
226
227


228
229
230
231
232
233
234
	if [ "${kitdll}" = "1" ]; then
		# Currently no KitDLL uses Zip
		iszip="0"
	fi

	for version in ${VERSIONS}; do
		# Work around changes in default behaviour
		if [ "${version}" = "cvs_HEAD" ]; then

			kit="$(echo "${kit}" | sed 's@-threaded@-unthreaded@')"
			args="$(echo "${args}" | sed 's@ --enable-threads@ --disable-threads@')"
		fi



		# Create Tclkit
		if [ "${kitdll}" = "1" ]; then
			createdkit="libtclkit*.dll libtclkit*.*"
			outputname="${TESTDIR}/kits/libtclkit-${version}-${kit}"
			failoutputname="${TESTDIR}/kits/failed/libtclkit-${version}-${kit}"
			sdk="libtclkit-sdk-${version}.tar.gz"







|
>
|
|
<
>
>







222
223
224
225
226
227
228
229
230
231
232

233
234
235
236
237
238
239
240
241
	if [ "${kitdll}" = "1" ]; then
		# Currently no KitDLL uses Zip
		iszip="0"
	fi

	for version in ${VERSIONS}; do
		# Work around changes in default behaviour
		case "${version}" in
			8.6.*|cvs_HEAD)
				kit="$(echo "${kit}" | sed 's@-threaded@-unthreaded@')"
				args="$(echo "${args}" | sed 's@ --enable-threads@ --disable-threads@')"

				;;
		esac

		# Create Tclkit
		if [ "${kitdll}" = "1" ]; then
			createdkit="libtclkit*.dll libtclkit*.*"
			outputname="${TESTDIR}/kits/libtclkit-${version}-${kit}"
			failoutputname="${TESTDIR}/kits/failed/libtclkit-${version}-${kit}"
			sdk="libtclkit-sdk-${version}.tar.gz"

Modified build/web/Makefile from [a7224e283a] to [ee429274c4].

1
2


3
4
5
6
7
8
9






10
11
12
13
14
15
STARKIT2EXE = ../../../starkit2exe/starkit2exe
RIVET2STARKIT = ../../../rivet/bin/rivet2starkit



kitcreator.cgi: kitcreator.kit
	$(STARKIT2EXE) kitcreator.kit kitcreator.cgi

kitcreator.kit: kitcreator.vfs kitcreator.vfs/index.rvt
	$(RIVET2STARKIT) tclkit kitcreator.kit kitcreator.vfs







clean:
	rm -f kitcreator.kit kitcreator.cgi

distclean: clean

.PHONY: clean distclean


>
>







>
>
>
>
>
>





|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
STARKIT2EXE = ../../../starkit2exe/starkit2exe
RIVET2STARKIT = ../../../rivet/bin/rivet2starkit
WEBDIR = /web/customers/kitcreator.rkeene.org
WEBKITSDIR = $(WEBDIR)/kits

kitcreator.cgi: kitcreator.kit
	$(STARKIT2EXE) kitcreator.kit kitcreator.cgi

kitcreator.kit: kitcreator.vfs kitcreator.vfs/index.rvt
	$(RIVET2STARKIT) tclkit kitcreator.kit kitcreator.vfs

install: kitcreator.cgi building.cgi
	mkdir -p '$(WEBDIR)' '$(WEBKITSDIR)'
	cp kitcreator.cgi '$(WEBDIR)/'
	cp building.cgi '$(WEBKITSDIR)/'
	echo -n > '${WEBKITSDIR}/index.html'

clean:
	rm -f kitcreator.kit kitcreator.cgi

distclean: clean

.PHONY: clean distclean install

Added build/web/building.cgi version [b893b1086f].









































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
#! /usr/bin/env tclsh

set outdir "/web/customers/kitcreator.rkeene.org/kits"
set key ""
if {[info exists ::env(PATH_INFO)]} {
	set key [lindex [split $::env(PATH_INFO) "/"] 1]
}

set status "Unknown"
set terminal 0
if {![regexp {^[0-9a-f]+$} $key]} {
	set status "Invalid Key"

	unset key
}

if {[info exists key]} {
	set workdir [file join $outdir $key]
}

if {[info exists workdir]} {
	if {[file exists $workdir]} {
		set fd [open [file join $workdir buildinfo]]
		set buildinfo_list [gets $fd]
		close $fd
		array set buildinfo $buildinfo_list
		set filename $buildinfo(filename)

		set outfile [file join $workdir $filename]
		set logfile "${outfile}.log"
	} else {
		set status "Queued"
	}
}

if {[info exists buildinfo]} {
	set description "Tcl $buildinfo(tcl_version)"
	append description ", KitCreator $buildinfo(kitcreator_version)"
	append description ", Platform $buildinfo(platform)"

	foreach {option value} $buildinfo(options) {
		switch -- $option {
			"kitdll" {
				if {$value} {
					append description ", Built as a Library"
				}
			}
			"threaded" {
				if {$value} {
					append description ", Threaded"
				} else {
					append description ", Unthreaded"
				}
			}
			"debug" {
				if {$value} {
					append description ", With Symbols"
				}
			}
			"storage" {
				switch -- $value {
					"mk4" {
						append description ", Metakit-based"
					}
					"zip" {
						append description ", Zip-kit"
					}
					"cvfs" {
						append description ", Static Storage"
					}
				}
			}
		}
	}

	if {[llength $buildinfo(packages)] > 0} {
		append description ", Packages: [join $buildinfo(packages) {, }]"
	} else {
		append description ", No packages"
	}
}

if {[info exists outfile]} {
	if {[file exists $outfile]} {
		set status "Complete"
		set terminal 1

		set url "http://kitcreator.rkeene.org/kits/$key/$filename"
	} elseif {[file exists "${outfile}.buildfail"]} {
		set status "Failed"
		set terminal 1
	} else {
		set status "Building"
	}
}

puts "Content-Type: text/html"
if {[info exists url]} {
	# Use a refresh here instead of a "Location" so that
	# the client can see the page
	puts "Refresh: 0;url=$url"
} else {
	if {!$terminal} {
		puts "Refresh: 30;url=."
	}
}
puts ""
puts "<html>"
puts "\t<head>"
puts "\t\t<title>KitCreator, Web Interface</title>"
puts "\t</head>"
puts "\t<body>"
puts "\t\t<h1>KitCreator Web Interface</h1>"
puts "\t\t<p><b>Status:</b> $status"
if {[info exists url]} {
	puts "\t\t<p><b>URL:</b> <a href=\"$url\">$url</a>"
}
if {[info exists description]} {
	puts "\t\t<p><b>Description:</b> $description"
}
if {[info exists logfile]} {
	catch {
		set fd [open $logfile]
		set logdata [read $fd]
		close $fd


		puts "\t\t<p><b>Log:</b><pre>\n$logdata</pre>"
	}
}
puts "\t</body>"
puts "</html>"

Modified build/web/kitcreator.vfs/index.rvt from [aaeb907791] to [8e0117b024].

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
<?




	set sourcedir "/web/rkeene/devel/kitcreator/all"



	foreach file [glob -tails -nocomplain -directory $sourcedir "kitcreator-*.tar.gz"] {
		regexp {^kitcreator-(.*).tar.gz$} $file -> vers
		set kitcreator_versions($vers) $vers
	}
	set kitcreator_version_selected [lindex [lsort -dictionary [array names kitcreator_versions]] end]

	set kitcreator_versions(trunk) "Fossil Trunk Tip"

	set tcl_versions(8.4.19) 8.4.19
	set tcl_versions(8.5.9) 8.5.9
	set tcl_versions(cvs_HEAD) "Fossil Trunk Tip"





	set platforms(linux-x86) "Linux on x86"
	set platforms(linux-amd64) "Linux on amd64"

	set platforms(linux-mipsel) "Linux on MIPSEL"






	set platforms(windows-x86) "Windows on x86"









	set disable {
		platform linux-amd64 tk






		platform linux-mipsel tk
	}

	set specific {
		platform windows-x86 file icon {Kit Icon}
		platform windows-x86 text description {Description}


	}













































































































































?><html>
  <head>
    <title>KitCreator, Web Interface</title>
    <script>
<!--















	function verifyOptions() {
		var kitcreator_version;
		var tcl_version;
		var platform;

		kitcreator_version = document.getElementsByName('kitcreator_version')[0].value;
		tcl_version = document.getElementsByName('tcl_version')[0].value;
		platform = document.getElementsByName('platform')[0].value;

























	}
-->
    </script>
  </head>
  <body>
    <h1>KitCreator Web Interface</h1>
    <form method="post" enctype="multipart/form-data">
      <table>
        <tr>
          <td>KitCreator Version:</td>
          <td>
            <select name="kitcreator_version" onChange="verifyOptions();">

>
>
>
>

>
>
>








|
|
|
>

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

>
>
>
>
>
>
>

|
>
>
>
>
>
>
|



|
|
>
>

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





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









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




|







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
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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
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
<?
	package require sha1

	load_response args

	set sourcedir "/web/rkeene/devel/kitcreator/all"
	set queue "/home/rkeene/devel/kitcreator/build/web/queue"
	set secretfile "/home/rkeene/etc/kitcreator-web-secret"

	foreach file [glob -tails -nocomplain -directory $sourcedir "kitcreator-*.tar.gz"] {
		regexp {^kitcreator-(.*).tar.gz$} $file -> vers
		set kitcreator_versions($vers) $vers
	}
	set kitcreator_version_selected [lindex [lsort -dictionary [array names kitcreator_versions]] end]

	set kitcreator_versions(trunk) "Fossil Trunk Tip"

	set tcl_versions(8.5.15) 8.5.15
	set tcl_versions(8.6.1) 8.6.1
	set tcl_versions(8.6.2) 8.6.2
	set tcl_versions(fossil_trunk) "Fossil Trunk Tip"

	set platforms(android-arm) "Android/ARM"
	set platforms(freebsd-amd64) "FreeBSD/amd64"
	set platforms(hpux-hppa64) "HP-UX/PA-RISC 2.0"
	set platforms(linux-amd64) "Linux/amd64"
	set platforms(linux-arm) "Linux/ARM"
	set platforms(linux-i386) "Linux/i386"
	set platforms(linux-mipsel) "Linux/MIPS"
	set platforms(netbsd-amd64) "NetBSD/amd64"
	set platforms(netbsd-i386) "NetBSD/i386"
	set platforms(solaris-amd64) "Solaris/amd64"
	set platforms(solaris-i386) "Solaris/i386"
	set platforms(solaris-sparc) "Solaris/SPARC"
	set platforms(solaris-sparc64) "Solaris/SPARC64"
	set platforms(win32) "Windows/i386"
	set platforms(win64) "Windows/amd64"

	set packages(tk) "Tk"
	set packages(mk4tcl) "Metakit"
	set packages(tcc4tcl) "tcc4tcl"
	set packages(tls) TLS
	set packages(dbus) D-BUS
	set packages(tclx) TclX

	set disable {
		platform linux-mipsel {tk tcc4tcl}
		platform android-arm tk
		platform netbsd-amd64 {tk tcc4tcl}
		platform netbsd-i386 {tk tcc4tcl}
		platform solaris-sparc tcc4tcl
		platform solaris-sparc64 tcc4tcl
		platform hpux-hppa64 tcc4tcl
		platform linux-arm tk
	}

	set specific {
		platform win32 file icon {Kit Icon}
		platform win32 text description {Description}
		platform win64 file icon {Kit Icon}
		platform win64 text description {Description}
	}

	if {[info exists args(platform)] && [info exists args(tcl_version)] && [info exist args(kitcreator_version)]} {
		# Read in arguments
		## Mandatory arguments
		set build_platform $args(platform)
		set build_tcl_version $args(tcl_version)
		set build_kitcreator_version $args(kitcreator_version)

		## Optional Arguments
		set build_packages [list]
		set build_options(threaded) 0
		set build_options(kitdll) 0
		set build_options(debug) 0
		foreach arg [array names args] {
			switch -glob -- $arg {
				"option_package_*" {
					set package [join [lrange [split $arg _] 2 end] _]

					lappend build_packages $package
				}
				"option_threaded" {
					set build_options(threaded) 1
				}
				"option_kitdll" {
					set build_options(kitdll) 1
				}
				"option_debug" {
					set build_options(debug) 1
				}
				"option_storage" {
					switch -- $args($arg) {
						"mk4" - "zip" - "cvfs" {
							set build_options(storage) $args($arg)
						}
					}
				}
			}
		}
		set build_packages [lsort -dictionary $build_packages]

		# Validate arguments
		if {![info exists platforms($build_platform)]} {
			unset build_platform
		}

		if {![info exists tcl_versions($build_tcl_version)]} {
			unset build_tcl_version
		}

		if {![info exists kitcreator_versions($build_kitcreator_version)]} {
			unset build_kitcreator_version
		}

		foreach package $build_packages {
			if {![info exists packages($package)]} {
				unset build_packages

				break
			}
		}

		# Resolve version numbers to checkin IDs
		## XXX: TODO
		set cache_tcl_version $build_tcl_version
		if {$build_tcl_version == "fossil_trunk"} {
			set cache_tcl_version [clock format [clock seconds] -format {%Y%m%d}]
		}

		set cache_kitcreator_version $build_kitcreator_version
		if {$build_kitcreator_version == "trunk"} {
			set cache_kitcreator_version [clock format [clock seconds] -format {%Y%m%d}]
		}

		# Generate a serialized hash that represents the state of the build
		## Load a secret so keys cannot be pre-computed (but remain consistent)
		set secretfd [open $secretfile "r"]
		set secret [gets $secretfd]
		close $secretfd

		## Compute basic key	
		set key [list $secret $build_platform $cache_tcl_version $cache_kitcreator_version $build_packages]

		## Update key with options in deterministic order
		foreach option [lsort -dictionary [array names build_options]] {
			switch -- $option {
				"threaded" - "kitdll" - "debug" {
					# For boolean options, skip them if they are not enabled
					if {!$build_options($option)} {
						continue
					}
				}
			}
			lappend key [list "option:$option" $build_options($option)]
		}

		## Convert key to a user-consumable string via hashing
		set key [string tolower [sha1::sha1 -hex $key]]

		# Determine filename
		if {$build_options(kitdll)} {
			set extension "so"
			switch -- $build_platform {
				"win32" - "win64" {
					set extension "dll"
				}
				"hpux-hppa64" {
					set extension "sl"
				}
			}

			## XXX: TODO: The version here needs to match what's in the SONAME
			set filename "libtclkit[string map [list "." ""] ${cache_tcl_version}].${extension}"
		} else {
			set filename "tclkit"

			switch -- $build_platform {
				"win32" - "win64" {
					append filename ".exe"
				}
			}
		}

		# Queue build up and wait for it to complete
		set fd [open $queue a+]
		puts $fd [list filename $filename key $key platform $build_platform tcl_version $build_tcl_version kitcreator_version $build_kitcreator_version packages $build_packages options [array get build_options]]
		close $fd

		set url "http://kitcreator.rkeene.org/kits/building/$key/"

		headers redirect $url
?><html>
	<head>
		<title>KitCreator, Web Interface</title>
	</head>
	<body>
		<h1>KitCreator Web Interface</h1>
		<p>Build in progress, see <a href="<? puts -nonewline $url ?>"><? puts -nonewline $url ?></a> for build information</p>
	</body>
</html>
<?
	} else {
?><html>
  <head>
    <title>KitCreator, Web Interface</title>
    <script>
<!--
	function enablePackage(package) {
		var obj;

		obj = document.getElementById('option_package_' + package);
		obj.disabled = false;
	}

	function disablePackage(package) {
		var obj;

		obj = document.getElementById('option_package_' + package);
		obj.checked = false;
		obj.disabled = true;
	}

	function verifyOptions() {
		var kitcreator_version;
		var tcl_version;
		var platform;

		kitcreator_version = document.getElementsByName('kitcreator_version')[0].value;
		tcl_version = document.getElementsByName('tcl_version')[0].value;
		platform = document.getElementsByName('platform')[0].value;

<?
		set alldisabledpackages [list]
		foreach {keyword value disablepackages} $disable {
			foreach package $disablepackages {
				if {[lsearch -exact $alldisabledpackages $package] == -1} {
					lappend alldisabledpackages $package
				}
			}
		}

		foreach package $alldisabledpackages {
			puts "\t\tenablePackage(\"$package\");"
		}

		foreach {keyword value disablepackages} $disable {
			puts "\t\tif ($keyword == \"$value\") \{"

			foreach package $disablepackages {
				puts "\t\t\tdisablePackage(\"$package\");"
			}

			puts "\t\t\}"
		}
?>
	}
-->
    </script>
  </head>
  <body onLoad="verifyOptions();">
    <h1>KitCreator Web Interface</h1>
    <form method="post" enctype="multipart/form-data">
      <table>
        <tr>
          <td>KitCreator Version:</td>
          <td>
            <select name="kitcreator_version" onChange="verifyOptions();">
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
?>
            </select>
          </td>
        </tr>
        <tr>
          <td>Kit Options:</td>
          <td>

            <input type="checkbox" name="option_package_tk">Tk<br>

            <input type="checkbox" name="option_package_itcl">[incr Tcl]<br>
            <input type="checkbox" name="option_package_mk4tcl">Metakit<br>
            <input type="checkbox" name="option_threaded">Threaded<br>





            <input type="checkbox" name="option_kitdll">Build Library (KitDLL)<br>





          </td>
        </tr>

        <tr>
          <td>Kit Icon:</td>
          <td>
            <input type="file" name="platform-windows-x86-icon">
          </td>
        </tr>
        <tr>
          <td>Description:</td>
          <td>
            <input type="text" name="platform-windows-x86-desc">
          </td>
        </tr>

      </table>
      <input type="submit" name="submit" value="Create">
    </form>
  </body>
</html>







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



|





|


>




|
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
?>
            </select>
          </td>
        </tr>
        <tr>
          <td>Kit Options:</td>
          <td>
<?  foreach package [lsort -dictionary [array names packages]] { ?>
            <input type="checkbox" name="option_package_<? puts -nonewline $package ?>" id="option_package_<? puts -nonewline $package ?>">Package: <? puts -nonewline $packages($package) ?><br>
<? } ?>
            <input type="checkbox" name="option_threaded">Kit: Threaded<br>
            <input type="checkbox" name="option_debug">Kit: Debugging Build<br>
            <input type="checkbox" name="option_kitdll">Kit: Build Library (KitDLL)<br>
          </td>
        </tr>
	<tr>
		<td>Kit Storage:</td>
		<td>
			<select name="option_storage">
				<option value="auto">Automatically Determined</option>
				<option value="mk4">Metakit</option>
				<option value="zip">Zip</option>
				<option value="cvfs">C-VFS</option>
			</select>
		</td>
	</tr>
<!--
        <tr>
          <td>Kit Icon:</td>
          <td>
            <input type="file" name="option_icon">
          </td>
        </tr>
        <tr>
          <td>Description:</td>
          <td>
            <input type="text" name="option_desc">
          </td>
        </tr>
-->
      </table>
      <input type="submit" name="submit" value="Create">
    </form>
  </body>
</html><? } ?>

Added build/web/kitcreator.vfs/lib/.htaccess version [30ceba8f4e].



>
1
Deny from all

Added build/web/kitcreator.vfs/lib/sha1-2.0.3/pkgIndex.tcl version [6f6c09ab55].



>
1
package ifneeded sha1 2.0.3 [list source [file join $dir sha1.tcl]]

Added build/web/kitcreator.vfs/lib/sha1-2.0.3/sha1.tcl version [778d9b332e].























































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
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
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
# sha1.tcl - 

# @@ Meta Begin
# Package sha1 2.0.3
# Meta platform           tcl
# Meta rsk::build::date   2011-03-30
# Meta description        Part of the Tclib sha1 module
# Meta require            {Tcl 8.2}
# @@ Meta End

#
# Copyright (C) 2001 Don Libes <libes@nist.gov>
# Copyright (C) 2003 Pat Thoyts <patthoyts@users.sourceforge.net>
#
# SHA1 defined by FIPS 180-1, "The SHA1 Message-Digest Algorithm"
# HMAC defined by RFC 2104, "Keyed-Hashing for Message Authentication"
#
# This is an implementation of SHA1 based upon the example code given in
# FIPS 180-1 and upon the tcllib MD4 implementation and taking some ideas
# and methods from the earlier tcllib sha1 version by Don Libes.
#
# This implementation permits incremental updating of the hash and 
# provides support for external compiled implementations either using
# critcl (sha1c) or Trf.
#
# ref: http://www.itl.nist.gov/fipspubs/fip180-1.htm
#
# -------------------------------------------------------------------------
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# -------------------------------------------------------------------------
#
# $Id: sha1.tcl,v 1.22 2009/05/07 00:35:10 patthoyts Exp $

# @mdgen EXCLUDE: sha1c.tcl

package require Tcl 8.2;                # tcl minimum version

namespace eval ::sha1 {
    variable  version 2.0.3
    variable  rcsid {$Id: sha1.tcl,v 1.22 2009/05/07 00:35:10 patthoyts Exp $}

    variable  accel
    array set accel {tcl 0 critcl 0 cryptkit 0 trf 0}
    variable  loaded {}
    variable  active
    array set active {tcl 0 critcl 0 cryptkit 0 trf 0}

    namespace export sha1 hmac SHA1Init SHA1Update SHA1Final

    variable uid
    if {![info exists uid]} {
        set uid 0
    }
}

# -------------------------------------------------------------------------
# Management of sha1 implementations.

# LoadAccelerator --
#
#	This package can make use of a number of compiled extensions to
#	accelerate the digest computation. This procedure manages the
#	use of these extensions within the package. During normal usage
#	this should not be called, but the test package manipulates the
#	list of enabled accelerators.
#
proc ::sha1::LoadAccelerator {name} {
    variable accel
    set r 0
    switch -exact -- $name {
        tcl {
            # Already present (this file)
            set r 1
        }
        critcl {
            if {![catch {package require tcllibc}]
                || ![catch {package require sha1c}]} {
                set r [expr {[info command ::sha1::sha1c] != {}}]
            }
        }
        cryptkit {
            if {![catch {package require cryptkit}]} {
                set r [expr {![catch {cryptkit::cryptInit}]}]
            }
        }
        trf {
            if {![catch {package require Trf}]} {
                set r [expr {![catch {::sha1 aa} msg]}]
            }
        }
        default {
            return -code error "invalid accelerator $key:\
                must be one of [join [KnownImplementations] {, }]"
        }
    }
    set accel($name) $r
    return $r
}

# ::sha1::Implementations --
#
#	Determines which implementations are
#	present, i.e. loaded.
#
# Arguments:
#	None.
#
# Results:
#	A list of implementation keys.

proc ::sha1::Implementations {} {
    variable accel
    set res {}
    foreach n [array names accel] {
	if {!$accel($n)} continue
	lappend res $n
    }
    return $res
}

# ::sha1::KnownImplementations --
#
#	Determines which implementations are known
#	as possible implementations.
#
# Arguments:
#	None.
#
# Results:
#	A list of implementation keys. In the order
#	of preference, most prefered first.

proc ::sha1::KnownImplementations {} {
    return {critcl cryptkit trf tcl}
}

proc ::sha1::Names {} {
    return {
	critcl   {tcllibc based}
        cryptkit {cryptkit based}
        trf      {Trf based}
	tcl      {pure Tcl}
    }
}

# ::sha1::SwitchTo --
#
#	Activates a loaded named implementation.
#
# Arguments:
#	key	Name of the implementation to activate.
#
# Results:
#	None.

proc ::sha1::SwitchTo {key} {
    variable accel
    variable active
    variable loaded

    if {[string equal $key $loaded]} {
	# No change, nothing to do.
	return
    } elseif {![string equal $key ""]} {
	# Validate the target implementation of the switch.

	if {![info exists accel($key)]} {
	    return -code error "Unable to activate unknown implementation \"$key\""
	} elseif {![info exists accel($key)] || !$accel($key)} {
	    return -code error "Unable to activate missing implementation \"$key\""
	}
    }

    if {![string equal $loaded ""]} {
        set active($loaded) 0
    }
    if {![string equal $key ""]} {
        set active($key) 1
    }

    # Remember the active implementation, for deactivation by future
    # switches.

    set loaded $key
    return
}

# -------------------------------------------------------------------------

# SHA1Init --
#
#   Create and initialize an SHA1 state variable. This will be
#   cleaned up when we call SHA1Final
#

proc ::sha1::SHA1Init {} {
    variable active
    variable uid
    set token [namespace current]::[incr uid]
    upvar #0 $token state

    # FIPS 180-1: 7 - Initialize the hash state
    array set state \
        [list \
             A [expr {int(0x67452301)}] \
             B [expr {int(0xEFCDAB89)}] \
             C [expr {int(0x98BADCFE)}] \
             D [expr {int(0x10325476)}] \
             E [expr {int(0xC3D2E1F0)}] \
             n 0 i "" ]
    if {$active(cryptkit)} {
        cryptkit::cryptCreateContext state(ckctx) CRYPT_UNUSED CRYPT_ALGO_SHA
    } elseif {$active(trf)} {
        set s {}
        switch -exact -- $::tcl_platform(platform) {
            windows { set s [open NUL w] }
            unix    { set s [open /dev/null w] }
        }
        if {$s != {}} {
            fconfigure $s -translation binary -buffering none
            ::sha1 -attach $s -mode write \
                -read-type variable \
                -read-destination [subst $token](trfread) \
                -write-type variable \
                -write-destination [subst $token](trfwrite)
            array set state [list trfread 0 trfwrite 0 trf $s]
        }
    }
    return $token
}

# SHA1Update --
#
#   This is called to add more data into the hash. You may call this
#   as many times as you require. Note that passing in "ABC" is equivalent
#   to passing these letters in as separate calls -- hence this proc 
#   permits hashing of chunked data
#
#   If we have a C-based implementation available, then we will use
#   it here in preference to the pure-Tcl implementation.
#
proc ::sha1::SHA1Update {token data} {
    variable active
    upvar #0 $token state

    if {$active(critcl)} {
        if {[info exists state(sha1c)]} {
            set state(sha1c) [sha1c $data $state(sha1c)]
        } else {
            set state(sha1c) [sha1c $data]
        }
        return
    } elseif {[info exists state(ckctx)]} {
        if {[string length $data] > 0} {
            cryptkit::cryptEncrypt $state(ckctx) $data
        }
        return
    } elseif {[info exists state(trf)]} {
        puts -nonewline $state(trf) $data
        return
    }

    # Update the state values
    incr state(n) [string length $data]
    append state(i) $data

    # Calculate the hash for any complete blocks
    set len [string length $state(i)]
    for {set n 0} {($n + 64) <= $len} {} {
        SHA1Transform $token [string range $state(i) $n [incr n 64]]
    }

    # Adjust the state for the blocks completed.
    set state(i) [string range $state(i) $n end]
    return
}

# SHA1Final --
#
#    This procedure is used to close the current hash and returns the
#    hash data. Once this procedure has been called the hash context
#    is freed and cannot be used again.
#
#    Note that the output is 160 bits represented as binary data.
#
proc ::sha1::SHA1Final {token} {
    upvar #0 $token state

    # Check for either of the C-compiled versions.
    if {[info exists state(sha1c)]} {
        set r $state(sha1c)
        unset state
        return $r
    } elseif {[info exists state(ckctx)]} {
        cryptkit::cryptEncrypt $state(ckctx) ""
        cryptkit::cryptGetAttributeString $state(ckctx) \
            CRYPT_CTXINFO_HASHVALUE r 20
        cryptkit::cryptDestroyContext $state(ckctx)
        # If nothing was hashed, we get no r variable set!
        if {[info exists r]} {
            unset state
            return $r
        }
    } elseif {[info exists state(trf)]} {
        close $state(trf)
        set r $state(trfwrite)
        unset state
        return $r
    }

    # Padding
    #
    set len [string length $state(i)]
    set pad [expr {56 - ($len % 64)}]
    if {$len % 64 > 56} {
        incr pad 64
    }
    if {$pad == 0} {
        incr pad 64
    }
    append state(i) [binary format a$pad \x80]

    # Append length in bits as big-endian wide int.
    set dlen [expr {8 * $state(n)}]
    append state(i) [binary format II 0 $dlen]

    # Calculate the hash for the remaining block.
    set len [string length $state(i)]
    for {set n 0} {($n + 64) <= $len} {} {
        SHA1Transform $token [string range $state(i) $n [incr n 64]]
    }

    # Output
    set r [bytes $state(A)][bytes $state(B)][bytes $state(C)][bytes $state(D)][bytes $state(E)]
    unset state
    return $r
}

# -------------------------------------------------------------------------
# HMAC Hashed Message Authentication (RFC 2104)
#
# hmac = H(K xor opad, H(K xor ipad, text))
#

# HMACInit --
#
#    This is equivalent to the SHA1Init procedure except that a key is
#    added into the algorithm
#
proc ::sha1::HMACInit {K} {

    # Key K is adjusted to be 64 bytes long. If K is larger, then use
    # the SHA1 digest of K and pad this instead.
    set len [string length $K]
    if {$len > 64} {
        set tok [SHA1Init]
        SHA1Update $tok $K
        set K [SHA1Final $tok]
        set len [string length $K]
    }
    set pad [expr {64 - $len}]
    append K [string repeat \0 $pad]

    # Cacluate the padding buffers.
    set Ki {}
    set Ko {}
    binary scan $K i16 Ks
    foreach k $Ks {
        append Ki [binary format i [expr {$k ^ 0x36363636}]]
        append Ko [binary format i [expr {$k ^ 0x5c5c5c5c}]]
    }

    set tok [SHA1Init]
    SHA1Update $tok $Ki;                 # initialize with the inner pad
    
    # preserve the Ko value for the final stage.
    # FRINK: nocheck
    set [subst $tok](Ko) $Ko

    return $tok
}

# HMACUpdate --
#
#    Identical to calling SHA1Update
#
proc ::sha1::HMACUpdate {token data} {
    SHA1Update $token $data
    return
}

# HMACFinal --
#
#    This is equivalent to the SHA1Final procedure. The hash context is
#    closed and the binary representation of the hash result is returned.
#
proc ::sha1::HMACFinal {token} {
    upvar #0 $token state

    set tok [SHA1Init];                 # init the outer hashing function
    SHA1Update $tok $state(Ko);         # prepare with the outer pad.
    SHA1Update $tok [SHA1Final $token]; # hash the inner result
    return [SHA1Final $tok]
}

# -------------------------------------------------------------------------
# Description:
#  This is the core SHA1 algorithm. It is a lot like the MD4 algorithm but
#  includes an extra round and a set of constant modifiers throughout.
#
set ::sha1::SHA1Transform_body {
    upvar #0 $token state

    # FIPS 180-1: 7a: Process Message in 16-Word Blocks
    binary scan $msg I* blocks
    set blockLen [llength $blocks]
    for {set i 0} {$i < $blockLen} {incr i 16} {
        set W [lrange $blocks $i [expr {$i+15}]]
        
        # FIPS 180-1: 7b: Expand the input into 80 words
        # For t = 16 to 79 
        #   let Wt = (Wt-3 ^ Wt-8 ^ Wt-14 ^ Wt-16) <<< 1
        set t3  12
        set t8   7
        set t14  1
        set t16 -1
        for {set t 16} {$t < 80} {incr t} {
            set x [expr {[lindex $W [incr t3]] ^ [lindex $W [incr t8]] ^ \
                             [lindex $W [incr t14]] ^ [lindex $W [incr t16]]}]
            lappend W [expr {int(($x << 1) | (($x >> 31) & 1))}]
        }
        
        # FIPS 180-1: 7c: Copy hash state.
        set A $state(A)
        set B $state(B)
        set C $state(C)
        set D $state(D)
        set E $state(E)

        # FIPS 180-1: 7d: Do permutation rounds
        # For t = 0 to 79 do
        #   TEMP = (A<<<5) + ft(B,C,D) + E + Wt + Kt;
        #   E = D; D = C; C = S30(B); B = A; A = TEMP;

        # Round 1: ft(B,C,D) = (B & C) | (~B & D) ( 0 <= t <= 19)
        for {set t 0} {$t < 20} {incr t} {
            set TEMP [F1 $A $B $C $D $E [lindex $W $t]]
            set E $D
            set D $C
            set C [rotl32 $B 30]
            set B $A
            set A $TEMP
        }

        # Round 2: ft(B,C,D) = (B ^ C ^ D) ( 20 <= t <= 39)
        for {} {$t < 40} {incr t} {
            set TEMP [F2 $A $B $C $D $E [lindex $W $t]]
            set E $D
            set D $C
            set C [rotl32 $B 30]
            set B $A
            set A $TEMP
        }

        # Round 3: ft(B,C,D) = ((B & C) | (B & D) | (C & D)) ( 40 <= t <= 59)
        for {} {$t < 60} {incr t} {
            set TEMP [F3 $A $B $C $D $E [lindex $W $t]]
            set E $D
            set D $C
            set C [rotl32 $B 30]
            set B $A
            set A $TEMP
         }

        # Round 4: ft(B,C,D) = (B ^ C ^ D) ( 60 <= t <= 79)
        for {} {$t < 80} {incr t} {
            set TEMP [F4 $A $B $C $D $E [lindex $W $t]]
            set E $D
            set D $C
            set C [rotl32 $B 30]
            set B $A
            set A $TEMP
        }

        # Then perform the following additions. (That is, increment each
        # of the four registers by the value it had before this block
        # was started.)
        incr state(A) $A
        incr state(B) $B
        incr state(C) $C
        incr state(D) $D
        incr state(E) $E
    }

    return
}

proc ::sha1::F1 {A B C D E W} {
    expr {(((($A << 5) & 0xffffffff) | (($A >> 27) & 0x1f)) \
               + ($D ^ ($B & ($C ^ $D))) + $E + $W + 0x5a827999) & 0xffffffff}
}

proc ::sha1::F2 {A B C D E W} {
    expr {(((($A << 5) & 0xffffffff) | (($A >> 27) & 0x1f)) \
               + ($B ^ $C ^ $D) + $E + $W + 0x6ed9eba1) & 0xffffffff}
}

proc ::sha1::F3 {A B C D E W} {
    expr {(((($A << 5) & 0xffffffff)| (($A >> 27) & 0x1f)) \
               + (($B & $C) | ($D & ($B | $C))) + $E + $W + 0x8f1bbcdc) & 0xffffffff}
}

proc ::sha1::F4 {A B C D E W} {
    expr {(((($A << 5) & 0xffffffff)| (($A >> 27) & 0x1f)) \
               + ($B ^ $C ^ $D) + $E + $W + 0xca62c1d6) & 0xffffffff}
}

proc ::sha1::rotl32 {v n} {
    return [expr {((($v << $n) \
                        | (($v >> (32 - $n)) \
                               & (0x7FFFFFFF >> (31 - $n))))) \
                      & 0xFFFFFFFF}]
}


# -------------------------------------------------------------------------
# 
# In order to get this code to go as fast as possible while leaving
# the main code readable we can substitute the above function bodies
# into the transform procedure. This inlines the code for us an avoids
# a procedure call overhead within the loops.
#
# We can do some minor tweaking to improve speed on Tcl < 8.5 where we
# know our arithmetic is limited to 64 bits. On > 8.5 we may have 
# unconstrained integer arithmetic and must avoid letting it run away.
#

regsub -all -line \
    {\[F1 \$A \$B \$C \$D \$E (\[.*?\])\]} \
    $::sha1::SHA1Transform_body \
    {[expr {(rotl32($A,5) + ($D ^ ($B \& ($C ^ $D))) + $E + \1 + 0x5a827999) \& 0xffffffff}]} \
    ::sha1::SHA1Transform_body_tmp

regsub -all -line \
    {\[F2 \$A \$B \$C \$D \$E (\[.*?\])\]} \
    $::sha1::SHA1Transform_body_tmp \
    {[expr {(rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0x6ed9eba1) \& 0xffffffff}]} \
    ::sha1::SHA1Transform_body_tmp

regsub -all -line \
    {\[F3 \$A \$B \$C \$D \$E (\[.*?\])\]} \
    $::sha1::SHA1Transform_body_tmp \
    {[expr {(rotl32($A,5) + (($B \& $C) | ($D \& ($B | $C))) + $E + \1 + 0x8f1bbcdc) \& 0xffffffff}]} \
    ::sha1::SHA1Transform_body_tmp

regsub -all -line \
    {\[F4 \$A \$B \$C \$D \$E (\[.*?\])\]} \
    $::sha1::SHA1Transform_body_tmp \
    {[expr {(rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0xca62c1d6) \& 0xffffffff}]} \
    ::sha1::SHA1Transform_body_tmp

regsub -all -line \
    {rotl32\(\$A,5\)} \
    $::sha1::SHA1Transform_body_tmp \
    {((($A << 5) \& 0xffffffff) | (($A >> 27) \& 0x1f))} \
    ::sha1::SHA1Transform_body_tmp

regsub -all -line \
    {\[rotl32 \$B 30\]} \
    $::sha1::SHA1Transform_body_tmp \
    {[expr {int(($B << 30) | (($B >> 2) \& 0x3fffffff))}]} \
    ::sha1::SHA1Transform_body_tmp
#
# Version 2 avoids a few truncations to 32 bits in non-essential places.
#
regsub -all -line \
    {\[F1 \$A \$B \$C \$D \$E (\[.*?\])\]} \
    $::sha1::SHA1Transform_body \
    {[expr {rotl32($A,5) + ($D ^ ($B \& ($C ^ $D))) + $E + \1 + 0x5a827999}]} \
    ::sha1::SHA1Transform_body_tmp2

regsub -all -line \
    {\[F2 \$A \$B \$C \$D \$E (\[.*?\])\]} \
    $::sha1::SHA1Transform_body_tmp2 \
    {[expr {rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0x6ed9eba1}]} \
    ::sha1::SHA1Transform_body_tmp2

regsub -all -line \
    {\[F3 \$A \$B \$C \$D \$E (\[.*?\])\]} \
    $::sha1::SHA1Transform_body_tmp2 \
    {[expr {rotl32($A,5) + (($B \& $C) | ($D \& ($B | $C))) + $E + \1 + 0x8f1bbcdc}]} \
    ::sha1::SHA1Transform_body_tmp2

regsub -all -line \
    {\[F4 \$A \$B \$C \$D \$E (\[.*?\])\]} \
    $::sha1::SHA1Transform_body_tmp2 \
    {[expr {rotl32($A,5) + ($B ^ $C ^ $D) + $E + \1 + 0xca62c1d6}]} \
    ::sha1::SHA1Transform_body_tmp2

regsub -all -line \
    {rotl32\(\$A,5\)} \
    $::sha1::SHA1Transform_body_tmp2 \
    {(($A << 5) | (($A >> 27) \& 0x1f))} \
    ::sha1::SHA1Transform_body_tmp2

regsub -all -line \
    {\[rotl32 \$B 30\]} \
    $::sha1::SHA1Transform_body_tmp2 \
    {[expr {($B << 30) | (($B >> 2) \& 0x3fffffff)}]} \
    ::sha1::SHA1Transform_body_tmp2

if {[package vsatisfies [package provide Tcl] 8.5]} {
    proc ::sha1::SHA1Transform {token msg} $::sha1::SHA1Transform_body_tmp
} else {
    proc ::sha1::SHA1Transform {token msg} $::sha1::SHA1Transform_body_tmp2
}

unset ::sha1::SHA1Transform_body
unset ::sha1::SHA1Transform_body_tmp
unset ::sha1::SHA1Transform_body_tmp2

# -------------------------------------------------------------------------

proc ::sha1::byte {n v} {expr {((0xFF << (8 * $n)) & $v) >> (8 * $n)}}
proc ::sha1::bytes {v} { 
    #format %c%c%c%c [byte 0 $v] [byte 1 $v] [byte 2 $v] [byte 3 $v]
    format %c%c%c%c \
        [expr {((0xFF000000 & $v) >> 24) & 0xFF}] \
        [expr {(0xFF0000 & $v) >> 16}] \
        [expr {(0xFF00 & $v) >> 8}] \
        [expr {0xFF & $v}]
}

# -------------------------------------------------------------------------

proc ::sha1::Hex {data} {
    binary scan $data H* result
    return $result
}

# -------------------------------------------------------------------------

# Description:
#  Pop the nth element off a list. Used in options processing.
#
proc ::sha1::Pop {varname {nth 0}} {
    upvar $varname args
    set r [lindex $args $nth]
    set args [lreplace $args $nth $nth]
    return $r
}

# -------------------------------------------------------------------------

# fileevent handler for chunked file hashing.
#
proc ::sha1::Chunk {token channel {chunksize 4096}} {
    upvar #0 $token state
    
    if {[eof $channel]} {
        fileevent $channel readable {}
        set state(reading) 0
    }
        
    SHA1Update $token [read $channel $chunksize]
}

# -------------------------------------------------------------------------

proc ::sha1::sha1 {args} {
    array set opts {-hex 0 -filename {} -channel {} -chunksize 4096}
    if {[llength $args] == 1} {
        set opts(-hex) 1
    } else {
        while {[string match -* [set option [lindex $args 0]]]} {
            switch -glob -- $option {
                -hex       { set opts(-hex) 1 }
                -bin       { set opts(-hex) 0 }
                -file*     { set opts(-filename) [Pop args 1] }
                -channel   { set opts(-channel) [Pop args 1] }
                -chunksize { set opts(-chunksize) [Pop args 1] }
                default {
                    if {[llength $args] == 1} { break }
                    if {[string compare $option "--"] == 0} { Pop args; break }
                    set err [join [lsort [concat -bin [array names opts]]] ", "]
                    return -code error "bad option $option:\
                    must be one of $err"
                }
            }
            Pop args
        }
    }

    if {$opts(-filename) != {}} {
        set opts(-channel) [open $opts(-filename) r]
        fconfigure $opts(-channel) -translation binary
    }

    if {$opts(-channel) == {}} {

        if {[llength $args] != 1} {
            return -code error "wrong # args:\
                should be \"sha1 ?-hex? -filename file | string\""
        }
        set tok [SHA1Init]
        SHA1Update $tok [lindex $args 0]
        set r [SHA1Final $tok]

    } else {

        set tok [SHA1Init]
        # FRINK: nocheck
        set [subst $tok](reading) 1
        fileevent $opts(-channel) readable \
            [list [namespace origin Chunk] \
                 $tok $opts(-channel) $opts(-chunksize)]
        # FRINK: nocheck
        vwait [subst $tok](reading)
        set r [SHA1Final $tok]

        # If we opened the channel - we should close it too.
        if {$opts(-filename) != {}} {
            close $opts(-channel)
        }
    }
    
    if {$opts(-hex)} {
        set r [Hex $r]
    }
    return $r
}

# -------------------------------------------------------------------------

proc ::sha1::hmac {args} {
    array set opts {-hex 1 -filename {} -channel {} -chunksize 4096}
    if {[llength $args] != 2} {
        while {[string match -* [set option [lindex $args 0]]]} {
            switch -glob -- $option {
                -key       { set opts(-key) [Pop args 1] }
                -hex       { set opts(-hex) 1 }
                -bin       { set opts(-hex) 0 }
                -file*     { set opts(-filename) [Pop args 1] }
                -channel   { set opts(-channel) [Pop args 1] }
                -chunksize { set opts(-chunksize) [Pop args 1] }
                default {
                    if {[llength $args] == 1} { break }
                    if {[string compare $option "--"] == 0} { Pop args; break }
                    set err [join [lsort [array names opts]] ", "]
                    return -code error "bad option $option:\
                    must be one of $err"
                }
            }
            Pop args
        }
    }

    if {[llength $args] == 2} {
        set opts(-key) [Pop args]
    }

    if {![info exists opts(-key)]} {
        return -code error "wrong # args:\
            should be \"hmac ?-hex? -key key -filename file | string\""
    }

    if {$opts(-filename) != {}} {
        set opts(-channel) [open $opts(-filename) r]
        fconfigure $opts(-channel) -translation binary
    }

    if {$opts(-channel) == {}} {

        if {[llength $args] != 1} {
            return -code error "wrong # args:\
                should be \"hmac ?-hex? -key key -filename file | string\""
        }
        set tok [HMACInit $opts(-key)]
        HMACUpdate $tok [lindex $args 0]
        set r [HMACFinal $tok]

    } else {

        set tok [HMACInit $opts(-key)]
        # FRINK: nocheck
        set [subst $tok](reading) 1
        fileevent $opts(-channel) readable \
            [list [namespace origin Chunk] \
                 $tok $opts(-channel) $opts(-chunksize)]
        # FRINK: nocheck
        vwait [subst $tok](reading)
        set r [HMACFinal $tok]

        # If we opened the channel - we should close it too.
        if {$opts(-filename) != {}} {
            close $opts(-channel)
        }
    }
    
    if {$opts(-hex)} {
        set r [Hex $r]
    }
    return $r
}

# -------------------------------------------------------------------------

# Try and load a compiled extension to help.
namespace eval ::sha1 {
    variable e {}
    foreach e [KnownImplementations] {
	if {[LoadAccelerator $e]} {
	    SwitchTo $e
	    break
	}
    }
    unset e
}

package provide sha1 $::sha1::version

# -------------------------------------------------------------------------
# Local Variables:
#   mode: tcl
#   indent-tabs-mode: nil
# End:

Added build/web/process_queue version [ad31dc7738].











































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
137
138
139
140
141
142
143
144
145
146
147
148
149
#! /usr/bin/env tclsh

set queue "/home/rkeene/devel/kitcreator/build/web/queue"
set outdir "/web/customers/kitcreator.rkeene.org/kits"

if {![file exists "${queue}.old"]} {
	if {![file exists $queue]} {
		exit 0
	}

	file rename "$queue" "${queue}.old"
}
set queue "${queue}.old"

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

set ::env(TCLKIT) "/home/rkeene/bin/tclkit"

foreach line [split $data "\n"] {
	if {$line == ""} {
		continue
	}

	unset -nocomplain buildinfo

	array set buildinfo $line

	set outfile [file join $outdir $buildinfo(key) $buildinfo(filename)]

	# Skip if build completed
	if {[file exists $outfile]} {
		continue
	}

	# Skip if build failed
	if {[file exists $outfile.buildfail]} {
		continue
	}

	set workdir [file join $outdir $buildinfo(key) build]
	file delete -force $workdir
	file mkdir $workdir
	cd $workdir

	set fd [open ../buildinfo w]
	puts $fd [array get buildinfo]
	close $fd

	set tarball kitcreator-${buildinfo(kitcreator_version)}.tar.gz
	exec wget -q -O $tarball http://kitcreator.rkeene.org/fossil/tarball/${tarball}?uuid=${buildinfo(kitcreator_version)}
	exec gzip -dc $tarball | tar -xf -
	cd kitcreator-${buildinfo(kitcreator_version)}

	set script "./build/make-kit-${buildinfo(platform)}"
	set args [list]

	set ::env(KITCREATOR_PKGS) " [join $buildinfo(packages) " "] "

	foreach {option value} $buildinfo(options) {
		switch -- $option {
			"kitdll" {
				if {$value} {
					set ::env(KITCREATOR_PKGS) "$::env(KITCREATOR_PKGS) kitdll"
				}
			}
			"threaded" {
				if {$value} {
					lappend args "--enable-threads"
				} else {
					lappend args "--disable-threads"
				}
			}
			"debug" {
				if {$value} {
					lappend args "--enable-symbols"
					set ::env(STRIP) true
				}
			}
			"storage" {
				lappend args "--enable-kit-storage=$value"
			}
			"staticmk4" {
			}
			"statictk" {
			}
		}
	}

	catch {
		exec ./build/pre.sh
	}

	catch {
		file delete "${outfile}.log"
	}

	catch {
		set cmd [list $script $buildinfo(tcl_version) {*}$args]
		set fd [open "${outfile}.log" w+]
		puts $fd "Running: export KITCREATOR_PKGS=\"$::env(KITCREATOR_PKGS)\""

		if {[info exists ::env(STRIP)]} {
			puts $fd "Running: export STRIP=\"$::env(STRIP)\""
		}

		puts $fd "Running: $cmd"
		close $fd
	}

	catch {
		exec {*}$cmd >> "${outfile}.log" 2>@1
	}

	catch {
		exec grep ^ {*}[glob */build.log] >> "${outfile}.log"
	}

	foreach file [list tclkit-$buildinfo(tcl_version) {*}[glob -nocomplain libtclkit*]] {
		switch -glob -- $file {
			"*.dylib" - "*.so" - "*.sl" - "*.dll" { }
			"tclkit-*" {}
			default {
				continue
			}
		}

		if {[file exists $file]} {
			file rename $file $outfile

			break
		}
	}

	if {![file exists $outfile]} {
		set fd [open $outfile.buildfail "w+"]
		puts $fd "$line"
		close $fd
	}

	cd $outdir

	file delete -force $workdir
}

file delete $queue

exit 0

Modified dbus/build.sh from [e9059f054d] to [f52d4218f1].

23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
SRCURL="http://sourceforge.net/projects/dbus-tcl/files/dbus/${DBUSVERS}/dbus-${DBUSVERS}.tar.gz/download"
BUILDDIR="$(pwd)/build/dbus-${DBUSVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
export DBUSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR

# Set configure options for this sub-project
LDFLAGS="${KC_DBUS_LDFLAGS}"
CFLAGS="${KC_DBUS_CFLAGS}"
CPPFLAGS="${KC_DBUS_CPPFLAGS}"
LIBS="${KC_DBUS_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

if [ ! -f "${SRC}" ]; then
	mkdir 'src' >/dev/null 2>/dev/null

	if [ ! -d 'buildsrc' ]; then
		rm -f "${SRC}.tmp"







|
|
|
|







23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
SRCURL="http://sourceforge.net/projects/dbus-tcl/files/dbus/${DBUSVERS}/dbus-${DBUSVERS}.tar.gz/download"
BUILDDIR="$(pwd)/build/dbus-${DBUSVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
export DBUSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_DBUS_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_DBUS_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_DBUS_CPPFLAGS}"
LIBS="${LIBS} ${KC_DBUS_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

if [ ! -f "${SRC}" ]; then
	mkdir 'src' >/dev/null 2>/dev/null

	if [ ! -d 'buildsrc' ]; then
		rm -f "${SRC}.tmp"

Modified itcl/build.sh from [66f0227cb2] to [c79eb69747].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
SRCURL="http://sourceforge.net/projects/incrtcl/files/%5BIncr%20Tcl_Tk%5D-source/${ITCLVERS}/itcl${ITCLVERS}${ITCLVERSEXTRA}.tar.gz/download"
BUILDDIR="$(pwd)/build/itcl${ITCLVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
export ITCLVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR

# Set configure options for this sub-project
LDFLAGS="${KC_ITCL_LDFLAGS}"
CFLAGS="${KC_ITCL_CFLAGS}"
CPPFLAGS="${KC_ITCL_CPPFLAGS}"
LIBS="${KC_ITCL_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

# Determine if Itcl is even needed
(







|
|
|
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
SRCURL="http://sourceforge.net/projects/incrtcl/files/%5BIncr%20Tcl_Tk%5D-source/${ITCLVERS}/itcl${ITCLVERS}${ITCLVERSEXTRA}.tar.gz/download"
BUILDDIR="$(pwd)/build/itcl${ITCLVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
export ITCLVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_ITCL_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_ITCL_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_ITCL_CPPFLAGS}"
LIBS="${LIBS} ${KC_ITCL_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

# Determine if Itcl is even needed
(

Modified kitcreator from [87e5c86889] to [de6501332a].

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
#! /usr/bin/env bash




# Determine appropriate mode
mode="build"
case "$1" in
	clean|distclean|build|retry)
		mode="$1"
		shift
		;;
esac

# Determine which Tcl version to build
TCLVERS="8.6.1"
if echo "$1" | grep '^[0-9][0-9]*\.' >/dev/null || echo "$1" | egrep '^(cvs|fossil)_' >/dev/null; then
	TCLVERS="$1"

	shift
fi
export TCLVERS

# Determine the two part Tcl version
TCLVERS2=$(echo ${TCLVERS} | cut -d. -f1,2)
export TCLVERS2

# Verify that "pre.sh" has been run if this is a development snapshot of
# KitCreator
if [ -f 'build/pre.sh' ]; then
	if ! find 'kitsh/buildsrc/' -name configure -type f 2>/dev/null | grep configure >/dev/null; then
		echo "Please remember to run 'build/pre.sh' if you expect this build to work." >&2
	fi
fi

# Define the list of all packages, for cleaning purposes
KITCREATOR_ALLPKGS="kitsh tcl tclvfs zlib tk itcl mk4tcl thread dbus"

# Always rebuild kitsh
rm -f "kitsh/.success"
for pkg in ${KITCREATOR_ALLPKGS}; do
	if [ "${mode}" != "retry" -o ! -f "${pkg}/.success" ]; then
		rm -f "${pkg}/build.log" "${pkg}/.success"
		rm -rf "${pkg}/out" "${pkg}/inst" "${pkg}/build"


>
>
>











|




















|
>







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
#! /usr/bin/env bash

# Clean variables which will interfere with the build
unset MAKEFLAGS DESTDIR

# Determine appropriate mode
mode="build"
case "$1" in
	clean|distclean|build|retry)
		mode="$1"
		shift
		;;
esac

# Determine which Tcl version to build
TCLVERS="8.6.2"
if echo "$1" | grep '^[0-9][0-9]*\.' >/dev/null || echo "$1" | egrep '^(cvs|fossil)_' >/dev/null; then
	TCLVERS="$1"

	shift
fi
export TCLVERS

# Determine the two part Tcl version
TCLVERS2=$(echo ${TCLVERS} | cut -d. -f1,2)
export TCLVERS2

# Verify that "pre.sh" has been run if this is a development snapshot of
# KitCreator
if [ -f 'build/pre.sh' ]; then
	if ! find 'kitsh/buildsrc/' -name configure -type f 2>/dev/null | grep configure >/dev/null; then
		echo "Please remember to run 'build/pre.sh' if you expect this build to work." >&2
	fi
fi

# Define the list of all packages, for cleaning purposes
KITCREATOR_ALLPKGS="kitsh tcl tclvfs zlib tk itcl mk4tcl thread dbus tls tclx tcc4tcl"

# Always rebuild kitsh
rm -f "kitsh/.success"
for pkg in ${KITCREATOR_ALLPKGS}; do
	if [ "${mode}" != "retry" -o ! -f "${pkg}/.success" ]; then
		rm -f "${pkg}/build.log" "${pkg}/.success"
		rm -rf "${pkg}/out" "${pkg}/inst" "${pkg}/build"

63
64
65
66
67
68
69



















70
71
72
73
74
75
76
CONFIGUREEXTRA="$@"
export CONFIGUREEXTRA

if echo " ${CONFIGUREEXTRA} " | grep ' --enable-threads' >/dev/null 2>/dev/null; then
	KITCREATOR_PKGS="${KITCREATOR_PKGS} thread"
fi




















# Set default target
KITTARGET="kitsh"
export KITTARGET

# Fix up package list
## If building KitDLL, define it as our target
if echo " ${KITCREATOR_PKGS} " | grep ' kitdll ' >/dev/null 2>/dev/null; then







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







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
CONFIGUREEXTRA="$@"
export CONFIGUREEXTRA

if echo " ${CONFIGUREEXTRA} " | grep ' --enable-threads' >/dev/null 2>/dev/null; then
	KITCREATOR_PKGS="${KITCREATOR_PKGS} thread"
fi

# Determine cross-compile status
host_os="$(echo " ${CONFIGUREEXTRA} " | sed 's@^.* --host=\([^ ]*\) .*$@\1@
t x
d
:x')"
build_os="$(echo " ${CONFIGUREEXTRA} " | sed 's@^.* --build=\([^ ]*\) .*$@\1@
t x
d
:x')"

if [ "${host_os}" != "${build_os}" -a -n "${host_os}" ]; then
	KC_CROSSCOMPILE='1'
	KC_CROSSCOMPILE_HOST_OS="${host_os}"
else
	KC_CROSSCOMPILE='0'
	KC_CROSSCOMPILE_HOST_OS=''
fi
export KC_CROSSCOMPILE KC_CROSSCOMPILE_HOST_OS

# Set default target
KITTARGET="kitsh"
export KITTARGET

# Fix up package list
## If building KitDLL, define it as our target
if echo " ${KITCREATOR_PKGS} " | grep ' kitdll ' >/dev/null 2>/dev/null; then

Modified kitsh/build.sh from [644f3a91bd] to [0084e3a935].

21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
OTHERPKGSDIR="$(pwd)/../"
export KITSHVERS BUILDDIR OUTDIR INSTDIR OTHERPKGSDIR

# Set configure options for this sub-project
LDFLAGS_ADD="${KC_KITSH_LDFLAGS_ADD}"
LDFLAGS="${KC_KITSH_LDFLAGS}"
CFLAGS="${KC_KITSH_CFLAGS}"
CPPFLAGS="${KC_KITSH_CPPFLAGS}"
LIBS="${KC_KITSH_LIBS}"
export LDFLAGS_ADD LDFLAGS CFLAGS CPPFLAGS LIBS

if [ -z "${ENABLECOMPRESSION}" ]; then
	ENABLECOMPRESSION="1"
fi
export ENABLECOMPRESSION








|
|
|
|







21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
OTHERPKGSDIR="$(pwd)/../"
export KITSHVERS BUILDDIR OUTDIR INSTDIR OTHERPKGSDIR

# Set configure options for this sub-project
LDFLAGS_ADD="${KC_KITSH_LDFLAGS_ADD}"
LDFLAGS="${LDFLAGS} ${KC_KITSH_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_KITSH_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_KITSH_CPPFLAGS}"
LIBS="${LIBS} ${KC_KITSH_LIBS}"
export LDFLAGS_ADD LDFLAGS CFLAGS CPPFLAGS LIBS

if [ -z "${ENABLECOMPRESSION}" ]; then
	ENABLECOMPRESSION="1"
fi
export ENABLECOMPRESSION

198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217






218
219
220
221
222
223
224
225
226
227
228
229
230
	## Determine if we have a Tclkit to do this work
	TCLKIT="${TCLKIT:-tclkit}"
	if echo 'exit 0' | "${TCLKIT}" >/dev/null 2>/dev/null; then
		## Install using existing Tclkit
		### Call installer
		echo "Running: \"${TCLKIT}\" installvfs.tcl \"${KITTARGET_NAME}\" starpack.vfs \"${ENABLECOMPRESSION}\""
		"${TCLKIT}" installvfs.tcl "${KITTARGET_NAME}" starpack.vfs "${ENABLECOMPRESSION}" || exit 1
	else
		## Bootstrap (cannot cross-compile)
		### Call installer
		cp kit runkit
		echo "set argv [list {${KITTARGET_NAME}} starpack.vfs {${ENABLECOMPRESSION}}]" > setup.tcl
		echo 'if {[catch { clock seconds }]} { proc clock args { return 0 } }' >> setup.tcl
		echo 'source installvfs.tcl' >> setup.tcl

		TCL_LIBRARY="$(pwd)/starpack.vfs/lib/tcl${TCLVERS2}"
		export TCL_LIBRARY

		echo 'Running: echo | ./runkit setup.tcl'
		echo | ./runkit setup.tcl || exit 1






	fi

	# Cleanup
	if [ "${KITTARGET}" = "kitdll" ]; then
		## Remove built interpreters if we are building KitDLL --
		## they're just tiny stubs anyway
		rm -f kit runkit
	fi

	exit 0
) || exit 1

exit 0







|












>
>
>
>
>
>













198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
	## Determine if we have a Tclkit to do this work
	TCLKIT="${TCLKIT:-tclkit}"
	if echo 'exit 0' | "${TCLKIT}" >/dev/null 2>/dev/null; then
		## Install using existing Tclkit
		### Call installer
		echo "Running: \"${TCLKIT}\" installvfs.tcl \"${KITTARGET_NAME}\" starpack.vfs \"${ENABLECOMPRESSION}\""
		"${TCLKIT}" installvfs.tcl "${KITTARGET_NAME}" starpack.vfs "${ENABLECOMPRESSION}" || exit 1
	elif echo 'exit 0' | ./kit >/dev/null 2>/dev/null; then
		## Bootstrap (cannot cross-compile)
		### Call installer
		cp kit runkit
		echo "set argv [list {${KITTARGET_NAME}} starpack.vfs {${ENABLECOMPRESSION}}]" > setup.tcl
		echo 'if {[catch { clock seconds }]} { proc clock args { return 0 } }' >> setup.tcl
		echo 'source installvfs.tcl' >> setup.tcl

		TCL_LIBRARY="$(pwd)/starpack.vfs/lib/tcl${TCLVERS2}"
		export TCL_LIBRARY

		echo 'Running: echo | ./runkit setup.tcl'
		echo | ./runkit setup.tcl || exit 1
	else
		## Install using Tclsh, which may work if we're not using Metakit
		### Call installer
		echo "Running: \"${TCLSH_NATIVE}\" installvfs.tcl \"${KITTARGET_NAME}\" starpack.vfs \"${ENABLECOMPRESSION}\""
		"${TCLSH_NATIVE}" installvfs.tcl "${KITTARGET_NAME}" starpack.vfs "${ENABLECOMPRESSION}" || exit 1
		
	fi

	# Cleanup
	if [ "${KITTARGET}" = "kitdll" ]; then
		## Remove built interpreters if we are building KitDLL --
		## they're just tiny stubs anyway
		rm -f kit runkit
	fi

	exit 0
) || exit 1

exit 0

Modified kitsh/buildsrc/kitsh-0.0/aclocal.m4 from [0e91c1e1fd] to [4e978303f9].

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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
	DC_CHECK_FOR_WHOLE_ARCHIVE

	echo '/* Dynamically generated. */' > kitInit-libs.h
	libs_init_funcs=""

	for projdir in ../../../*/; do
		proj="`basename "${projdir}"`"


		if test "${proj}" = "build"; then
			continue
		fi

		if test "${proj}" = "kitsh"; then
			continue
		fi





		projlibdir="../../../${proj}/inst"

		if test -d "${projlibdir}"; then
			true
		else
			continue
		fi

		AC_MSG_CHECKING([for libraries required for ${proj}])

		projlibfiles="`find "${projlibdir}" -name '*.a' 2>/dev/null | sort | tr "\n" ' '`"






		projlibfilesnostub="`find "${projlibdir}" -name '*.a' 2>/dev/null | grep -v 'stub' | tr "\n" ' '`"

		projlibextra=""









		for libfile in ${projlibfilesnostub}; do
			if test -f "${libfile}.linkadd"; then
				projlibextra="`cat "${libfile}.linkadd"`"
			fi
		done

		AC_MSG_RESULT([${projlibfilesnostub} ${projlibextra}])

		hide_symbols="1"
		initialize="1"

		if test "${proj}" = "tcl"; then
			DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $projlibfilesnostub], [
				projlibfiles="${projlibfilesnostub}"
			], [
				DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $projlibfiles], [
					projlibfiles="${projlibfiles}"
				])
			])

			hide_symbols="0"
			initialize="0"
		fi

		if test "${proj}" = "mk4tcl"; then
			if test -n "${projlibfiles}"; 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

			initialize="0"
		fi

		if test "${proj}" = "tk"; then
			if test "${projlibfilesnostub}" != ""; then
				DC_DO_TK
				AC_DEFINE(KIT_INCLUDES_TK, [1], [Specify this if we link statically to Tk])
				if test -n "${TK_VERSION}"; then







>








>
>
>
>











|
>
>
>
>
>
>
|
>

>
>
>
>
>
>
>
>










<











|











|







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
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225

226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
	DC_CHECK_FOR_WHOLE_ARCHIVE

	echo '/* Dynamically generated. */' > kitInit-libs.h
	libs_init_funcs=""

	for projdir in ../../../*/; do
		proj="`basename "${projdir}"`"
		subprojs="$proj"

		if test "${proj}" = "build"; then
			continue
		fi

		if test "${proj}" = "kitsh"; then
			continue
		fi

		if test "${proj}" = "common"; then
			continue
		fi

		projlibdir="../../../${proj}/inst"

		if test -d "${projlibdir}"; then
			true
		else
			continue
		fi

		AC_MSG_CHECKING([for libraries required for ${proj}])

		projlibfiles="`find "${projlibdir}" -name '*.a' 2>/dev/null | sort`"
		projexcludefile="${projlibdir}/kitcreator-nolibs"
		if test -e "${projexcludefile}"; then
			projexclude="`cat "$projexcludefile"`"
			projlibfiles="`echo "$projlibfiles" | egrep -v "$projexclude"`"
		fi

		projlibfilesnostub="`echo "$projlibfiles" | grep -v 'stub' | tr "\n" ' '`"
		projlibfiles="`echo "$projlibfiles" | tr "\n" ' '`"
		projlibextra=""

		if test "$projlibfilesnostub" = ' '; then
			projlibfilesnostub=''
		fi

		if test "$projlibfiles" = ' '; then
			projlibfiles=''
		fi

		for libfile in ${projlibfilesnostub}; do
			if test -f "${libfile}.linkadd"; then
				projlibextra="`cat "${libfile}.linkadd"`"
			fi
		done

		AC_MSG_RESULT([${projlibfilesnostub} ${projlibextra}])

		hide_symbols="1"


		if test "${proj}" = "tcl"; then
			DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $projlibfilesnostub], [
				projlibfiles="${projlibfilesnostub}"
			], [
				DC_TEST_WHOLE_ARCHIVE_SHARED_LIB([$ARCHS $projlibfiles], [
					projlibfiles="${projlibfiles}"
				])
			])

			hide_symbols="0"
			subprojs="`echo " $projlibfilesnostub " | sed 's@ [[^ ]]*/@ @g;s@ lib@ @g;s@[[0-9\.]]*\.a@ @g;s@ tdbc[[^ ]]*@ @g;s@ sqlite @ sqlite3 @;s@ tcldde[[0-9]][[0-9]]*s*g* @ @g;s@ tclreg[[0-9]][[0-9]]*s*g* @ @g;s@ tcl[[0-9]]*s*g* @ @g;s@^ *@@;s@ *[$]@@'`"
		fi

		if test "${proj}" = "mk4tcl"; then
			if test -n "${projlibfiles}"; 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

			subprojs=""
		fi

		if test "${proj}" = "tk"; then
			if test "${projlibfilesnostub}" != ""; then
				DC_DO_TK
				AC_DEFINE(KIT_INCLUDES_TK, [1], [Specify this if we link statically to Tk])
				if test -n "${TK_VERSION}"; then
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
						projlibfiles="${projlibfiles}"
					])
				])

				hide_symbols="0"
			fi

			initialize="0"
		fi

		if test "${proj}" = "tclvfs"; then
			initialize="0"
		fi

		if test "${hide_symbols}" = "1"; then
			STRIPLIBS="${STRIPLIBS} ${projlibfiles}"
		fi

		dnl Do not explicitly link to Zlib, that will happen elsewhere
		if test "${proj}" = "zlib"; then
			continue
		fi

		if test "${initialize}" = "1"; then
			if test -n "${projlibfilesnostub}"; then

				projucase="`echo ${proj} | dd conv=ucase 2>/dev/null`"
				projtcase="`echo ${projucase} | cut -c 1``echo ${proj} | cut -c 2-`"
				lib_init_func="${projtcase}_Init"

				echo "#define KIT_INCLUDES_${projucase}" >> kitInit-libs.h
				echo "Tcl_AppInitProc ${lib_init_func};" >> kitInit-libs.h

				libs_init_funcs="${libs_init_funcs} ${lib_init_func}"

			fi
		fi

		ARCHS="${ARCHS} ${projlibfiles}"
		LIBS="${LIBS} ${projlibextra}"
	done








|



|











|

>
|
|
|

|
|

|
>







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
303
304
305
306
307
308
309
310
						projlibfiles="${projlibfiles}"
					])
				])

				hide_symbols="0"
			fi

			subprojs=""
		fi

		if test "${proj}" = "tclvfs"; then
			subprojs=""
		fi

		if test "${hide_symbols}" = "1"; then
			STRIPLIBS="${STRIPLIBS} ${projlibfiles}"
		fi

		dnl Do not explicitly link to Zlib, that will happen elsewhere
		if test "${proj}" = "zlib"; then
			continue
		fi

		if test -n "${subprojs}"; then
			if test -n "${projlibfilesnostub}"; then
				for subproj in $subprojs; do
					subprojucase="`echo ${subproj} | dd conv=ucase 2>/dev/null`"
					subprojtcase="`echo ${subprojucase} | cut -c 1``echo ${subproj} | cut -c 2-`"
					lib_init_func="${subprojtcase}_Init"

					echo "#define KIT_INCLUDES_${subprojucase}" >> kitInit-libs.h
					echo "Tcl_AppInitProc ${lib_init_func};" >> kitInit-libs.h

					libs_init_funcs="${libs_init_funcs} ${lib_init_func}"
				done
			fi
		fi

		ARCHS="${ARCHS} ${projlibfiles}"
		LIBS="${LIBS} ${projlibextra}"
	done

Modified kitsh/buildsrc/kitsh-0.0/config.sub from [8fedd9524f] to [c46c874230].

118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
    exit 1;;
esac

# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
  nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
  knetbsd*-gnu* | netbsd*-gnu* | \
  kopensolaris*-gnu* | \
  storm-chaos* | os2-emx* | rtmk-nova*)
    os=-$maybe_os
    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
    ;;







|







118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
    exit 1;;
esac

# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
  nto-qnx* | linux-gnu* | linux-musl | linux-android* | linux-dietlibc | linux-newlib* | \
  linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
  knetbsd*-gnu* | netbsd*-gnu* | \
  kopensolaris*-gnu* | \
  storm-chaos* | os2-emx* | rtmk-nova*)
    os=-$maybe_os
    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
    ;;

Modified kitsh/buildsrc/kitsh-0.0/install-sh from [6381bb24b0] to [06ee6336e6].

1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
# install - install a program, script, or datafile

scriptversion=2010-02-06.18; # UTC

# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#



|







1
2
3
4
5
6
7
8
9
10
11
#!/bin/sh
# install - install a program, script, or datafile

scriptversion=2011-01-19.21; # UTC

# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
152
153
154
155
156
157
158




159
160
161
162
163
164
165

    -o) chowncmd="$chownprog $2"
	shift;;

    -s) stripcmd=$stripprog;;

    -t) dst_arg=$2




	shift;;

    -T) no_target_directory=true;;

    --version) echo "$0 $scriptversion"; exit $?;;

    --)	shift







>
>
>
>







152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169

    -o) chowncmd="$chownprog $2"
	shift;;

    -s) stripcmd=$stripprog;;

    -t) dst_arg=$2
	# Protect names problematic for `test' and other utilities.
	case $dst_arg in
	  -* | [=\(\)!]) dst_arg=./$dst_arg;;
	esac
	shift;;

    -T) no_target_directory=true;;

    --version) echo "$0 $scriptversion"; exit $?;;

    --)	shift
182
183
184
185
186
187
188




189
190
191
192
193
194
195
    if test -n "$dst_arg"; then
      # $@ is not empty: it contains at least $arg.
      set fnord "$@" "$dst_arg"
      shift # fnord
    fi
    shift # arg
    dst_arg=$arg




  done
fi

if test $# -eq 0; then
  if test -z "$dir_arg"; then
    echo "$0: no input file specified." >&2
    exit 1







>
>
>
>







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
    if test -n "$dst_arg"; then
      # $@ is not empty: it contains at least $arg.
      set fnord "$@" "$dst_arg"
      shift # fnord
    fi
    shift # arg
    dst_arg=$arg
    # Protect names problematic for `test' and other utilities.
    case $dst_arg in
      -* | [=\(\)!]) dst_arg=./$dst_arg;;
    esac
  done
fi

if test $# -eq 0; then
  if test -z "$dir_arg"; then
    echo "$0: no input file specified." >&2
    exit 1
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
      fi
      cp_umask=$mode$u_plus_rw;;
  esac
fi

for src
do
  # Protect names starting with `-'.
  case $src in
    -*) src=./$src;;
  esac

  if test -n "$dir_arg"; then
    dst=$src
    dstdir=$dst
    test -d "$dstdir"
    dstdir_status=$?







|

|







236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
      fi
      cp_umask=$mode$u_plus_rw;;
  esac
fi

for src
do
  # Protect names problematic for `test' and other utilities.
  case $src in
    -* | [=\(\)!]) src=./$src;;
  esac

  if test -n "$dir_arg"; then
    dst=$src
    dstdir=$dst
    test -d "$dstdir"
    dstdir_status=$?
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
      exit 1
    fi

    if test -z "$dst_arg"; then
      echo "$0: no destination specified." >&2
      exit 1
    fi

    dst=$dst_arg
    # Protect names starting with `-'.
    case $dst in
      -*) dst=./$dst;;
    esac

    # If destination is a directory, append the input filename; won't work
    # if double slashes aren't ignored.
    if test -d "$dst"; then
      if test -n "$no_target_directory"; then
	echo "$0: $dst_arg: Is a directory" >&2
	exit 1







<

<
<
<
<







260
261
262
263
264
265
266

267




268
269
270
271
272
273
274
      exit 1
    fi

    if test -z "$dst_arg"; then
      echo "$0: no destination specified." >&2
      exit 1
    fi

    dst=$dst_arg





    # If destination is a directory, append the input filename; won't work
    # if double slashes aren't ignored.
    if test -d "$dst"; then
      if test -n "$no_target_directory"; then
	echo "$0: $dst_arg: Is a directory" >&2
	exit 1
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417

      # The umask is ridiculous, or mkdir does not conform to POSIX,
      # or it failed possibly due to a race condition.  Create the
      # directory the slow way, step by step, checking for races as we go.

      case $dstdir in
	/*) prefix='/';;
	-*) prefix='./';;
	*)  prefix='';;
      esac

      eval "$initialize_posix_glob"

      oIFS=$IFS
      IFS=/
      $posix_glob set -f
      set fnord $dstdir
      shift
      $posix_glob set +f
      IFS=$oIFS

      prefixes=

      for d
      do
	test -z "$d" && continue

	prefix=$prefix$d
	if test -d "$prefix"; then
	  prefixes=
	else
	  if $posix_mkdir; then
	    (umask=$mkdir_umask &&







|

















|







388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420

      # The umask is ridiculous, or mkdir does not conform to POSIX,
      # or it failed possibly due to a race condition.  Create the
      # directory the slow way, step by step, checking for races as we go.

      case $dstdir in
	/*) prefix='/';;
	[-=\(\)!]*) prefix='./';;
	*)  prefix='';;
      esac

      eval "$initialize_posix_glob"

      oIFS=$IFS
      IFS=/
      $posix_glob set -f
      set fnord $dstdir
      shift
      $posix_glob set +f
      IFS=$oIFS

      prefixes=

      for d
      do
	test X"$d" = X && continue

	prefix=$prefix$d
	if test -d "$prefix"; then
	  prefixes=
	else
	  if $posix_mkdir; then
	    (umask=$mkdir_umask &&

Modified kitsh/buildsrc/kitsh-0.0/kitInit.c from [9995cd87d7] to [8905d676cc].

99
100
101
102
103
104
105






106
107
108
109
110
111
112
#      else
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow);
#      endif /* _WIN32_WCE */
#    endif /* KITSH_NEED_WINMAIN */
int main(int argc, char **argv);
#  endif /* HAVE_ACCEPTABLE_DLADDR */
#endif /* !TCLKIT_DLL */







#ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME
char *tclExecutableName;
#endif

/*
 *  Attempt to load a "boot.tcl" entry from the embedded MetaKit file.







>
>
>
>
>
>







99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#      else
int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow);
#      endif /* _WIN32_WCE */
#    endif /* KITSH_NEED_WINMAIN */
int main(int argc, char **argv);
#  endif /* HAVE_ACCEPTABLE_DLADDR */
#endif /* !TCLKIT_DLL */

#ifdef TCLKIT_DLL
void __attribute__((constructor)) _Tclkit_Init(void);
#else
static void _Tclkit_Init(void);
#endif

#ifdef TCLKIT_REQUIRE_TCLEXECUTABLENAME
char *tclExecutableName;
#endif

/*
 *  Attempt to load a "boot.tcl" entry from the embedded MetaKit file.
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
	"catch { load {} vfs }\n"
#ifdef KIT_INCLUDES_ZLIB
	"catch { load {} zlib }\n"
#endif
#ifdef KIT_INCLUDES_MK4TCL
	"catch { load {} Mk4tcl }\n"
#endif
#ifdef TCLKIT_DLL
	"load {} tclkit::init\n"
	"::tclkit::init::initInterp\n"
	"rename ::tclkit::init::initInterp {}\n"
#endif /* TCLKIT_DLL */
	"set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n"
	"if {[file exists $bootfile]} {\n"
		"catch {\n"
			"set f [open $bootfile]\n"
			"set s [read $f]\n"
			"close $f\n"
		"}\n"







<



<







145
146
147
148
149
150
151

152
153
154

155
156
157
158
159
160
161
	"catch { load {} vfs }\n"
#ifdef KIT_INCLUDES_ZLIB
	"catch { load {} zlib }\n"
#endif
#ifdef KIT_INCLUDES_MK4TCL
	"catch { load {} Mk4tcl }\n"
#endif

	"load {} tclkit::init\n"
	"::tclkit::init::initInterp\n"
	"rename ::tclkit::init::initInterp {}\n"

	"set bootfile [file join " TCLKIT_MOUNTPOINT " boot.tcl]\n"
	"if {[file exists $bootfile]} {\n"
		"catch {\n"
			"set f [open $bootfile]\n"
			"set s [read $f]\n"
			"close $f\n"
		"}\n"
392
393
394
395
396
397
398





399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
#endif /* TCLKIT_CAN_SET_ENCODING */

	/* Hack to get around Tcl bug 1224888.  This must be run here and
	 * in LibraryPathObjCmd because this information is needed both
	 * before and after that command is run. */
	FindAndSetExecName(interp);






	return;
}

#ifndef TCLKIT_DLL
int TclKit_AppInit(Tcl_Interp *interp) {
#ifdef KIT_INCLUDES_TK
#  ifdef _WIN32
#    ifndef _WIN32_WCE
	char msgBuf[2049];
#    endif /* !_WIN32_WCE */
#  endif /* _WIN32 */
#endif /* KIT_INCLUDES_TK */

	/* Perform common initialization */
	_Tclkit_Generic_Init();

	_Tclkit_Interp_Init(interp);

	if (Tcl_Init(interp) == TCL_ERROR) {
		goto error;
	}

#ifdef KIT_INCLUDES_TK
#  ifdef _WIN32







>
>
>
>
>














<
<
|







396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421


422
423
424
425
426
427
428
429
#endif /* TCLKIT_CAN_SET_ENCODING */

	/* Hack to get around Tcl bug 1224888.  This must be run here and
	 * in LibraryPathObjCmd because this information is needed both
	 * before and after that command is run. */
	FindAndSetExecName(interp);

#if defined(_WIN32) && defined(KIT_INCLUDES_TK)
	/* Every interpreter needs this done */
	Tk_InitConsoleChannels(interp);
#endif /* _WIN32 and KIT_INCLUDES_TK */

	return;
}

#ifndef TCLKIT_DLL
int TclKit_AppInit(Tcl_Interp *interp) {
#ifdef KIT_INCLUDES_TK
#  ifdef _WIN32
#    ifndef _WIN32_WCE
	char msgBuf[2049];
#    endif /* !_WIN32_WCE */
#  endif /* _WIN32 */
#endif /* KIT_INCLUDES_TK */

	/* Perform common initialization */


	_Tclkit_Init();

	if (Tcl_Init(interp) == TCL_ERROR) {
		goto error;
	}

#ifdef KIT_INCLUDES_TK
#  ifdef _WIN32
510
511
512
513
514
515
516



517
518
519
520
521
522
523
	if (gmfn_ret != 0) {
		return(strdup(modulename));
	}
#endif /* _WIN32 */

	return(NULL);
}




/*
 * This function exists to allow C code to initialize a particular
 * interpreter.
 */
static int tclkit_init_initinterp(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	char *kitdll_path;







>
>
>







517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
	if (gmfn_ret != 0) {
		return(strdup(modulename));
	}
#endif /* _WIN32 */

	return(NULL);
}
#else
# define find_tclkit_dll_path() NULL
#endif

/*
 * This function exists to allow C code to initialize a particular
 * interpreter.
 */
static int tclkit_init_initinterp(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	char *kitdll_path;
554
555
556
557
558
559
560

561



562
563
564
565
566
567
568
	return(tclPkgProv_ret);
}

/*
 * Initialize the Tcl system when we are loaded, that way Tcl functions
 * are ready to be used when invoked.
 */

void __attribute__((constructor)) _Tclkit_Init(void) {



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

	_Tclkit_Generic_Init();

	return;
}
#endif







>

>
>
>






<
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581

	return(tclPkgProv_ret);
}

/*
 * Initialize the Tcl system when we are loaded, that way Tcl functions
 * are ready to be used when invoked.
 */
#ifdef TCLKIT_DLL
void __attribute__((constructor)) _Tclkit_Init(void) {
#else
static void _Tclkit_Init(void) {
#endif
	Tcl_StaticPackage(0, "tclkit::init", Tclkit_init_Init, NULL);

	_Tclkit_Generic_Init();

	return;
}

Modified mk4tcl/build.sh from [a7ae1d5383] to [b69a612055].

17
18
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33
34
BUILDDIR="$(pwd)/build/metakit-${MK4VERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export MK4VERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${KC_MK4TCL_LDFLAGS}"
CFLAGS="${KC_MK4TCL_CFLAGS}"

CPPFLAGS="${KC_MK4TCL_CPPFLAGS}"
LIBS="${KC_MK4TCL_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

TCL_VERSION="unknown"
if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then







|
|
>
|
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
BUILDDIR="$(pwd)/build/metakit-${MK4VERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export MK4VERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_MK4TCL_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_MK4TCL_CFLAGS}"
CXXFLAGS="${CXXFLAGS} ${KC_MK4TCL_CXXFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_MK4TCL_CPPFLAGS}"
LIBS="${LIBS} ${KC_MK4TCL_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

TCL_VERSION="unknown"
if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then

Added mk4tcl/patches/all/metakit-2.4.9.7-fix3264.diff version [cbea8b0f9a].









































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
diff -uNr metakit-2.4.9.7.orig/include/mk4.h metakit-2.4.9.7-1fix3264/include/mk4.h
--- metakit-2.4.9.7.orig/include/mk4.h	2007-06-15 19:23:25.000000000 -0500
+++ metakit-2.4.9.7-1fix3264/include/mk4.h	2014-05-20 19:45:24.000000000 -0500
@@ -9,6 +9,8 @@
 #ifndef __MK4_H__
 #define __MK4_H__
 
+#include <stdint.h>
+
 //---------------------------------------------------------------------------
 //
 //  TITLE
@@ -199,11 +201,7 @@
 
 typedef unsigned char t4_byte; // create typedefs for t4_byte, etc.
 
-#if q4_LONG64
-typedef int t4_i32; // if longs are 64b, then int must be 32b
-#else 
-typedef long t4_i32; // if longs aren't 64b, then they are 32b
-#endif 
+typedef int32_t t4_i32;
 
 #if q4_LONG64           // choose a way to represent 64b integers
 typedef long t4_i64;
diff -uNr metakit-2.4.9.7.orig/src/header.h metakit-2.4.9.7-1fix3264/src/header.h
--- metakit-2.4.9.7.orig/src/header.h	2007-03-09 09:58:53.000000000 -0600
+++ metakit-2.4.9.7-1fix3264/src/header.h	2014-05-20 19:40:12.000000000 -0500
@@ -13,6 +13,10 @@
 
 #include "config.h"
 
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+
 /////////////////////////////////////////////////////////////////////////////
 // A number of preprocessor options are used in the source code
 //
@@ -139,11 +143,7 @@
 
 typedef unsigned char t4_byte; // create typedefs for t4_byte, etc.
 
-#if SIZEOF_LONG == 8
-typedef int t4_i32; // longs are 64b, so int must be 32b
-#else 
-typedef long t4_i32; // longs aren't 64b, so they are 32b
-#endif 
+typedef int32_t t4_i32;
 
 /////////////////////////////////////////////////////////////////////////////
 // Include header files which contain additional os/cpu/ide/fw specifics

Added mk4tcl/patches/all/metakit-2.4.9.7-unregisterchans.diff version [f20391d2c6].





























>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
diff -uNr metakit-2.4.9.7.orig/tcl/mk4tcl.cpp metakit-2.4.9.7-1unregisterchans/tcl/mk4tcl.cpp
--- metakit-2.4.9.7.orig/tcl/mk4tcl.cpp	2007-06-18 16:05:24.000000000 -0500
+++ metakit-2.4.9.7-1unregisterchans/tcl/mk4tcl.cpp	2014-05-20 00:55:56.857516999 -0500
@@ -737,6 +737,10 @@
 MkWorkspace::~MkWorkspace() {
   CleanupCommands();
 
+  for (MkChannel *chan = _chanList; chan; chan = chan->_next) {
+    Tcl_UnregisterChannel(_interp, chan->_chan);
+  }
+
   for (int i = _items.GetSize(); --i >= 0;)
     delete Nth(i);
 

Added tcc4tcl/build.sh version [ae573dea00].

















































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
#! /usr/bin/env bash

if [ ! -f 'build.sh' ]; then
	echo 'ERROR: This script must be run from the directory it is in' >&2

	exit 1
fi
if [ -z "${TCLVERS}" ]; then
	echo 'ERROR: The TCLVERS environment variable is not set' >&2

	exit 1
fi

TCC4TCLVERS="0.22"
SRC="src/tcc4tcl-${TCC4TCLVERS}.tar.gz"
SRCURL="http://rkeene.org/devel/tcc4tcl/tcc4tcl-${TCC4TCLVERS}.tar.gz"
BUILDDIR="$(pwd)/build/tcc4tcl-${TCC4TCLVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export TCC4TCLVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_TCC4TCL_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_TCC4TCL_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_TCC4TCL_CPPFLAGS}"
LIBS="${LIBS} ${KC_TCC4TCL_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

TCL_VERSION="unknown"
if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then
        source "${TCLCONFIGDIR}/tclConfig.sh"
fi
export TCL_VERSION

if [ ! -f "${SRC}" ]; then
	mkdir 'src' >/dev/null 2>/dev/null

	if [ ! -d 'buildsrc' ]; then
		rm -f "${SRC}.tmp"
		wget -O "${SRC}.tmp" "${SRCURL}" || exit 1
		mv "${SRC}.tmp" "${SRC}"
	fi
fi

(
	cd 'build' || exit 1

	if [ ! -d '../buildsrc' ]; then
		gzip -dc "../${SRC}" | tar -xf -
	else    
		cp -rp ../buildsrc/* './'
	fi

	# Apply required patches
	cd "${BUILDDIR}" || exit 1

	for patch in "${PATCHDIR}/all"/tcc4tcl-${TCC4TCLVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tcc4tcl-${TCC4TCLVERS}-*.diff; do
		if [ ! -f "${patch}" ]; then
			continue
		fi

		echo "Applying: ${patch}"
		${PATCH:-patch} -p1 < "${patch}"
	done

	# Try to build as a shared object if requested
	if [ "${STATICTCC4TCL}" = "0" ]; then
		tryopts="--enable-shared --disable-shared"
	elif [ "${STATICTCC4TCL}" = "-1" ]; then
		# Require shared object if requested
		tryopts="--enable-shared"
	else
		# Default to building statically
		tryopts="--disable-shared"
	fi

	if echo " ${CONFIGUREEXTRA} " | grep ' --disable-load ' >/dev/null; then
		dlopen_flag="--with-dlopen"
	else
		dlopen_flag="--without-dlopen"
	fi

	SAVE_CFLAGS="${CFLAGS}"
	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

		# If build a static tcc4tcl for KitDLL, ensure that we use PIC
		# so that it can be linked into the shared object
		if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then
			CFLAGS="${SAVE_CFLAGS} -fPIC"
		else
			CFLAGS="${SAVE_CFLAGS}"
		fi

		(
			echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${dlopen_flag} ${CONFIGUREEXTRA}"
			./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${dlopen_flag} ${CONFIGUREEXTRA}

			echo "Running: ${MAKE:-make}"
			${MAKE:-make} || exit 1

			echo "Running: ${MAKE:-make} install"
			${MAKE:-make} install || exit 1
		) || continue

		break
	done

	# Create VFS-insert
	cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1
	find "${OUTDIR}" -name '*.a' -type f | grep -v '/libtcc1\.a$' | xargs rm -f

	# Tell Kitsh not to try to link against "libtcc1.a"
	echo "/libtcc1\.a" > "${INSTDIR}/kitcreator-nolibs"

	exit 0
) || exit 1

exit 0

Modified tcl/build.sh from [21af131d5c] to [a0fc7f495f].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHSCRIPTDIR="$(pwd)/patchscripts"
PATCHDIR="$(pwd)/patches"
export SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${KC_TCL_LDFLAGS}"
CFLAGS="${KC_TCL_CFLAGS}"
CPPFLAGS="${KC_TCL_CPPFLAGS}"
LIBS="${KC_TCL_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

if [ ! -f "${SRC}" ]; then
	mkdir 'src' >/dev/null 2>/dev/null







|
|
|
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHSCRIPTDIR="$(pwd)/patchscripts"
PATCHDIR="$(pwd)/patches"
export SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_TCL_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_TCL_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_TCL_CPPFLAGS}"
LIBS="${LIBS} ${KC_TCL_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

if [ ! -f "${SRC}" ]; then
	mkdir 'src' >/dev/null 2>/dev/null
197
198
199
200
201
202
203










204

205
206


207
208
209
210
211
212
213
214
215
216
217
218
219
220
221

222
223
224
225
226
227
228
			(
				. "${patchscript}"
			)
		fi
	done

	tryfirstdir=''










	if [ "$(uname -s)" = "Darwin" ]; then

		tryfirstdir='macosx'
	fi



	for dir in "${tryfirstdir}" unix win macosx __fail__; do
		if [ -z "${dir}" ]; then
			continue
		fi

		if [ "${dir}" = "__fail__" ]; then
			# If we haven't figured out how to build it, reject.

			exit 1
		fi

		# Remove previous directory's "tclConfig.sh" if found
		rm -f 'tclConfig.sh'


		cd "${BUILDDIR}/${dir}" || exit 1

		# Remove broken pre-generated Makfiles
		rm -f GNUmakefile Makefile makefile

		echo "Running: ./configure --disable-shared --with-encoding=utf-8 --prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" ${CONFIGUREEXTRA}"
		./configure --disable-shared --with-encoding=utf-8 --prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" ${CONFIGUREEXTRA}







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














>







197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
			(
				. "${patchscript}"
			)
		fi
	done

	tryfirstdir=''
	case "${KC_CROSSCOMPILE_HOST_OS}" in
		*-*-darwin*)
			# Cross-compiling for Mac OS X -- try to build macosx directory first
			tryfirstdir='macosx'
			;;
		*-*-*)
			# Cross-compiling, do not assume based on build platform
			;;
		'')
			# Not cross-compiling, assume based on build platform
			if [ "$(uname -s)" = "Darwin" ]; then
				# Compiling for Mac OS X, build in that directory first
				tryfirstdir='macosx'
			fi
			;;
	esac
		
	for dir in "${tryfirstdir}" unix win macosx __fail__; do
		if [ -z "${dir}" ]; then
			continue
		fi

		if [ "${dir}" = "__fail__" ]; then
			# If we haven't figured out how to build it, reject.

			exit 1
		fi

		# Remove previous directory's "tclConfig.sh" if found
		rm -f 'tclConfig.sh'

		echo "Working in: $dir"
		cd "${BUILDDIR}/${dir}" || exit 1

		# Remove broken pre-generated Makfiles
		rm -f GNUmakefile Makefile makefile

		echo "Running: ./configure --disable-shared --with-encoding=utf-8 --prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" ${CONFIGUREEXTRA}"
		./configure --disable-shared --with-encoding=utf-8 --prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" ${CONFIGUREEXTRA}

Added tcl/patchscripts/fix-crosscompile.sh version [ccf6b480eb].































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
137
138
139
140
141
142
143
#! /bin/bash

if [ "${KC_CROSSCOMPILE}" != '1' ]; then
	exit 0
fi

mkdir fake-bin

cat << \_EOF_ > fake-bin/fake-uname
#! /bin/bash

if [ "$1" == "--fake" ]; then
	echo "true"

	exit 0
fi

if [ -z "${KC_CROSSCOMPILE_HOST_OS}" ]; then
	# If not cross compiling, revert to system uname
	while [ "$(uname --fake 2>/dev/null)" == "true" -a -n "${PATH}" ]; do
		PATH="$(echo "${PATH}" | sed 's@^[^:]*$@@;s@^[^:]*:@@')"

		export PATH
	done

	if [ -z "${PATH}" ]; then
		exit 1
	fi

	exec uname "$@"
fi

# Determine release information
case "${KC_CROSSCOMPILE_HOST_OS}" in
	*-hpux11*)
		sysname="HP-UX"
		sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-hpux@@')"
		;;
	*-solaris2*)
		sysname="SunOS"
		sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-solaris@@;s@^2@5@')"
		;;
	*-linux*)
		sysname="Linux"
		sysrelease="2.6.5"
		;;
	*-netbsd*)
		sysname="NetBSD"
		sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-netbsd@@;s@$@.0@')"
		;;
	*-freebsd*)
		sysname="FreeBSD"
		sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@^.*-freebsd@@;s@$@.0-RELEASE@')"
		;;
	*-aix[0-9].*)
		sysname="AIX"
		sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@.*-aix\([0-9]\..*\)@\1@')"
		;;
	*-*-darwin*)
		sysname="Darwin"
		sysrelease="$(echo "${KC_CROSSCOMPILE_HOST_OS}" | sed 's@.*-darwin\([0-9]*\)@\1@')"
		;;
esac

# Determine machine information
case "${KC_CROSSCOMPILE_HOST_OS}" in
	x86_64-*-darwin*)
		sysmachine="Intel"
		syscpu="x86_64"
		;;
	powerpc-*-darwin*)
		sysmachine="Power Macintosh"
		syscpu="powerpc"
		;;
	hppa64-*-hpux*)
		sysmachine="9000/859"
		;;
	i386-*-solaris*)
		sysmachine="i86pc"
		;;
	sparc-*-solaris*)
		sysmachine="sun4u"
		;;
	x86_64-*)
		sysmachine="x86_64"
		;;
	i?86-*)
		sysmachine="i686"
		;;
	ia64-*)
		sysmachine="ia64"
		;;
	arm-*|armel-*|armeb-*)
		sysmachine="armv7l"
		;;
	mipsel-*|mipseb-*)
		sysmachine="mips"
		;;
	powerpc-*)
		sysmachine="ppc"
		;;
esac

for arg in $(echo "$@" | sed 's@.@ & @g'); do
	case "${arg}" in
		-)
			continue
			;;
		v)
			retval="${retval} unknown"
			;;
		r)
			retval="${retval} ${sysrelease}"
			;;
		s)
			retval="${retval} ${sysname}"
			;;
		m)
			retval="${retval} ${sysmachine}"
			;;
		p)
			# XXX
			retval="${retval} ${syscpu}"
			;;
		n)
			retval="${retval} $(hostname)"
			;;
		a)
			retval="${sysname} $(hostname) ${sysrelease} ${sysversion} ${sysmachine} ${syscpu}"
			;;
	esac
done

echo "${retval}" | sed 's@^  *@@;s@  *$@@'
_EOF_

chmod +x fake-bin/fake-uname

sed 's|`uname |`'"$(pwd)"'/fake-bin/fake-uname |g' unix/configure > unix/configure.new
cat unix/configure.new > unix/configure
rm -f unix/configure.new

exit 0

Modified tcl/patchscripts/win32-32bit-timet.sh from [63209e8aa4] to [701d971009].

1
2
3
4
5
6
7
8
9
10
11
#! /usr/bin/env bash

# Do not run on Win32
if echo '_WIN64' | ${CC:-cc} -E - | grep '^_WIN64$'; then
	(
		echo '#ifndef _USE_32BIT_TIME_T'
		echo '#define _USE_32BIT_TIME_T 1'
		echo '#endif'
		cat generic/tcl.h
	) > generic/tcl.h.new
	cat generic/tcl.h.new > generic/tcl.h



|







1
2
3
4
5
6
7
8
9
10
11
#! /usr/bin/env bash

# Do not run on Win32
if echo '_WIN64' | ${CC:-cc} -E - | grep '^_WIN64$' >/dev/null; then
	(
		echo '#ifndef _USE_32BIT_TIME_T'
		echo '#define _USE_32BIT_TIME_T 1'
		echo '#endif'
		cat generic/tcl.h
	) > generic/tcl.h.new
	cat generic/tcl.h.new > generic/tcl.h

Modified tclvfs/build.sh from [cad3e76073] to [7e37283f7c].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
BUILDDIR="$(pwd)/build/tclvfs-${TCLVFSVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export TCLVFSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${KC_TCLVFS_LDFLAGS}"
CFLAGS="${KC_TCLVFS_CFLAGS}"
CPPFLAGS="${KC_TCLVFS_CPPFLAGS}"
LIBS="${KC_TCLVFS_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

TCL_VERSION="unknown"
if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then







|
|
|
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
BUILDDIR="$(pwd)/build/tclvfs-${TCLVFSVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export TCLVFSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_TCLVFS_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_TCLVFS_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_TCLVFS_CPPFLAGS}"
LIBS="${LIBS} ${KC_TCLVFS_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

TCL_VERSION="unknown"
if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then

Added tclx/build.sh version [e8fda61b35].



























































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
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
137
138
139
140
141
#! /usr/bin/env bash

if [ ! -f 'build.sh' ]; then
	echo 'ERROR: This script must be run from the directory it is in' >&2

	exit 1
fi
if [ -z "${TCLVERS}" ]; then
	echo 'ERROR: The TCLVERS environment variable is not set' >&2

	exit 1
fi

TCLXVERS="8.4.1"
SRC="src/tclx${TCLXVERS}.tar.bz2"
SRCURL="http://sourceforge.net/projects/tclx/files/TclX/${TCLXVERS}/tclx${TCLXVERS}.tar.bz2/download"
BUILDDIR="$(pwd)/build/tclx8.4"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export TCLXVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_TCLX_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_TCLX_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_TCLX_CPPFLAGS}"
LIBS="${LIBS} ${KC_TCLX_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

TCL_VERSION="unknown"
if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then
        source "${TCLCONFIGDIR}/tclConfig.sh"
fi
export TCL_VERSION

if [ ! -f "${SRC}" ]; then
	mkdir 'src' >/dev/null 2>/dev/null

	if [ ! -d 'buildsrc' ]; then
		rm -f "${SRC}.tmp"
		wget -O "${SRC}.tmp" "${SRCURL}" || exit 1
		mv "${SRC}.tmp" "${SRC}"
	fi
fi

(
	cd 'build' || exit 1

	if [ ! -d '../buildsrc' ]; then
		bzip2 -dc "../${SRC}" | tar -xf -
	else    
		cp -rp ../buildsrc/* './'
	fi

	# Apply required patches
	cd "${BUILDDIR}" || exit 1
	for patch in "${PATCHDIR}/all"/tclx-${TCLXVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tclx-${TCLXVERS}-*.diff; do
		if [ ! -f "${patch}" ]; then
			continue
		fi

		echo "Applying: ${patch}"
		${PATCH:-patch} -p1 < "${patch}"
	done

	cd "${BUILDDIR}" || exit 1

	# Try to build as a shared object if requested
	if [ "${STATICTCLX}" = "0" ]; then
		tryopts="--enable-shared --disable-shared"
	elif [ "${STATICTCLX}" = "-1" ]; then
		tryopts="--enable-shared"
	else
		tryopts="--disable-shared"
	fi

	SAVE_CFLAGS="${CFLAGS}"
	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

		# If build a static TclX for KitDLL, ensure that we use PIC
		# so that it can be linked into the shared object
		if [ "${isshared}" = "0" -a "${KITTARGET}" = "kitdll" ]; then
			CFLAGS="${SAVE_CFLAGS} -fPIC"
		else
			CFLAGS="${SAVE_CFLAGS}"
		fi
		export CFLAGS

		if [ "${isshared}" = '0' ]; then
			sed 's@USE_TCL_STUBS@XXX_TCL_STUBS@g' configure > configure.new
		else
			sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new
		fi
		cat configure.new > configure
		rm -f configure.new

		(
			echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}"
			./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${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

	if [ ! -e "${INSTDIR}/lib/tclx8.4/pkgIndex.tcl" ]; then
		cat << _EOF_ > "${INSTDIR}/lib/tclx8.4/pkgIndex.tcl"
package ifneeded Tclx 8.4 [list load {} Tclx]
_EOF_
        fi

	# Install files needed by installation
	cp -r "${INSTDIR}/lib" "${OUTDIR}" || exit 1
	find "${OUTDIR}" -name '*.a' -type f | xargs -n 1 rm -f --

	exit 0
) || exit 1

exit 0

Modified thread/build.sh from [c27d51fd00] to [baef8e31a8].

16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
SRCURL="http://sourceforge.net/projects/tcl/files/Thread%20Extension/${THREADVERS}/thread${THREADVERS}.tar.gz/download"
BUILDDIR="$(pwd)/build/thread${THREADVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
export THREADVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR

# Set configure options for this sub-project
LDFLAGS="${KC_THREAD_LDFLAGS}"
CFLAGS="${KC_THREAD_CFLAGS}"
CPPFLAGS="${KC_THREAD_CPPFLAGS}"
LIBS="${KC_THREAD_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

# Determine if Threads is even needed
(







|
|
|
|







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
SRCURL="http://sourceforge.net/projects/tcl/files/Thread%20Extension/${THREADVERS}/thread${THREADVERS}.tar.gz/download"
BUILDDIR="$(pwd)/build/thread${THREADVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
export THREADVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_THREAD_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_THREAD_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_THREAD_CPPFLAGS}"
LIBS="${LIBS} ${KC_THREAD_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

# Determine if Threads is even needed
(

Modified tk/build.sh from [65e5d2673e] to [bb348ac8e4].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
PATCHDIR="$(pwd)/patches"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHSCRIPTDIR="$(pwd)/patchscripts"
export SRC SRCURL BUILDDIR PATCHDIR OUTDIR INSTDIR PATCHSCRIPTDIR

# Set configure options for this sub-project
LDFLAGS="${KC_TK_LDFLAGS}"
CFLAGS="${KC_TK_CFLAGS}"
CPPFLAGS="${KC_TK_CPPFLAGS}"
LIBS="${KC_TK_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

# Must be kept in-sync with "../tcl/build.sh"
TCLFOSSILDATE="../tcl/src/tcl${TCLVERS}.tar.gz.date"
export TCLFOSSILDATE

rm -rf 'build' 'out' 'inst'







|
|
|
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
PATCHDIR="$(pwd)/patches"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHSCRIPTDIR="$(pwd)/patchscripts"
export SRC SRCURL BUILDDIR PATCHDIR OUTDIR INSTDIR PATCHSCRIPTDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_TK_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_TK_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_TK_CPPFLAGS}"
LIBS="${LIBS} ${KC_TK_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

# Must be kept in-sync with "../tcl/build.sh"
TCLFOSSILDATE="../tcl/src/tcl${TCLVERS}.tar.gz.date"
export TCLFOSSILDATE

rm -rf 'build' 'out' 'inst'
145
146
147
148
149
150
151






152
153
154
155
156
157
158
			echo "Running patch script: ${patchscript}"
                                
			(
				. "${patchscript}"
			)
		fi
	done







	for dir in "${TCLCONFIGDIRTAIL}" unix win macosx win64 __fail__; do
		if [ -z "${dir}" ]; then
			continue
		fi

		if [ "${dir}" = "__fail__" ]; then







>
>
>
>
>
>







145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
			echo "Running patch script: ${patchscript}"
                                
			(
				. "${patchscript}"
			)
		fi
	done

	# Allow wrapper programs to supplant real programs
	if [ -d 'fake-bin' ]; then
		PATH="$(pwd)/fake-bin:${PATH}"
		export PATH
	fi

	for dir in "${TCLCONFIGDIRTAIL}" unix win macosx win64 __fail__; do
		if [ -z "${dir}" ]; then
			continue
		fi

		if [ "${dir}" = "__fail__" ]; then
172
173
174
175
176
177
178
179

180

181
182
183
184
185
186
187
		cd "${BUILDDIR}/${dir}" || exit 1

		# Remove broken pre-generated Makfiles
		rm -f GNUmakefile Makefile makefile

		if [ "${dir}" = "win" ]; then
			# Statically link Tk to Tclkit if we are compiling for
			# Windows

			STATICTK="1"


			if [ "${win64}" = "1" ]; then
				# Mingw32 for AMD64 requires this, apparently
				CPPFLAGS="${CPPFLAGS} -D_WIN32_IE=0x0501"
				CFLAGS="${CFLAGS} -D_WIN32_IE=0x0501"
				export CPPFLAGS CFLAGS
			fi







|
>
|
>







178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
		cd "${BUILDDIR}/${dir}" || exit 1

		# Remove broken pre-generated Makfiles
		rm -f GNUmakefile Makefile makefile

		if [ "${dir}" = "win" ]; then
			# Statically link Tk to Tclkit if we are compiling for
			# Windows unless otherwise requested
			if [ -z "${STATICTK}" ]; then
				STATICTK="1"
			fi

			if [ "${win64}" = "1" ]; then
				# Mingw32 for AMD64 requires this, apparently
				CPPFLAGS="${CPPFLAGS} -D_WIN32_IE=0x0501"
				CFLAGS="${CFLAGS} -D_WIN32_IE=0x0501"
				export CPPFLAGS CFLAGS
			fi
232
233
234
235
236
237
238
239
240
241
242
243
244
245

246
247
248
249
250





251
252
253
254
255
256
257
258
			# If we are building statically, don't create a
			# pkgIndex.tcl
			rm -f "${INSTDIR}"/lib/tk*/pkgIndex.tcl
		else
			# Update pkgIndex to load libtk from the local directory rather
			# than the parent directory
			for pkgIndex in "${INSTDIR}"/lib/tk*/pkgIndex.tcl; do
				sed 's@ \.\. @ @g' "${pkgIndex}" > "${pkgIndex}.new"
				mv "${pkgIndex}.new" "${pkgIndex}"
			done
		fi

		mkdir "${OUTDIR}/lib" || exit 1
		cp -r "${INSTDIR}/lib"/tk* "${OUTDIR}/lib/"

		cp -r "${INSTDIR}/lib"/libtk* "${OUTDIR}/lib"/tk*/
		rm -rf "${OUTDIR}/lib"/tk*/demos

		"${STRIP:-strip}" -g "${OUTDIR}"/lib/tk*/*.so >/dev/null 2>/dev/null
		find "${OUTDIR}" -type f -name '*.a' | xargs rm -f >/dev/null 2>/dev/null






		break
	done

	exit 0
) || exit 1

exit 0







|






>



|

>
>
>
>
>








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
			# If we are building statically, don't create a
			# pkgIndex.tcl
			rm -f "${INSTDIR}"/lib/tk*/pkgIndex.tcl
		else
			# Update pkgIndex to load libtk from the local directory rather
			# than the parent directory
			for pkgIndex in "${INSTDIR}"/lib/tk*/pkgIndex.tcl; do
				sed 's@ \.\. bin @ @g;s@ \.\. @ @;s@ lib\(tk.*\.dll\)@ \1@' "${pkgIndex}" > "${pkgIndex}.new"
				mv "${pkgIndex}.new" "${pkgIndex}"
			done
		fi

		mkdir "${OUTDIR}/lib" || exit 1
		cp -r "${INSTDIR}/lib"/tk* "${OUTDIR}/lib/"
		cp -r "${INSTDIR}/bin"/tk*.dll "${OUTDIR}/lib/"/tk*/
		cp -r "${INSTDIR}/lib"/libtk* "${OUTDIR}/lib"/tk*/
		rm -rf "${OUTDIR}/lib"/tk*/demos

		"${STRIP:-strip}" -g "${OUTDIR}"/lib/tk*/*.{so,dll,dylib,shlib} >/dev/null 2>/dev/null
		find "${OUTDIR}" -type f -name '*.a' | xargs rm -f >/dev/null 2>/dev/null

		# If we have a shared object, delete static libraries
		if find "${INSTDIR}" -type f '(' -name '*.dll' -o -name '*.so' -o -name '*.dylib' -o -name '*.shlib' ')' 2>/dev/null | grep '^' >/dev/null; then
			find "${INSTDIR}" -type f -name '*.a' | grep -v 'stub' | xargs rm -f
		fi

		break
	done

	exit 0
) || exit 1

exit 0

Added tk/patchscripts/fixfixstrtod.sh version [039781ed67].































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#! /bin/bash

# The "fix" for strtod:
#    1. Only applies to Solaris 2.4 (which noone should use)
#    2. Does not actually link against the file (which is
#       not even in Tk 8.6.1) that would supply such a symbol

grep -v '#define strtod fixstrtod' unix/configure > unix/configure.new
cat unix/configure.new > unix/configure
rm -f unix/configure.new

grep -v '#define strtod fixstrtod' macosx/configure > macosx/configure.new
cat macosx/configure.new > macosx/configure
rm -f macosx/configure.new

Added tk/patchscripts/xmkmf-donotuse.sh version [7f8d7b27ab].





































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
#! /bin/bash

# If we are not cross-compiling then don't worry about replacing "xmkmf" with a wrapper
if [ -z "${KC_CROSSCOMPILE}" ]; then
	## If KC_CROSSCOMPILE was unspecified, try to autodetect
	if [ -z "${CC}" ]; then
		exit 0
	fi

	case "$(basename "${CC}")" in
		*-*-*)
			;;
		*)
			exit 0
	esac
else
	## If KC_CROSSCOMPILE was specified as 0, we are not cross-compiling
	if [ "${KC_CROSSCOMPILE}" = '0' ]; then
		exit 0
	fi

	## Otherwise, we are cross-compiling
fi

# Create an "xmkmf" wrapper which exits in failure so that autoconf will try
# to locate headers/libraries normally
mkdir fake-bin >/dev/null 2>/dev/null

cat << \_EOF_ > fake-bin/xmkmf
#! /bin/bash
exit 1
_EOF_

chmod +x fake-bin/xmkmf

Modified tls/build.sh from [a1f308b67a] to [425a7ec59e].

17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
BUILDDIR="$(pwd)/build/tls${TLSVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export TLSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${KC_TLS_LDFLAGS}"
CFLAGS="${KC_TLS_CFLAGS}"
CPPFLAGS="${KC_TLS_CPPFLAGS}"
LIBS="${KC_TLS_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

TCL_VERSION="unknown"
if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then







|
|
|
|







17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
BUILDDIR="$(pwd)/build/tls${TLSVERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export TLSVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_TLS_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_TLS_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_TLS_CPPFLAGS}"
LIBS="${LIBS} ${KC_TLS_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

TCL_VERSION="unknown"
if [ -f "${TCLCONFIGDIR}/tclConfig.sh" ]; then
51
52
53
54
55
56
57






58
59
60
61
62
63
64

	if [ ! -d '../buildsrc' ]; then
		gzip -dc "../${SRC}" | tar -xf -
	else    
		cp -rp ../buildsrc/* './'
	fi







	# Apply required patches
	cd "${BUILDDIR}" || exit 1
	for patch in "${PATCHDIR}/all"/tls-${TLSVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tls-${TLSVERS}-*.diff; do
		if [ ! -f "${patch}" ]; then
			continue
		fi








>
>
>
>
>
>







51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70

	if [ ! -d '../buildsrc' ]; then
		gzip -dc "../${SRC}" | tar -xf -
	else    
		cp -rp ../buildsrc/* './'
	fi

	# Determine SSL directory
	if [ -z "${CPP}" ]; then
		CPP="${CC} -E"
	fi
	SSLDIR="$(echo '#include <openssl/ssl.h>' 2>/dev/null | ${CPP} - | awk '/# 1 "\/.*\/ssl\.h/{ print $3; exit }' | sed 's@^"@@;s@"$@@;s@/include/openssl/ssl\.h$@@')"

	# Apply required patches
	cd "${BUILDDIR}" || exit 1
	for patch in "${PATCHDIR}/all"/tls-${TLSVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tls-${TLSVERS}-*.diff; do
		if [ ! -f "${patch}" ]; then
			continue
		fi

108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
		else
			sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new
		fi
		cat configure.new > configure
		rm -f configure.new

		(
			echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" ${CONFIGUREEXTRA}"
			./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ${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







|
|







114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
		else
			sed 's@XXX_TCL_STUBS@USE_TCL_STUBS@g' configure > configure.new
		fi
		cat configure.new > configure
		rm -f configure.new

		(
			echo "Running: ./configure $tryopt --prefix=\"${INSTDIR}\" --exec-prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --with-tcl=\"${TCLCONFIGDIR}\" --with-ssl-dir=\"${SSLDIR}\" ${CONFIGUREEXTRA}"
			./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" --with-ssl-dir="${SSLDIR}" ${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

Added tls/patches/all/tls-1.6-eoffix.diff version [a489f87c5b].



































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
diff -uNr tls1.6/tlsIO.c tls1.6-eof-1dgp/tlsIO.c
--- tls1.6/tlsIO.c	2008-03-17 19:59:02.000000000 -0500
+++ tls1.6-eof-1dgp/tlsIO.c	2014-07-07 22:41:14.017514735 -0500
@@ -729,6 +729,19 @@
 	statePtr->timer = (Tcl_TimerToken) NULL;
     }
 
+    if (statePtr->flags & TLS_TCL_CALLBACK) {
+	return 0;
+    }
+
+    if (statePtr->flags & TLS_TCL_INIT
+	    && !SSL_is_init_finished(statePtr->ssl)) {
+	int errorCode;
+	if (Tls_WaitForConnect(statePtr, &errorCode) <= 0
+		&& errorCode == EAGAIN) {
+	    return 0;
+	}
+    }
+
     return mask;
 }
 
@@ -900,6 +913,9 @@
 		    continue;
 		}
 	    } else if (err == 0) {
+		if (Tcl_Eof(statePtr->self)) {
+		    return 0;
+		}
 		dprintf(stderr,"CR! ");
 		*errorCodePtr = ECONNRESET;
 		return -1;

Modified zlib/build.sh from [eadceaed0f] to [d95f997208].

18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHSCRIPTDIR="$(pwd)/patchscripts"
PATCHDIR="$(pwd)/patches"
export ZLIBVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${KC_ZLIB_LDFLAGS}"
CFLAGS="${KC_ZLIB_CFLAGS}"
CPPFLAGS="${KC_ZLIB_CPPFLAGS}"
LIBS="${KC_ZLIB_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

if [ ! -f "${SRC}" ]; then
	mkdir 'src' >/dev/null 2>/dev/null







|
|
|
|







18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHSCRIPTDIR="$(pwd)/patchscripts"
PATCHDIR="$(pwd)/patches"
export ZLIBVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_ZLIB_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_ZLIB_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_ZLIB_CPPFLAGS}"
LIBS="${LIBS} ${KC_ZLIB_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

rm -rf 'build' 'out' 'inst'
mkdir 'build' 'out' 'inst' || exit 1

if [ ! -f "${SRC}" ]; then
	mkdir 'src' >/dev/null 2>/dev/null
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
		gzip -dc "../${SRC}" | tar -xf -
	else    
		cp -rp ../buildsrc/* './'
	fi

	cd "${BUILDDIR}" || exit 1

	# Apply patches if needed
	for patch in "${PATCHDIR}/all"/zlib-${ZLIBVERS}-*.diff "${PATCHDIR}/all"/zlib-all-*.diff "${PATCHDIR}/${ZLIBVERS}"/zlib-${ZLIBVERS}-*.diff; do
		if [ ! -f "${patch}" ]; then
			continue
		fi

		echo "Applying: ${patch}"
		${PATCH:-patch} -p1 < "${patch}"
	done


	# Apply patch scripts if needed
	for patchscript in "${PATCHSCRIPTDIR}"/*.sh; do
		if [ -f "${patchscript}" ]; then
			echo "Running patch script: ${patchscript}"

			(
				. "${patchscript}"
			)
		fi
	done

	# If we are building for KitDLL, compile with '-fPIC'
	if [ "${KITTARGET}" = "kitdll" ]; then
		CFLAGS="${CFLAGS} -fPIC"
		export CFLAGS
	fi

	# We don't pass CONFIGUREEXTRA here, since this isn't a GNU autoconf
	# script and will puke
	echo "Running: ./configure --prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\""
	./configure --prefix="${INSTDIR}" --libdir="${INSTDIR}/lib"

	echo "Running: ${MAKE:-make}"
	${MAKE:-make} || exit 1

	echo "Running: ${MAKE:-make} install"
	${MAKE:-make} install

	# We don't really care too much about failure in zlib
	exit 0
) || exit 1

exit 0







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








|
|












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
		gzip -dc "../${SRC}" | tar -xf -
	else    
		cp -rp ../buildsrc/* './'
	fi

	cd "${BUILDDIR}" || exit 1























	# If we are building for KitDLL, compile with '-fPIC'
	if [ "${KITTARGET}" = "kitdll" ]; then
		CFLAGS="${CFLAGS} -fPIC"
		export CFLAGS
	fi

	# We don't pass CONFIGUREEXTRA here, since this isn't a GNU autoconf
	# script and will puke
	echo "Running: ./configure --prefix=\"${INSTDIR}\" --libdir=\"${INSTDIR}/lib\" --static"
	./configure --prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --static

	echo "Running: ${MAKE:-make}"
	${MAKE:-make} || exit 1

	echo "Running: ${MAKE:-make} install"
	${MAKE:-make} install

	# We don't really care too much about failure in zlib
	exit 0
) || exit 1

exit 0