Check-in [5574242e95]
Overview
Comment:Merge updates from trunk.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | winFixes
Files: files | file ages | folders
SHA1: 5574242e95f0d854d9191b989d7c1299b7f8c0c8
User & Date: mistachkin on 2015-02-09 18:39:28
Other Links: branch diff | manifest | tags
Context
2015-02-09
19:00
Remove superfluous blank-line difference. Closed-Leaf check-in: 1b21d56df0 user: mistachkin tags: winFixes
18:39
Merge updates from trunk. check-in: 5574242e95 user: mistachkin tags: winFixes
2015-02-02
18:38
Updated build system to use new build-cc name for static compilers check-in: fe66a5f969 user: rkeene tags: trunk
2014-08-28
20:06
Remove obsolete differences that are no longer needed. check-in: b5def69863 user: mistachkin tags: winFixes
Changes

Modified .fossil-settings/ignore-glob from [5261fbbc36] to [e36d46f2b3].

101
102
103
104
105
106
107



























108
109
110
111
112
113
114
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







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







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
tls/build.log
tls/inst
tls/inst/*
tls/out
tls/out/*
tls/src
tls/src/*
tcllib/build
tcllib/build/*
tcllib/build.log
tcllib/inst
tcllib/inst/*
tcllib/out
tcllib/out/*
tcllib/src
tcllib/src/*
udp/build
udp/build/*
udp/build.log
udp/inst
udp/inst/*
udp/out
udp/out/*
udp/src
udp/src/*
yajltcl/build
yajltcl/build/*
yajltcl/build.log
yajltcl/inst
yajltcl/inst/*
yajltcl/out
yajltcl/out/*
yajltcl/src
yajltcl/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

Modified README from [f2f8e3ce68] to [ac8cb7fd32].

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






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







>
>
>
>
>







137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
		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

	10. KC_TCL_STATICPKGS
		Set this variable to the value "1" to attempt to force the
		packages included in the "pkgs" directory of Tcl 8.6+
		to be compiled statically

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++
169
170
171
172
173
174
175
176
177
178
179





180
181
182
183
184
185
186
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.






--------------------
Using the KitDLL SDK
--------------------
When you build a KitDLL, a "libtclkit-sdk-<tclvers>.tar.gz" tarball is also
produced.  This tarball contains the Tcl (and Tk, if compiled) stubs libraries,
and Tcl (and Tk, if compiled) header files needed to compile and link things







|



>
>
>
>
>







174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
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|cvfs|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.
	2. --with-obsfucated-cvfs
		Specify that CVFS should be obsfucated.  The contents of the
		CVFS are encrypted on disk and the encryption key is included
		in the executable.  Files are then transparently decrypted on
		access.

--------------------
Using the KitDLL SDK
--------------------
When you build a KitDLL, a "libtclkit-sdk-<tclvers>.tar.gz" tarball is also
produced.  This tarball contains the Tcl (and Tk, if compiled) stubs libraries,
and Tcl (and Tk, if compiled) header files needed to compile and link things

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

15
16
17
18
19
20
21










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











./kitcreator "$@" --host="${CROSS}"







>
>
>
>
>
>
>
>
>
>

15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
CXX="${CCROOTBIN}/${CROSS}-g++ ${CC_ADD}"
RANLIB="${CCROOTBIN}/${CROSS}-ranlib"
if [ -z "${STRIP}" ]; then
	STRIP="${CCROOTBIN}/${CROSS}-strip"
fi
export PATH AR CC CXX RANLIB STRIP

# When cross-compiling Tcl it cannot detect these things and so assumes failure
# This in turn creates linking issues because it will define the replacements
# in the main library and stubs library, which we may both link to
ac_cv_func_memcmp_working=yes
tcl_cv_strstr_unbroken=ok
tcl_cv_strtoul_unbroken=ok
tcl_cv_strtod_unbroken=ok
tcl_cv_strtod_buggy=ok
export ac_cv_func_memcmp_working tcl_cv_strstr_unbroken tcl_cv_strtoul_unbroken tcl_cv_strtod_unbroken tcl_cv_strtod_buggy

./kitcreator "$@" --host="${CROSS}"

Added build/make-kit-linux-amd64-static version [ec234cb947].





















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

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

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

Added build/make-kit-linux-i386-static version [e2bdf96001].





















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

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

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

Added build/make-kits version [a9df02454d].

































































































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

versions=(8.5.17 8.6.3)

for version in ${versions[@]}; do
	for includetk in 0 1; do
		if [ "${includetk}" = '1' ]; then
			unset KITCREATOR_PKGS

			add=''
			addurl=''
		else
			KITCREATOR_PKGS='itcl mk4tcl'
			export KITCREATOR_PKGS

			add='sh'
			addurl='-notk'
		fi

		case "$(hostname)" in
			powermacg5.home.rkeene.org)
				if [ ! -f "tclkit${add}-${version}-macosx10.5-ix86" ]; then
					echo "Building x86_64/ix86 Tclkit${add} version ${version}"

					CXXFLAGS='-arch i386 -arch x86_64 -mmacosx-version-min=10.5' CFLAGS='-arch i386 -arch x86_64 -mmacosx-version-min=10.5' ./kitcreator ${version} --enable-aqua --host=x86_64-apple-darwin9
					mv tclkit-${version} tclkit${add}-${version}-macosx10.5-ix86
				fi

				if [ ! -f "tclkit${add}-${version}-macosx10.5-powerpc" ]; then
					echo "Building ppc64/ppc Tclkit${add} version ${version}"

					CXXFLAGS='-arch ppc -arch ppc64 -mmacosx-version-min=10.5' CFLAGS='-arch ppc -arch ppc64 -mmacosx-version-min=10.5' ./kitcreator ${version} --enable-aqua
					mv tclkit-${version} tclkit${add}-${version}-macosx10.5-powerpc
				fi
				;;
			maul)
				echo wget -O tclkit${add}-${version}-android-arm http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-${version}-android-arm${addurl}-xcompile 
				echo wget -O tclkit${add}-${version}-linux-mips http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-${version}-linux-mipsel${addurl}-xcompile
				echo wget -O tclkit${add}-${version}-solaris-sparc http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-${version}-solaris-sparc${addurl}-xcompile
				echo wget -O tclkit${add}-${version}-solaris-sparc64 http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-${version}-solaris-sparc64${addurl}-xcompile
				echo wget -O tclkit${add}-${version}-win32-ix86.exe http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-${version}-win32-i586${addurl}-xcompile
				echo wget -O tclkit${add}-${version}-win32-x86_64.exe http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-${version}-win64-amd64${addurl}-xcompile
				echo wget -O tclkit${add}-${version}-rhel5-ix86 http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-${version}-linux-i386${addurl}-xcompile
				echo wget -O tclkit${add}-${version}-rhel5-x86_64 http://www.rkeene.org/devel/kitcreator/kitbuild/nightly/tclkit-${version}-linux-amd64${addurl}
				;;
		esac
	done
done

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

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







|







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.2"

# 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/publish-tests from [1af19dd257] to [a4cad57203].

156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
	set shortfile $file
	set file [file join $WEBDIR $file]
	if {[file isdirectory $file]} {
		continue
	}

	switch -glob -- $file {
		"*.log" - "*.ttml" - "*.html" - "*.desc" - "*-origname" - "*-tclsh" - "*-sdk.tar.gz" - "*.new" {
			continue
		}
	}

	# Derive what we can from the filename
	set buildfile "${shortfile}-build.log"
	set sdkshortfile "${shortfile}-sdk.tar.gz"







|







156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
	set shortfile $file
	set file [file join $WEBDIR $file]
	if {[file isdirectory $file]} {
		continue
	}

	switch -glob -- $file {
		"*.log" - "*.ttml" - "*.html" - "*.desc" - "*-origname" - "*-tclsh" - "*-sdk.tar.gz" - "*.new" - "*.sha1" {
			continue
		}
	}

	# Derive what we can from the filename
	set buildfile "${shortfile}-build.log"
	set sdkshortfile "${shortfile}-sdk.tar.gz"

Modified build/test/test from [af8be2e90b] to [5e3684a6ac].

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


|







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

VERSIONS="8.5.17 8.6.3 fossil_trunk"

# 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
436
437
438
439
440
441
442

443
444

















445
446
447
448
449
450
451

			# For KitDLL, make a note of the original name
			if [ "${kitdll}" = "1" ]; then
				echo "${createdkit}" > "${outputname}-origname"

				if [ -f "${sdk}" ]; then
					mv "${sdk}" "${outputname}-sdk.tar.gz"

				fi
			fi

















		fi

		# Test zip status
		if unzip -l "${outputname}" 2>&1 | grep 'boot\.tcl' >/dev/null; then
			canunzip="1"
		else
			canunzip="0"







>


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







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

			# For KitDLL, make a note of the original name
			if [ "${kitdll}" = "1" ]; then
				echo "${createdkit}" > "${outputname}-origname"

				if [ -f "${sdk}" ]; then
					mv "${sdk}" "${outputname}-sdk.tar.gz"
					openssl sha1 "${outputname}-sdk.tar.gz" | sed 's@^.*= @@' > "${outputname}-sdk.tar.gz.sha1"
				fi
			fi

			openssl sha1 "${outputname}" | sed 's@^.*= @@' > "${outputname}.sha1"
		fi

		# Note the SHA1 has of the file
		if [ -f "${outputname}.sha1" ]; then
			echo "SHA1: $(cat "${outputname}.sha1")"
		else
			echo "SHA1: not recorded"
		fi

		if [ -f "${outputname}-sdk.tar.gz" ]; then
			if [ -f "${outputname}-sdk.tar.gz.sha1" ]; then
				echo "SDK SHA1: $(cat "${outputname}-sdk.tar.gz.sha1")"
			else
				echo "SDK SHA1: not recorded"
			fi
		fi

		# Test zip status
		if unzip -l "${outputname}" 2>&1 | grep 'boot\.tcl' >/dev/null; then
			canunzip="1"
		else
			canunzip="0"

Modified build/test/tests/04-version.tcl from [d679aaf9ec] to [0fa9712117].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
#! /usr/bin/env tclsh

set chkversion [lindex $argv 2]

# We are unable to make a reasonable determination of the version from a CVS
# tag.  Assume it's okay.
if {[string match "cvs_*" $chkversion]} {
	exit 0
}

if {[info patchlevel] == $chkversion} {
	exit 0
}







|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
#! /usr/bin/env tclsh

set chkversion [lindex $argv 2]

# We are unable to make a reasonable determination of the version from a CVS
# tag.  Assume it's okay.
if {[string match "cvs_*" $chkversion] || [string match "fossil_*" $chkversion]} {
	exit 0
}

if {[info patchlevel] == $chkversion} {
	exit 0
}

Modified build/web/building.cgi from [b893b1086f] to [ceea8a8659].

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

	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" {







>
>
>
>
>
>
>












>
>
>
>
>
>
>
>
>
>







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

	foreach {option value} $buildinfo(options) {
		switch -- $option {
			"kitdll" {
				if {$value} {
					append description ", Built as a Library"
				}
			}
			"dynamictk" {
				if {$value} {
					if {[lsearch -exact $buildinfo(packages) "tk"] != -1} {
						append description ", Forced Tk Dynamic Linking"
					}
				}
			}
			"threaded" {
				if {$value} {
					append description ", Threaded"
				} else {
					append description ", Unthreaded"
				}
			}
			"debug" {
				if {$value} {
					append description ", With Symbols"
				}
			}
			"minbuild" {
				if {$value} {
					append description ", Without Tcl pkgs/ and all encodings"
				}
			}
			"staticlibssl" {
				if {$value} {
					append description ", Statically linked to LibSSL"
				}
			}
			"storage" {
				switch -- $value {
					"mk4" {
						append description ", Metakit-based"
					}
					"zip" {

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

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







>
>


>






>


>
|















>
>
>
>


|
|
|
|
|
|
|
|
>
>







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
		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.5.16) 8.5.16
	set tcl_versions(8.5.17) 8.5.17
	set tcl_versions(8.6.1) 8.6.1
	set tcl_versions(8.6.2) 8.6.2
	set tcl_versions(8.6.3) 8.6.3
	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-amd64-static) "Linux/amd64 (static)"
	set platforms(linux-arm) "Linux/ARM"
	set platforms(linux-i386) "Linux/i386"
	set platforms(linux-i386-static) "Linux/i386 (static)"
	set platforms(linux-mipsel) "Linux/MIPS (static)"
	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 packages(itcl) {[incr Tcl]}
	set packages(tcllib) "Tcllib"
	set packages(yajltcl) "YAJL-TCL"
	set packages(udp) "TclUDP"

	set disable {
		platform linux-mipsel {package_tk package_tcc4tcl package_tclx kitdll}
		platform android-arm {package_tk package_tclx}
		platform netbsd-amd64 {package_tk package_tcc4tcl package_tclx}
		platform netbsd-i386 {package_tk package_tcc4tcl package_tclx}
		platform solaris-sparc {package_tcc4tcl package_tclx}
		platform solaris-sparc64 {package_tcc4tcl package_tclx}
		platform hpux-hppa64 {package_tcc4tcl package_tclx}
		platform linux-arm {package_tk package_tclx}
		platform linux-amd64-static {package_tk package_dbus kitdll}
		platform linux-i386-static {package_tk package_dbus kitdll}
	}

	set specific {
		platform win32 file icon {Kit Icon}
		platform win32 text description {Description}
		platform win64 file icon {Kit Icon}
		platform win64 text description {Description}
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
		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)
						}
					}
				}







>
>
















>
>
>
>
>
>
>
>
>







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
		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
		set build_options(dynamictk) 0
		set build_options(minbuild) 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_dynamictk" {
					set build_options(dynamictk) 1
				}
				"option_minbuild" {
					set build_options(minbuild) 1
				}
				"option_staticlibssl" {
					set build_options(staticlibssl) 1
				}
				"option_storage" {
					switch -- $args($arg) {
						"mk4" - "zip" - "cvfs" {
							set build_options(storage) $args($arg)
						}
					}
				}
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
<?
	} 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\}"
		}
?>
	}
-->







|


|



|


|














|
|
|
|
|




|
|


|


|
|







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
<?
	} else {
?><html>
  <head>
    <title>KitCreator, Web Interface</title>
    <script>
<!--
	function enableOption(option) {
		var obj;

		obj = document.getElementById('option_' + option);
		obj.disabled = false;
	}

	function disableOption(option) {
		var obj;

		obj = document.getElementById('option_' + option);
		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 alldisabledoptions [list]
		foreach {keyword value disableoptions} $disable {
			foreach option $disableoptions {
				if {[lsearch -exact $alldisabledoptions $option] == -1} {
					lappend alldisabledoptions $option
				}
			}
		}

		foreach option $alldisabledoptions {
			puts "\t\tenableOption(\"$option\");"
		}

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

			foreach option $disableoptions {
				puts "\t\t\tdisableOption(\"$option\");"
			}

			puts "\t\t\}"
		}
?>
	}
-->
283
284
285
286
287
288
289
290


291







292
293
294
295
296
297
298
299
          </td>
        </tr>
        <tr>
          <td>Tcl Version:</td>
          <td>
            <select name="tcl_version" onChange="verifyOptions();">
<?
	foreach tcl_version [lsort -dictionary [array names tcl_versions]] {


		set tcl_version_name $tcl_versions($tcl_version)







		puts "              <option value=\"${tcl_version}\">${tcl_version_name}</option>"
	}
?>
            </select>
          </td>
        </tr>
        <tr>
          <td>Platform:</td>







|
>
>

>
>
>
>
>
>
>
|







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
          </td>
        </tr>
        <tr>
          <td>Tcl Version:</td>
          <td>
            <select name="tcl_version" onChange="verifyOptions();">
<?
	set tcl_version_list [lsort -dictionary [array names tcl_versions]]
	set tcl_version_selected [lindex $tcl_version_list end-1]
	foreach tcl_version $tcl_version_list {
		set tcl_version_name $tcl_versions($tcl_version)

		if {$tcl_version == $tcl_version_selected} {
			set selected " selected"
		} else {
			set selected ""
		}

		puts "              <option value=\"${tcl_version}\"${selected}>${tcl_version_name}</option>"
	}
?>
            </select>
          </td>
        </tr>
        <tr>
          <td>Platform:</td>
312
313
314
315
316
317
318
319



320
321
322
323
324
325
326
          <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>







|
>
>
>







343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
          <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" id="option_kitdll">Kit: Build Library (KitDLL)<br>
            <input type="checkbox" name="option_dynamictk" id="option_dynamictk">Kit: Always link Tk dynamically (if Tk is built)<br>
            <input type="checkbox" name="option_minbuild">Kit: "Minimal" build (remove extra packages shipped as part of Tcl and reduce encodings)<br>
            <input type="checkbox" name="option_staticlibssl">TLS: Statically link to LibSSL
          </td>
        </tr>
	<tr>
		<td>Kit Storage:</td>
		<td>
			<select name="option_storage">
				<option value="auto">Automatically Determined</option>

Modified build/web/process_queue from [ad31dc7738] to [1edd04d78d].

1
2
3
4

5
6
7
8
9
10
11
#! /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"




>







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

set queue "/home/rkeene/devel/kitcreator/build/web/queue"
set outdir "/web/customers/kitcreator.rkeene.org/kits"
set builddir "/tmp/kitcreator-web/builds"

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

	file rename "$queue" "${queue}.old"
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
	}

	# 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) {







|
|
>



>
>
>
|




>
>
|
|
|
>
>
>







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
	}

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

	# Set the build directory
	file delete -force -- $builddir
	set workdir [file join $builddir $buildinfo(key) build]
	file mkdir $workdir
	cd $workdir

	# Find place to store build info
	set keydir [file join $outdir $buildinfo(key)]
	file mkdir $keydir
	set fd [open [file join $keydir buildinfo] w]
	puts $fd [array get buildinfo]
	close $fd

	set tarball kitcreator-${buildinfo(kitcreator_version)}.tar.gz

	if {[catch {
		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)}
	}]} {
		continue
	}

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

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

	foreach {option value} $buildinfo(options) {
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
					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 {







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

















>
|
|
>











|







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
					lappend args "--enable-symbols"
					set ::env(STRIP) true
				}
			}
			"storage" {
				lappend args "--enable-kit-storage=$value"
			}
			"dynamictk" {
				if {[lsearch -exact $buildinfo(packages) "tk"] != -1} {
					set ::env(STATICTK) -1
				}
			}
			"minbuild" {
				if {$value} {
					set ::env(KITCREATOR_MINENCODINGS) 1
					set ::env(KITCREATOR_MINBUILD) 1
				}
			}
			"staticlibssl" {
				if {$value} {
					set ::env(KC_TLS_LINKSSLSTATIC) 1
				}
			}
			"staticmk4" {
			}
		}
	}

	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)\""

		foreach variable [list STRIP STATICTK KITCREATOR_MINENCODINGS KITCREATOR_MINBUILD KC_TLS_LINKSSLSTATIC] {
			if {[info exists ::env($variable)]} {
				puts $fd "Running: export $variable=\"$::env($variable)\""
			}
		}

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

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

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

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

Modified kitcreator from [de6501332a] to [d809d4a2f5].

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

		rm -rf "${pkg}/src"/tmp-*
	fi








|




















|



|







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
	clean|distclean|build|retry)
		mode="$1"
		shift
		;;
esac

# Determine which Tcl version to build
TCLVERS="8.6.3"
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 tcllib udp yajltcl"

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

		rm -rf "${pkg}/src"/tmp-*
	fi

113
114
115
116
117
118
119

120

121
122

123


124
125
126
127
128
129
130
		if [ "${STATICTK}" != "1" -a "${STATICTK}" != "-1" ]; then
			echo 'Warning: Linking Tk statically because you are building KitDLL' 2>&1
			echo '         Set STATICTK to -1 if you really want to link Tk dynamically.' >&2

			STATICTK="1"
			export STATICTK
		fi



		if [ -z "${STATICMK4}" ]; then
			echo 'Warning: Linking Mk4tcl dynamically because you are building KitDLL' 2>&1

			echo '         Set STATICMK4 to 1 if you really want to link Mk4tcl statically.' >&2



			STATICMK4="0"
			export STATICMK4
		fi
	fi
fi








>

>


>
|
>
>







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
		if [ "${STATICTK}" != "1" -a "${STATICTK}" != "-1" ]; then
			echo 'Warning: Linking Tk statically because you are building KitDLL' 2>&1
			echo '         Set STATICTK to -1 if you really want to link Tk dynamically.' >&2

			STATICTK="1"
			export STATICTK
		fi
	fi

	if echo " ${KITCREATOR_PKGS} " | grep ' mk4tcl ' >/dev/null 2>/dev/null; then
		if [ -z "${STATICMK4}" ]; then
			echo 'Warning: Linking Mk4tcl dynamically because you are building KitDLL' 2>&1
			echo '         Set STATICMK4 to make this message go away.' >&2
			echo '         Set STATICMK4 to 1 if you really want to link Mk4tcl statically (normal default).' >&2
			echo '         Set STATICMK4 to 0 to link Mk4tcl dynamically if possible (this is what is happening now).' >&2
			echo '         Set STATICMK4 to -1 to build dynamically.' >&2

			STATICMK4="0"
			export STATICMK4
		fi
	fi
fi

163
164
165
166
167
168
169




170
171
172
173
174
175
176
177
		echo -n "Skipping ${pkg} ..."
	else
		echo -n "Building ${pkg} ..."

		(
			cd "${pkg}" >/dev/null 2>/dev/null || exit 1





			./build.sh 3>&1 4>&2 > build.log 2>&1 || exit 1
		) || failed="1"
	fi

	if [ "${failed}" = "1" ]; then
		echo " failed."
		failedpkgs="${failedpkgs} ${pkg}"
	else







>
>
>
>
|







168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
		echo -n "Skipping ${pkg} ..."
	else
		echo -n "Building ${pkg} ..."

		(
			cd "${pkg}" >/dev/null 2>/dev/null || exit 1

			build_script='./build.sh'
			if [ -x 'kitcreator-build.sh' ]; then
				build_script='./kitcreator-build.sh'
			fi
			"${build_script}" 3>&1 4>&2 > build.log 2>&1 || exit 1
		) || failed="1"
	fi

	if [ "${failed}" = "1" ]; then
		echo " failed."
		failedpkgs="${failedpkgs} ${pkg}"
	else

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

11
12
13
14
15
16
17

18
19
20
21
22
23
24
25
26
27
28
29
30
STRIPLIBS = @STRIPLIBS@ @EXTRA_OBJS@
EXTRA_OBJS = @EXTRA_OBJS@
LDRUNPATH = @LDRUNPATH@
EXTRA_KIT_DEPS = @EXTRA_KIT_DEPS@
EXTRA_VFS_OBJS = @EXTRA_VFS_OBJS@
TCLSH_NATIVE = tclsh
LDFLAGS_ADD = @LDFLAGS_ADD@


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

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

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







>





|







11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
STRIPLIBS = @STRIPLIBS@ @EXTRA_OBJS@
EXTRA_OBJS = @EXTRA_OBJS@
LDRUNPATH = @LDRUNPATH@
EXTRA_KIT_DEPS = @EXTRA_KIT_DEPS@
EXTRA_VFS_OBJS = @EXTRA_VFS_OBJS@
TCLSH_NATIVE = tclsh
LDFLAGS_ADD = @LDFLAGS_ADD@
DIR2C_FLAGS = @DIR2C_FLAGS@

# Build targets
## VFS Build
cvfs_data_tcl.o: cvfs_data_tcl.c
cvfs_data_tcl.c: dir2c.tcl starpack.vfs cvfs_data.c
	"$(TCLSH_NATIVE)" dir2c.tcl tcl starpack.vfs $(DIR2C_FLAGS) > cvfs_data_tcl.c

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

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

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

556
557
558
559
560
561
562























		])
	done

	LDFLAGS="${OLD_LDFLAGS}"

	AC_SUBST(LDRUNPATH)
])






























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

	LDFLAGS="${OLD_LDFLAGS}"

	AC_SUBST(LDRUNPATH)
])

AC_DEFUN(DC_SET_DIR2C_FLAGS, [
	AC_MSG_CHECKING([if we should obsufcate the CVFS])

	AC_ARG_WITH(obsfucated-cvfs, AC_HELP_STRING([--with-obsfucated-cvfs], [Obsfucate CVFS filesystem (requires --enable-kit-storage=cvfs)]), [
		obsfucate_cvfs=$withval
	], [
		obsfucate_cvfs='no'
	])

	case "$obsfucate_cvfs" in
		yes)
			AC_MSG_RESULT([yes])
			DIR2C_FLAGS='--obsfucate'
			;;
		*)
			AC_MSG_RESULT([no])
			DIR2C_FLAGS=''
			;;
	esac

	AC_SUBST(DIR2C_FLAGS)
])

Modified kitsh/buildsrc/kitsh-0.0/configure.ac from [68bb20ca2d] to [42d57f3f66].

186
187
188
189
190
191
192



193
194
195
196
197
198
199

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

		dnl Add appropriate dependencies
		EXTRA_KIT_DEPS="cvfs.tcl.h"
		EXTRA_VFS_OBJS="${EXTRA_VFS_OBJS} cvfs_data_tcl.o"



	]
)

AC_SUBST(EXTRA_KIT_DEPS)
AC_SUBST(LDFLAGS_ADD)

dnl Put correct Makefile template in place







>
>
>







186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202

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

		dnl Add appropriate dependencies
		EXTRA_KIT_DEPS="cvfs.tcl.h"
		EXTRA_VFS_OBJS="${EXTRA_VFS_OBJS} cvfs_data_tcl.o"

		dnl Set any flags as required
		DC_SET_DIR2C_FLAGS
	]
)

AC_SUBST(EXTRA_KIT_DEPS)
AC_SUBST(LDFLAGS_ADD)

dnl Put correct Makefile template in place

Modified kitsh/buildsrc/kitsh-0.0/cvfs_data.c from [dcf0f1a5fd] to [010e908a77].

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
#include <tcl.h>

#ifdef HAVE_STDLIB_H
#  include <stdlib.h>
#endif

typedef struct cvfs_data *(cmd_getData_t)(const char *, unsigned long);
typedef unsigned long (cmd_getChildren_t)(const char *, unsigned long *, unsigned long);


/* Your implementation must provide these */
static cmd_getData_t *getCmdData(const char *hashkey);
static cmd_getChildren_t *getCmdChildren(const char *hashkey);


/* Tcl Commands */
static int getMetadata(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	cmd_getData_t *cmd_getData;
	cmd_getChildren_t *cmd_getChildren;
	struct cvfs_data *finfo = NULL;
	Tcl_Obj *ret_list, *ret_list_items[20];
	unsigned long num_children;
	const char *hashkey;
	const char *file;


	if (objc != 3) {
		Tcl_SetResult(interp, "wrong # args: should be \"getMetadata hashKey fileName\"", TCL_STATIC);

		return(TCL_ERROR);
	}









>




>










>







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
#include <tcl.h>

#ifdef HAVE_STDLIB_H
#  include <stdlib.h>
#endif

typedef struct cvfs_data *(cmd_getData_t)(const char *, unsigned long);
typedef unsigned long (cmd_getChildren_t)(const char *, unsigned long *, unsigned long);
typedef void (cmd_decryptFile_t)(const char *, struct cvfs_data *); 

/* Your implementation must provide these */
static cmd_getData_t *getCmdData(const char *hashkey);
static cmd_getChildren_t *getCmdChildren(const char *hashkey);
static cmd_decryptFile_t *getCmdDecryptFile(const char *hashkey);

/* Tcl Commands */
static int getMetadata(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	cmd_getData_t *cmd_getData;
	cmd_getChildren_t *cmd_getChildren;
	struct cvfs_data *finfo = NULL;
	Tcl_Obj *ret_list, *ret_list_items[20];
	unsigned long num_children;
	const char *hashkey;
	const char *file;
	int idx;

	if (objc != 3) {
		Tcl_SetResult(interp, "wrong # args: should be \"getMetadata hashKey fileName\"", TCL_STATIC);

		return(TCL_ERROR);
	}

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
	ret_list_items[15] = Tcl_NewStringObj("0", 1);

	ret_list_items[16] = Tcl_NewStringObj("mtime", 5);
	ret_list_items[17] = Tcl_NewStringObj("0", 1);

	ret_list_items[18] = Tcl_NewStringObj("ctime", 5);
	ret_list_items[19] = Tcl_NewStringObj("0", 1);





	ret_list = Tcl_NewListObj(sizeof(ret_list_items) / sizeof(ret_list_items[0]), ret_list_items);



	Tcl_SetObjResult(interp, ret_list);







	return(TCL_OK);
}

static int getData(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	struct cvfs_data *finfo = NULL;
	cmd_getData_t *cmd_getData;

	const char *hashkey;
	const char *file;
	const char *end_str;
	Tcl_Obj *ret_str;
	long start = 0;
	long end = -1;
	int tclGetLFO_ret;








>
>
>
>


>
>

>
>
>
>
>
>







>







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
	ret_list_items[15] = Tcl_NewStringObj("0", 1);

	ret_list_items[16] = Tcl_NewStringObj("mtime", 5);
	ret_list_items[17] = Tcl_NewStringObj("0", 1);

	ret_list_items[18] = Tcl_NewStringObj("ctime", 5);
	ret_list_items[19] = Tcl_NewStringObj("0", 1);

	for (idx = 0; idx < (sizeof(ret_list_items) / sizeof(ret_list_items[0])); idx++) {
		Tcl_IncrRefCount(ret_list_items[idx]);
	}

	ret_list = Tcl_NewListObj(sizeof(ret_list_items) / sizeof(ret_list_items[0]), ret_list_items);

	Tcl_IncrRefCount(ret_list);

	Tcl_SetObjResult(interp, ret_list);

	Tcl_DecrRefCount(ret_list);

	for (idx = 0; idx < (sizeof(ret_list_items) / sizeof(ret_list_items[0])); idx++) {
		Tcl_DecrRefCount(ret_list_items[idx]);
	}

	return(TCL_OK);
}

static int getData(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	struct cvfs_data *finfo = NULL;
	cmd_getData_t *cmd_getData;
	cmd_decryptFile_t *cmd_decryptFile;
	const char *hashkey;
	const char *file;
	const char *end_str;
	Tcl_Obj *ret_str;
	long start = 0;
	long end = -1;
	int tclGetLFO_ret;
145
146
147
148
149
150
151








152
153
154
155
156
157
158
	finfo = cmd_getData(file, 0);

	if (finfo == NULL) {
		Tcl_SetResult(interp, "No such file or directory", TCL_STATIC);

		return(TCL_ERROR);
	}









	if (finfo->type != CVFS_FILETYPE_FILE) {
		Tcl_SetResult(interp, "Not a file", TCL_STATIC);

		return(TCL_ERROR);
	}








>
>
>
>
>
>
>
>







161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
	finfo = cmd_getData(file, 0);

	if (finfo == NULL) {
		Tcl_SetResult(interp, "No such file or directory", TCL_STATIC);

		return(TCL_ERROR);
	}

	if (finfo->type == CVFS_FILETYPE_ENCRYPTED_FILE) {
		cmd_decryptFile = getCmdDecryptFile(hashkey);

		if (cmd_decryptFile != NULL) {
			cmd_decryptFile(file, finfo);
		}
	}

	if (finfo->type != CVFS_FILETYPE_FILE) {
		Tcl_SetResult(interp, "Not a file", TCL_STATIC);

		return(TCL_ERROR);
	}

175
176
177
178
179
180
181
182


183


184
185
186
187
188
189
190
	if (end < start) {
		Tcl_SetResult(interp, "Invalid arguments, start must be less than end", TCL_STATIC);

		return(TCL_ERROR);
	}

	ret_str = Tcl_NewByteArrayObj(finfo->data + start, (end - start));



	Tcl_SetObjResult(interp, ret_str);



	return(TCL_OK);
}

static int getChildren(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	struct cvfs_data *finfo = NULL;
	cmd_getChildren_t *cmd_getChildren;








>
>

>
>







199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
	if (end < start) {
		Tcl_SetResult(interp, "Invalid arguments, start must be less than end", TCL_STATIC);

		return(TCL_ERROR);
	}

	ret_str = Tcl_NewByteArrayObj(finfo->data + start, (end - start));

	Tcl_IncrRefCount(ret_str);

	Tcl_SetObjResult(interp, ret_str);

	Tcl_DecrRefCount(ret_str);

	return(TCL_OK);
}

static int getChildren(ClientData cd, Tcl_Interp *interp, int objc, Tcl_Obj *CONST objv[]) {
	struct cvfs_data *finfo = NULL;
	cmd_getChildren_t *cmd_getChildren;
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

	ret_list = Tcl_NewObj();
	if (ret_list == NULL) {
		Tcl_SetResult(interp, "Failed to allocate new object", TCL_STATIC);

		return(TCL_ERROR);
	}



	children = malloc(sizeof(*children) * num_children);

	num_children = cmd_getChildren(file, children, num_children);

	for (idx = 0; idx < num_children; idx++) {
		finfo = cmd_getData(NULL, children[idx]);

		if (finfo == NULL || finfo->name == NULL) {
			continue;
		}

		child = finfo->name;

		ret_curr_obj = Tcl_NewStringObj(child, strlen(child));



		Tcl_ListObjAppendList(interp, ret_list, ret_curr_obj);


	}

	free(children);

	Tcl_SetObjResult(interp, ret_list);



	return(TCL_OK);
}







>
>
















>
>

>
>





>
>



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

	ret_list = Tcl_NewObj();
	if (ret_list == NULL) {
		Tcl_SetResult(interp, "Failed to allocate new object", TCL_STATIC);

		return(TCL_ERROR);
	}

	Tcl_IncrRefCount(ret_list);

	children = malloc(sizeof(*children) * num_children);

	num_children = cmd_getChildren(file, children, num_children);

	for (idx = 0; idx < num_children; idx++) {
		finfo = cmd_getData(NULL, children[idx]);

		if (finfo == NULL || finfo->name == NULL) {
			continue;
		}

		child = finfo->name;

		ret_curr_obj = Tcl_NewStringObj(child, strlen(child));

		Tcl_IncrRefCount(ret_curr_obj);

		Tcl_ListObjAppendList(interp, ret_list, ret_curr_obj);

		Tcl_DecrRefCount(ret_curr_obj);
	}

	free(children);

	Tcl_SetObjResult(interp, ret_list);

	Tcl_DecrRefCount(ret_list);

	return(TCL_OK);
}

Modified kitsh/buildsrc/kitsh-0.0/dir2c.tcl from [903b20a63c] to [18ee9a3f9a].

1
2







3
4
5
6
7
8
9
10
11
#! /usr/bin/env tclsh








if {[llength $argv] != 2} {
	puts stderr "Usage: dir2c.tcl <hashkey> <startdir>"

	exit 1
}

set hashkey [lindex $argv 0]
set startdir [lindex $argv 1]



>
>
>
>
>
>
>

|







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

set obsfucate 0
if {[lindex $argv end] == "--obsfucate"} {
	set obsfucate 1

	set argv [lrange $argv 0 end-1]
}

if {[llength $argv] != 2} {
	puts stderr "Usage: dir2c.tcl <hashkey> <startdir> \[--obsfucate\]"

	exit 1
}

set hashkey [lindex $argv 0]
set startdir [lindex $argv 1]

70
71
72
73
74
75
76































































































77
78
79
80
81
82
83

	set ret [string trim $ret "\n\""]

	set ret "\"$ret\""

	return $ret
}
































































































# This function must be kept in-sync with the generated C function below
proc cvfs_hash {path} {
	set h 0
	set g 0

	for {set idx 0} {$idx < [string length $path]} {incr idx} {







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







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

	set ret [string trim $ret "\n\""]

	set ret "\"$ret\""

	return $ret
}

# Encrypt the data
proc random_byte {} {
	set value [expr {int(256 * rand())}]

	return $value
}

proc encrypt_key_generate {method} {
	switch -- $method {
		"rotate_subst" {
			set key(method) $method
			set key(rotate_length) [random_byte]

			set key_data [list]
			while {[llength $key_data] != 256} {
				set value [random_byte]
				if {[lsearch -exact $key_data $value] != -1} {
					continue
				}

				lappend key_data $value
			}

			foreach value $key_data {
				append key(subst) [format %c $value]
			}

			return [array get key]
		}
	}
	error "not implemented"
}

proc encrypt_key_export {key_dict target} {
	array set key $key_dict

	switch -- $key(method) {
		"rotate_subst" {
			switch -- $target {
				"c" {
					set retval ".type = CVFS_KEYTYPE_ROTATE_SUBST,\n"
					append retval ".typedata.rotate_subst.rotate_length = $key(rotate_length),\n"
					append retval ".typedata.rotate_subst.subst         = (unsigned char *) [stringify $key(subst)]\n"

					return $retval
				}
			}
		}
	}

	error "not implemented"
}

proc encrypt {data key_dict {decrypt 0}} {
	array set key $key_dict

	switch -- $key(method) {
		"rotate_subst" {
			set retval ""
			set datalen [string length $data]

			for {set i 0} {$i < $datalen} {incr i $key(rotate_length)} {
				set map [list]
				for {set j 0} {$j < 256} {incr j} {
					if {$decrypt} {
						lappend map [format %c $j] [string index $key(subst) $j]
					} else {
						lappend map [string index $key(subst) $j] [format %c $j]
					}
				}

				set end [expr {$i + $key(rotate_length) - 1}]

				set block [string range $data $i $end]
				set block [string map $map $block]

				append retval $block

				set key_end [string index $key(subst) 0]
				set key(subst) [string range $key(subst) 1 end]$key_end
			}

			return $retval
		}
		"aes" {
			package require aes
		}
	}
	error "not implemented"
}

proc decrypt {data key_dict} {
	return [encrypt $data $key_dict 1]
}

# This function must be kept in-sync with the generated C function below
proc cvfs_hash {path} {
	set h 0
	set g 0

	for {set idx 0} {$idx < [string length $path]} {incr idx} {
91
92
93
94
95
96
97





98
99
100
101
102
103
104
		}

		set h [expr {$h & ((~$g) & 0xffffffff)}]
	}

	return $h
}






# Generate list of files to include in output
set files [recursive_glob $startdir]

# Insert dummy entry cooresponding to C dummy entry
set files [linsert $files 0 "__DUMMY__"]








>
>
>
>
>







193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
		}

		set h [expr {$h & ((~$g) & 0xffffffff)}]
	}

	return $h
}

# If encryption is requested, generate a key
if {$obsfucate} {
	set obsfucation_key [encrypt_key_generate "rotate_subst"]
}

# Generate list of files to include in output
set files [recursive_glob $startdir]

# Insert dummy entry cooresponding to C dummy entry
set files [linsert $files 0 "__DUMMY__"]

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
#  ifdef HAVE_STDC
#    ifndef HAVE_UNISTD_H
#      define HAVE_UNISTD_H 1
#    endif
#    ifndef HAVE_STRING_H
#      define HAVE_STRING_H 1
#    endif



#  endif
#  ifdef HAVE_UNISTD_H
#    include <unistd.h>
#  endif
#  ifdef HAVE_STRING_H
#    include <string.h>
#  endif




#  ifndef LOADED_CVFS_COMMON
#    define LOADED_CVFS_COMMON 1

typedef enum {
	CVFS_FILETYPE_FILE,
	CVFS_FILETYPE_DIR


} cvfs_filetype_t;

struct cvfs_data {
	const char *             name;
	unsigned long            index;
	unsigned long            size;
	cvfs_filetype_t          type;
	const unsigned char *    data;















};

static unsigned long cvfs_hash(const unsigned char *path) {
	unsigned long i, h = 0, g = 0;

	for (i = 0; path[i]; i++) {
		h = (h << 4) + path[i];
		g = h & 0xf0000000;
		if (g) {
			h ^= (g >> 24);
		}
		h &= ((~g) & 0xffffffffLU);
	}
        
        return(h);
}


















#  endif /* !LOADED_CVFS_COMMON */}
puts ""

puts "static struct cvfs_data ${code_tag}_data\[\] = {"
puts "\t{"

puts "\t\t.name  = NULL,"
puts "\t\t.index = 0,"
puts "\t\t.type  = 0,"
puts "\t\t.size  = 0,"
puts "\t\t.data  = NULL,"

puts "\t},"
for {set idx 1} {$idx < [llength $files]} {incr idx} {
	set file [lindex $files $idx]
	set shortfile [shorten_file $startdir $file]

	unset -nocomplain finfo type
	file stat $file finfo

	switch -- $finfo(type) {
		"file" {
			set type "CVFS_FILETYPE_FILE"
			set size $finfo(size)

			set fd [open $file]
			fconfigure $fd -translation binary
			set data [read $fd]
			close $fd






			set data "(unsigned char *) [stringify $data]"

		}
		"directory" {
			set type "CVFS_FILETYPE_DIR"
			set data "NULL"
			set size 0
		}
	}

	puts "\t{"
	puts "\t\t.name  = \"$shortfile\","
	puts "\t\t.index = $idx,"
	puts "\t\t.type  = $type,"
	puts "\t\t.size  = $size,"
	puts "\t\t.data  = $data,"

	puts "\t},"
}
puts "};"
puts ""

puts "static unsigned long ${code_tag}_lookup_index(const char *path) {"
puts "\tswitch (cvfs_hash((unsigned char *) path)) {"







>
>
>







>
>
>





|
|
>
>








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
















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






>





>










<







>
>
>
>
>
|
>














>







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
#  ifdef HAVE_STDC
#    ifndef HAVE_UNISTD_H
#      define HAVE_UNISTD_H 1
#    endif
#    ifndef HAVE_STRING_H
#      define HAVE_STRING_H 1
#    endif
#    ifndef HAVE_STDLIB_H
#      define HAVE_STDLIB_H 1
#    endif
#  endif
#  ifdef HAVE_UNISTD_H
#    include <unistd.h>
#  endif
#  ifdef HAVE_STRING_H
#    include <string.h>
#  endif
#  ifdef HAVE_STDLIB_H
#    include <stdlib.h>
#  endif

#  ifndef LOADED_CVFS_COMMON
#    define LOADED_CVFS_COMMON 1

typedef enum {
	CVFS_FILETYPE_FILE            = 0,
	CVFS_FILETYPE_DIR             = 1,
	CVFS_FILETYPE_ENCRYPTED_FILE  = 2,
	CVFS_FILETYPE_COMPRESSED_FILE = 4,
} cvfs_filetype_t;

struct cvfs_data {
	const char *             name;
	unsigned long            index;
	unsigned long            size;
	cvfs_filetype_t          type;
	const unsigned char *    data;
	int                      free;
};

typedef enum {
	CVFS_KEYTYPE_ROTATE_SUBST     = 0,
} cvfs_keytype_t;

struct cvfs_key {
	cvfs_keytype_t type;
	union {
		struct {
			int rotate_length;
			unsigned char *subst;
		} rotate_subst;
	} typedata;
};

static unsigned long cvfs_hash(const unsigned char *path) {
	unsigned long i, h = 0, g = 0;

	for (i = 0; path[i]; i++) {
		h = (h << 4) + path[i];
		g = h & 0xf0000000;
		if (g) {
			h ^= (g >> 24);
		}
		h &= ((~g) & 0xffffffffLU);
	}
        
        return(h);
}

static int cvfs_decrypt(unsigned char *out, const unsigned char *in, unsigned long in_out_length, struct cvfs_key *key) {
	unsigned long i;
	unsigned char in_ch, out_ch;
	int ch_idx;

	for (i = 0; i < in_out_length; i++) {
		in_ch = in[i];

		ch_idx = (in_ch + (i / key->typedata.rotate_subst.rotate_length)) % 256;

		out_ch = key->typedata.rotate_subst.subst[ch_idx];
		out[i] = out_ch;
	}

	return(0);
}

#  endif /* !LOADED_CVFS_COMMON */}
puts ""

puts "static struct cvfs_data ${code_tag}_data\[\] = {"
puts "\t{"
puts "\t\t/* Index 0 cannot be used because we use the value 0 to represent failure */"
puts "\t\t.name  = NULL,"
puts "\t\t.index = 0,"
puts "\t\t.type  = 0,"
puts "\t\t.size  = 0,"
puts "\t\t.data  = NULL,"
puts "\t\t.free  = 0,"
puts "\t},"
for {set idx 1} {$idx < [llength $files]} {incr idx} {
	set file [lindex $files $idx]
	set shortfile [shorten_file $startdir $file]

	unset -nocomplain finfo type
	file stat $file finfo

	switch -- $finfo(type) {
		"file" {

			set size $finfo(size)

			set fd [open $file]
			fconfigure $fd -translation binary
			set data [read $fd]
			close $fd

			if {$obsfucate} {
				set type "CVFS_FILETYPE_ENCRYPTED_FILE"
				set data "(unsigned char *) [stringify [encrypt $data $obsfucation_key]]"
			} else {
				set type "CVFS_FILETYPE_FILE"
				set data "(unsigned char *) [stringify $data]"
			}
		}
		"directory" {
			set type "CVFS_FILETYPE_DIR"
			set data "NULL"
			set size 0
		}
	}

	puts "\t{"
	puts "\t\t.name  = \"$shortfile\","
	puts "\t\t.index = $idx,"
	puts "\t\t.type  = $type,"
	puts "\t\t.size  = $size,"
	puts "\t\t.data  = $data,"
	puts "\t\t.free  = 0,"
	puts "\t},"
}
puts "};"
puts ""

puts "static unsigned long ${code_tag}_lookup_index(const char *path) {"
puts "\tswitch (cvfs_hash((unsigned char *) path)) {"
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
}

puts "\t}"
puts ""
puts "\treturn(num_children);"
puts "}"
puts ""






























puts "#  ifdef CVFS_MAKE_LOADABLE"

set fd [open "cvfs_data.c"]
puts [read $fd]
close $fd


puts "static cmd_getData_t *getCmdData(const char *hashkey) {"
puts "\treturn(${code_tag}_getData);"
puts "}"
puts ""
puts "static cmd_getChildren_t *getCmdChildren(const char *hashkey) {"
puts "\treturn(${code_tag}_getChildren);"








puts "}"
puts ""

puts "int Cvfs_data_${hashkey}_Init(Tcl_Interp *interp) {"
puts "\tTcl_Command tclCreatComm_ret;"
puts "\tint tclPkgProv_ret;"
puts ""







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






<







>
>
>
>
>
>
>
>







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
}

puts "\t}"
puts ""
puts "\treturn(num_children);"
puts "}"
puts ""

if {$obsfucate} {
	puts "static void ${code_tag}_decryptFile(const char *path, struct cvfs_data *finfo) {"
	puts "\tstatic struct cvfs_key key = { [string map [list "\n" " "] [encrypt_key_export $obsfucation_key "c"]] };"
	puts "\tunsigned char *new_data, *old_data;"
	puts "\tint decrypt_ret, free_old_data;"
	puts ""
	puts "\tnew_data = malloc(finfo->size);"
	puts "\tdecrypt_ret = cvfs_decrypt(new_data, finfo->data, finfo->size, &key);"
	puts "\tif (decrypt_ret != 0) {"
	puts "\t\tfree(new_data);"
	puts ""
	puts "\t\treturn;"
	puts "\t}"
	puts ""
	puts "\tfree_old_data = finfo->free;"
	puts "\told_data = (void *) finfo->data;"
	puts ""
	puts "\tfinfo->data = new_data;"
	puts "\tfinfo->free = 1;"
	puts "\tfinfo->type = CVFS_FILETYPE_FILE;"
	puts ""
	puts "\tif (free_old_data) {"
	puts "\t\tfree(old_data);"
	puts "\t}"
	puts "\treturn;"
	puts "}"
	puts ""
}

puts "#  ifdef CVFS_MAKE_LOADABLE"

set fd [open "cvfs_data.c"]
puts [read $fd]
close $fd


puts "static cmd_getData_t *getCmdData(const char *hashkey) {"
puts "\treturn(${code_tag}_getData);"
puts "}"
puts ""
puts "static cmd_getChildren_t *getCmdChildren(const char *hashkey) {"
puts "\treturn(${code_tag}_getChildren);"
puts "}"
puts ""
puts "static cmd_decryptFile_t *getCmdDecryptFile(const char *hashkey) {"
if {$obsfucate} {
	puts "\treturn(${code_tag}_decryptFile);"
} else {
	puts "\treturn(NULL);"
}
puts "}"
puts ""

puts "int Cvfs_data_${hashkey}_Init(Tcl_Interp *interp) {"
puts "\tTcl_Command tclCreatComm_ret;"
puts "\tint tclPkgProv_ret;"
puts ""

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

10
11
12
13
14
15
16

17
18
19
20
21
22
23

	exit 1
fi

MK4VERS="2.4.9.7"
SRC="src/metakit-${MK4VERS}.tar.gz"
SRCURL="http://www.equi4.com/pub/mk/metakit-${MK4VERS}.tar.gz"

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







>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

	exit 1
fi

MK4VERS="2.4.9.7"
SRC="src/metakit-${MK4VERS}.tar.gz"
SRCURL="http://www.equi4.com/pub/mk/metakit-${MK4VERS}.tar.gz"
SRCURL="http://pkgs.fedoraproject.org/repo/pkgs/metakit/metakit-${MK4VERS}.tar.gz/17330257376eea657827ed632ea62c9e/metakit-${MK4VERS}.tar.gz"
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

Modified tcc4tcl/build.sh from [ae573dea00] to [a8c1cbf0ad].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /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













|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /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.23"
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

Added tcl/patchscripts/force-static-pkgs.sh version [068e7f94db].















































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

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

for makefile in {unix,win,macosx}/Makefile.in; do
	sed 's@--enable-shared@--disable-shared CFLAGS="-fPIC" @g' "${makefile}" > "${makefile}.new"
	cat "${makefile}.new" > "${makefile}"
	rm -f "${makefile}.new"
done

for pkgIndexFile in pkgs/*/pkgIndex*; do
	sed 's@load \[file join [^]]*\]@load {}@;s@\(Thread.* \[list load {}\)\]@\1 Thread]@' "${pkgIndexFile}" > "${pkgIndexFile}.new"
	cat "${pkgIndexFile}.new" > "${pkgIndexFile}"
	rm -f "${pkgIndexFile}.new"
done

for makefile in pkgs/*/Makefile*; do
	sed 's@x\$(SHARED_BUILD)@x1@g' "${makefile}" > "${makefile}.new"
	cat "${makefile}.new" > "${makefile}"
	rm -f "${makefile}.new"
done

Added tcllib/build.sh version [0558ed07b0].

























































































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

TCLLIB_VERS='1.16'
SRC="src/tcllib-${TCLLIB_VERS}.tar.bz2"
SRCURL="http://sourceforge.net/projects/tcllib/files/tcllib/${TCLLIB_VERS}/Tcllib-${TCLLIB_VERS}.tar.bz2"
BUILDDIR="$(pwd)/build/Tcllib-${TCLLIB_VERS}"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export TCLLIB_VERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

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

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

	cd "${BUILDDIR}" || exit 1

	./configure --prefix="${INSTDIR}" || exit 1

	make || exit 1

	make install || exit 1

	cp -rp "${INSTDIR}/lib" "${OUTDIR}"
) || exit 1

Added tclvfs/patches/all/tclvfs-20080503-fixinternalrepuse.diff version [2689cdda92].

















































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- tclvfs-20080503.orig/generic/vfs.c	2006-08-30 19:38:03.000000000 +0000
+++ tclvfs-20080503-fixinternalrepuse/generic/vfs.c	2014-11-17 18:34:43.317025829 +0000
@@ -1986,16 +1986,17 @@
         return NULL;
     }
     
-    splitPosition = nativeRep->splitPosition;
-    normed = Tcl_FSGetNormalizedPath(NULL, pathPtr);
-    normedString = Tcl_GetStringFromObj(normed, &len);
-    
     mountCmd = Tcl_DuplicateObj(nativeRep->fsCmd->mountCmd);
     Tcl_IncrRefCount(mountCmd);
     if (Tcl_ListObjLength(NULL, mountCmd, &dummyLen) == TCL_ERROR) {
 	Tcl_DecrRefCount(mountCmd);
 	return NULL;
     }
+
+    splitPosition = nativeRep->splitPosition;
+    normed = Tcl_FSGetNormalizedPath(NULL, pathPtr);
+    normedString = Tcl_GetStringFromObj(normed, &len);
+    
     Tcl_ListObjAppendElement(NULL, mountCmd, Tcl_NewStringObj(cmd,-1));
     if (splitPosition == len) {
 	Tcl_ListObjAppendElement(NULL, mountCmd, normed);

Added tk/patches/all/tk-8.6-fixishellitem.diff version [988a4061b9].





























































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
--- tk8.6.3.orig/win/tkWinDialog.c	2014-10-25 11:50:40.000000000 -0500
+++ tk8.6.3-fixishellitem/win/tkWinDialog.c	2014-11-18 22:57:19.021033000 -0600
@@ -209,19 +209,9 @@
  * older compilers? Should we prefix definitions with Tcl_ instead
  * of using the same names as in the SDK?
  */
-#ifndef __IShellItemArray_INTERFACE_DEFINED__
-#define __IShellItemArray_INTERFACE_DEFINED__
-
-typedef enum SIATTRIBFLAGS {
-    SIATTRIBFLAGS_AND	= 0x1,
-    SIATTRIBFLAGS_OR	= 0x2,
-    SIATTRIBFLAGS_APPCOMPAT	= 0x3,
-    SIATTRIBFLAGS_MASK	= 0x3,
-    SIATTRIBFLAGS_ALLITEMS	= 0x4000
-} SIATTRIBFLAGS;
+#ifndef __IShellItem_INTERFACE_DEFINED__
+#  define __IShellItem_INTERFACE_DEFINED__
 #ifdef __MSVCRT__
-typedef ULONG SFGAOF;
-
 typedef struct IShellItem IShellItem;
 
 typedef enum __MIDL_IShellItem_0001 {
@@ -250,6 +240,21 @@
 struct IShellItem {
     CONST_VTBL struct IShellItemVtbl *lpVtbl;
 };
+#endif
+#endif
+
+#ifndef __IShellItemArray_INTERFACE_DEFINED__
+#define __IShellItemArray_INTERFACE_DEFINED__
+
+typedef enum SIATTRIBFLAGS {
+    SIATTRIBFLAGS_AND	= 0x1,
+    SIATTRIBFLAGS_OR	= 0x2,
+    SIATTRIBFLAGS_APPCOMPAT	= 0x3,
+    SIATTRIBFLAGS_MASK	= 0x3,
+    SIATTRIBFLAGS_ALLITEMS	= 0x4000
+} SIATTRIBFLAGS;
+#ifdef __MSVCRT__
+typedef ULONG SFGAOF;
 #endif /* __MSVCRT__ */
 typedef struct IShellItemArray IShellItemArray;
 typedef struct IShellItemArrayVtbl

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

79
80
81
82
83
84
85



86
87
88
89
90
91
92
		tryopts="--enable-shared --disable-shared"
	elif [ "${STATICTLS}" = "-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}"








>
>
>







79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
		tryopts="--enable-shared --disable-shared"
	elif [ "${STATICTLS}" = "-1" ]; then
		tryopts="--enable-shared"
	else
		tryopts="--disable-shared"
	fi

	# Disable SSLv2, newer SSL libraries drop support for it entirely
	CFLAGS="${CFLAGS} -DNO_SSL2=1"

	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}"

136
137
138
139
140
141
142








143
144
145
146
147
148
149
150
151
152
153
		cat << _EOF_ > "${INSTDIR}/lib/tls${TLSVERS}/pkgIndex.tcl"
package ifneeded tls ${TLSVERS} \
    "[list source [file join \$dir tls.tcl]] ; \
     [list load {} tls]"
_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 --

	## XXX: TODO: Determine what we actually need to link against
	echo '-lssl -lcrypto' > "${INSTDIR}/lib/tls${TLSVERS}/libtls${TLSVERS}.a.linkadd"

	exit 0
) || exit 1

exit 0







>
>
>
>
>
>
>
>




<
<
<




139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157



158
159
160
161
		cat << _EOF_ > "${INSTDIR}/lib/tls${TLSVERS}/pkgIndex.tcl"
package ifneeded tls ${TLSVERS} \
    "[list source [file join \$dir tls.tcl]] ; \
     [list load {} tls]"
_EOF_
	fi

	## XXX: TODO: Determine what we actually need to link against
	addlibs="-lssl -lcrypto"
	if [ "${KC_TLS_LINKSSLSTATIC}" = '1' ]; then
		echo "-Wl,-Bstatic ${addlibs} -Wl,-Bdynamic"
	else
		echo "${addlibs}"
	fi > "${INSTDIR}/lib/tls${TLSVERS}/libtls${TLSVERS}.a.linkadd"

	# 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

Added udp/build.sh version [0751b83164].







































































































































































































































































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

TCLUDPVERS="1.0.11"
SRC="src/tcludp-${TCLUDPVERS}.tar.gz"
SRCURL="http://sourceforge.net/projects/tcludp/files/tcludp/${TCLUDPVERS}/tcludp-${TCLUDPVERS}.tar.gz"
BUILDDIR="$(pwd)/build/tcludp"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export TCLUDPVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_TCLUDP_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_TCLUDP_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_TCLUDP_CPPFLAGS}"
LIBS="${LIBS} ${KC_TCLUDP_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

	cd "${BUILDDIR}" || exit 1

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

	SAVE_CFLAGS="${CFLAGS}"
	for tryopt in $tryopts __fail__; do
		rm -rf "${INSTDIR}"
		mkdir "${INSTDIR}"

		if [ "${tryopt}" = "__fail__" ]; then
			exit 1
		fi

		# Clean up, if needed
		make distclean >/dev/null 2>/dev/null
		if [ "${tryopt}" == "--enable-shared" ]; then
			isshared="1"
		else
			isshared="0"
		fi

		# If build a static TCLUDP 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}\" ac_cv_path_DTPLITE=no ${CONFIGUREEXTRA}"
			./configure $tryopt --prefix="${INSTDIR}" --exec-prefix="${INSTDIR}" --libdir="${INSTDIR}/lib" --with-tcl="${TCLCONFIGDIR}" ac_cv_path_DTPLITE=no ${CONFIGUREEXTRA}

			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\""
			${MAKE:-make} tcllibdir="${INSTDIR}/lib" || exit 1

			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" install"
			${MAKE:-make} tcllibdir="${INSTDIR}/lib" install || exit 1
		) || continue

		break
	done

	# Create pkgIndex if needed
	if [ ! -e "${INSTDIR}/lib/udp${TCLUDPVERS}/pkgIndex.tcl" ]; then
		cat << _EOF_ > "${INSTDIR}/lib/udp${TCLUDPVERS}/pkgIndex.tcl"
package ifneeded udp ${TCLUDPVERS} [list load {} udp]
_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

Added yajltcl/build.sh version [4f55cc724b].



































































































































































































































































































































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

YAJLTCLVERS="1.5"
YAJLVERS='2.1.0'
SRC="src/yajltcl-${YAJLTCLVERS}.tar.gz"
YAJLSRC="src/yajl-${YAJLVERS}.tar.gz"
SRCURL="https://github.com/flightaware/yajl-tcl/archive/v${YAJLTCLVERS}.tar.gz"
YAJLSRCURL="http://github.com/lloyd/yajl/tarball/${YAJLVERS}"
BUILDDIR="$(pwd)/build/yajl-tcl-${YAJLTCLVERS}"
YAJLBUILDDIR="$(pwd)/build/lloyd-yajl-66cb08c"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHDIR="$(pwd)/patches"
export YAJLTCLVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${LDFLAGS} ${KC_YAJLTCL_LDFLAGS}"
CFLAGS="${CFLAGS} ${KC_YAJLTCL_CFLAGS}"
CPPFLAGS="${CPPFLAGS} ${KC_YAJLTCL_CPPFLAGS}"
LIBS="${LIBS} ${KC_YAJLTCL_LIBS}"
export LDFLAGS CFLAGS CPPFLAGS LIBS

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

if [ ! -d 'buildsrc' ]; then
	mkdir 'src' >/dev/null 2>/dev/null

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

	if [ ! -f "${YAJLSRC}" ]; then
		rm -f "${YAJLSRC}.tmp"
		wget -O "${YAJLSRC}.tmp" "${YAJLSRCURL}" || exit 1
		mv "${YAJLSRC}.tmp" "${YAJLSRC}"
	fi
fi

(
	cd 'build' || exit 1

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

	# Build YAJL
	(
		cd "${YAJLBUILDDIR}" || exit 1
		./configure -p "$(pwd)/INST" || exit 1
		make install || exit 1
		rm -f INST/lib/*.so*
		mv INST/lib/libyajl_s.a INST/lib/libyajl.a || exit 1
	) || exit 1

	# Include YAJL's build in our pkg-config path
	PKG_CONFIG_PATH="${YAJLBUILDDIR}/INST/share/pkgconfig"
	YAJL_CFLAGS="-I${YAJLBUILDDIR}/INST/include -I${YAJLBUILDDIR}/INST/include/yajl"
	export PKG_CONFIG_PATH YAJL_CFLAGS

	# Build YAJL-TCL
	cd "${BUILDDIR}" || exit 1

	# YAJLTCL releases are incomplete -- they lack a configure script
	autoconf || exit 1

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

	SAVE_CFLAGS="${CFLAGS}"
	for tryopt in $tryopts __fail__; do
		if [ "${tryopt}" = "__fail__" ]; then
			exit 1
		fi
		# Clean up, if needed
		make distclean >/dev/null 2>/dev/null
		rm -rf "${INSTDIR}"
		mkdir "${INSTDIR}"

		if [ "${tryopt}" == "--enable-shared" ]; then
			isshared="1"
		else
			isshared="0"
		fi

		# If build a static YAJLTCL 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\""
			${MAKE:-make} tcllibdir="${INSTDIR}/lib" || exit 1

			echo "Running: ${MAKE:-make} tcllibdir=\"${INSTDIR}/lib\" install"
			${MAKE:-make} tcllibdir="${INSTDIR}/lib" install || exit 1
		) || continue

		if [ "${isshared}" = '0' ]; then
			# Copy static libyajl to INSTDIR
			mkdir -p "${INSTDIR}/lib/deps"
			cp "${YAJLBUILDDIR}/INST/lib/libyajl.a" "${INSTDIR}/lib/zz-libyajl.a" || exit 1
		fi

		break
	done

	# Create pkgIndex if needed
	if [ ! -e "${INSTDIR}/lib/yajltcl${YAJLTCLVERS}/pkgIndex.tcl" ]; then
		cat << _EOF_ > "${INSTDIR}/lib/yajltcl${YAJLTCLVERS}/pkgIndex.tcl"
package ifneeded yajltcl ${YAJLTCLVERS} \
    "[list load {} yajltcl]; \
    [list source [file join \$dir yajl.tcl]]"
_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