Check-in [9c03031641]
Overview
Comment:Moved from tcc to tcc4tcl
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9c03031641541a4a3212ebbbf83ba8907226f66c
User & Date: rkeene on 2014-05-06 05:01:53
Other Links: manifest | tags
Context
2014-05-06
05:26
Updated to not link against libtcc1.a check-in: d56c4a3049 user: rkeene tags: trunk
05:01
Moved from tcc to tcc4tcl check-in: 9c03031641 user: rkeene tags: trunk
2014-05-05
02:46
Updated tests check-in: c24deea7f7 user: rkeene tags: trunk
Changes

Modified .fossil-settings/ignore-glob from [6f2aa7c2a3] to [2c3e9f6547].

80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95









96
97
98
99
100
101
102
80
81
82
83
84
85
86









87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102







-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+







zlib/build.log
zlib/inst
zlib/inst/*
zlib/out
zlib/out/*
zlib/src
zlib/src/*
tcc/build
tcc/build/*
tcc/build.log
tcc/inst
tcc/inst/*
tcc/out
tcc/out/*
tcc/src
tcc/src/*
tcc4tcl/build
tcc4tcl/build/*
tcc4tcl/build.log
tcc4tcl/inst
tcc4tcl/inst/*
tcc4tcl/out
tcc4tcl/out/*
tcc4tcl/src
tcc4tcl/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 kitcreator from [3d5aec022e] to [0ebdeb3250].

23
24
25
26
27
28
29
30

31
32
33
34
35
36
37
23
24
25
26
27
28
29

30
31
32
33
34
35
36
37







-
+







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

Deleted tcc/build.sh version [bb5492c154].

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
































































































































































































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

TCLTCCVERS="0.4"
SRC="src/tcltcc-${TCLTCCVERS}.zip"
SRCURL="https://tcltcc.googlecode.com/files/tcltcc${TCLTCCVERS}.zip"
BUILDDIR="$(pwd)/build/tcltcc-0.4"
OUTDIR="$(pwd)/out"
INSTDIR="$(pwd)/inst"
PATCHSCRIPTDIR="$(pwd)/patchscripts"
PATCHDIR="$(pwd)/patches"
export TCLTCCVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR PATCHSCRIPTDIR PATCHDIR

# Set configure options for this sub-project
LDFLAGS="${KC_TCLTCC_LDFLAGS}"
CFLAGS="${KC_TCLTCC_CFLAGS}"
CPPFLAGS="${KC_TCLTCC_CPPFLAGS}"
LIBS="${KC_TCLTCC_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
		mkdir "${BUILDDIR}" || exit 1
		(
			cd "${BUILDDIR}" || exit 1
			unzip "../../${SRC}"
		)
	else    
		cp -rp ../buildsrc/* './'
	fi

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

	# Install current Tcl headers
	cp -r ../../../{tcl,tk}/inst/include/* include/

	for patch in "${PATCHDIR}/all"/tcltcc-${TCLTCCVERS}-*.diff "${PATCHDIR}/${TCL_VERSION}"/tcltcc-${TCLTCCVERS}-*.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

	# Try to build as a shared object if requested
	if [ "${STATICTCLTCC}" = "0" ]; then
		tryopts="--enable-shared --disable-shared"
	elif [ "${STATICTCLTCC}" = "-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

		if [ "${isshared}" = "0" ]; then
			CFLAGS="${CFLAGS} -DCONFIG_TCC_STATIC=1"
		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
		chmod +x configure

		(
			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

	# Install files needed by installation
	pkgDir="${INSTDIR}/lib/tcc${TCLTCCVERS}"
	pkgIndex="${pkgDir}/pkgIndex.tcl"

	mkdir -p "${pkgDir}"

	cp tcc.tcl "${pkgDir}"
	cp pkgIndex.tcl "${pkgDir}"

	# Install headers needed for compilation
	incDir="${pkgDir}/include"
	mkdir "${incDir}"

	touch include/windows.h
	cp -r include/* "${incDir}"

	find "${incDir}" -name '*.a' | xargs rm -f

	# Install libraries
	libDir="${pkgDir}/lib"
	mkdir "${libDir}"

	(
		cd c || exit 1
		rm -f *.a *.o
		for file in *.c; do
			ofile="$(echo "${file}" | sed 's@\.c$@.o@')"
			"${CC:-gcc}" -I../include -I../../../../{tcl,tk}/inst/include/ -I../../../../tcl/build/tcl${TCLVERS}/generic/ -I../../../../tcl/build/tcl${TCLVERS}/unix/ -DUSE_TCL_STUBS=1 -c "${file}" -o "${ofile}"
		done
		"${AR:-ar}" rcu ../lib/libtcc1.a *.o
		"${RANLIB:-ranlib}" ../lib/libtcc1.a
	)
	cp lib/libtcc1.a "${libDir}"

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

	exit 0
) || exit 1

exit 0

Deleted tcc/patches/all/tcltcc-0.4-erroronunsupported.diff version [e47fbc9f65].

1
2
3
4
5
6
7
8
9
10
11
12
13
14














-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff -uNr tcltcc-0.4.orig/generic/tcc.h tcltcc-0.4-1erroronunsupported/generic/tcc.h
--- tcltcc-0.4.orig/generic/tcc.h	2007-11-07 10:04:32.000000000 -0600
+++ tcltcc-0.4-1erroronunsupported/generic/tcc.h	2014-04-28 16:34:24.600645002 -0500
@@ -21,6 +21,10 @@
 #include "config.h"
 #include "tcl.h"
 
+#if defined(__x86_64__)
+#  error "KitCreator TclTCC: Unsupported platform"
+#endif
+
 #ifdef CONFIG_TCCBOOT
 
 #include "tccboot.h"

Deleted tcc/patches/all/tcltcc-0.4-fixloading.diff version [59d3bfe7e9].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22






















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
--- tcltcc-0.4.orig/tcc.tcl	2007-11-07 10:04:42.000000000 -0600
+++ tcltcc-0.4/tcc.tcl	2014-04-26 23:06:24.272645002 -0500
@@ -9,10 +9,15 @@
    variable commands
 
    set dir [file dirname [info script]]
-   switch -exact -- $::tcl_platform(platform) {
-	   windows { load $dir/tcc02.dll tcc }
-	   unix { load $dir/libtcc0.2.so tcc }
-	   default {error "unsupport platform"}
+   if {[info command ::tcc] == ""} {
+      catch { load {} tcc }
+   }
+   if {[info command ::tcc] == ""} {
+       switch -exact -- $::tcl_platform(platform) {
+	       windows { load $dir/tcc04.dll tcc }
+	       unix { load $dir/libtcc0.4.so tcc }
+	       default {error "unsupport platform"}
+       }
    }
    set libs $dir/lib
    set includes $dir/include

Deleted tcc/patches/all/tcltcc-0.4-fixstaticwin32.diff version [20767a1a7f].

1
2
3
4
5
6
7
8
9
10
11
12












-
-
-
-
-
-
-
-
-
-
-
-
diff -uNr tcltcc-0.4.orig/generic/win32/tccpe.c tcltcc-0.4-1fixstaticwin32/generic/win32/tccpe.c
--- tcltcc-0.4.orig/generic/win32/tccpe.c	2007-11-07 10:04:32.000000000 -0600
+++ tcltcc-0.4-1fixstaticwin32/generic/win32/tccpe.c	2014-04-28 15:19:49.340645002 -0500
@@ -397,7 +397,7 @@
     return sym_index;
 }
 
-#ifdef WIN32
+#if defined(WIN32) && !defined(CONFIG_TCC_STATIC)
 ST void **pe_imp;
 ST int nb_pe_imp;
 

Deleted tcc/patches/all/tcltcc-0.4-setincpath.diff version [f1fe8f9975].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21





















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Common subdirectories: tcltcc-0.4.orig/c and tcltcc-0.4/c
Common subdirectories: tcltcc-0.4.orig/demo and tcltcc-0.4/demo
Common subdirectories: tcltcc-0.4.orig/examples and tcltcc-0.4/examples
Common subdirectories: tcltcc-0.4.orig/generic and tcltcc-0.4/generic
Common subdirectories: tcltcc-0.4.orig/include and tcltcc-0.4/include
Common subdirectories: tcltcc-0.4.orig/install and tcltcc-0.4/install
Common subdirectories: tcltcc-0.4.orig/lib and tcltcc-0.4/lib
diff -u tcltcc-0.4.orig/tcc.tcl tcltcc-0.4/tcc.tcl
--- tcltcc-0.4.orig/tcc.tcl	2014-04-26 23:57:35.522645002 -0500
+++ tcltcc-0.4/tcc.tcl	2014-04-27 00:01:35.492645002 -0500
@@ -101,6 +101,7 @@
       set tcc(cc) tcc1
       tcc $tcc::dir $tcc(cc)
       $tcc(cc) add_library tcl8.5
+      $tcc(cc) add_include_path [file join $::tcc::dir include]
   }
   Log code:$code
   $tcc(cc) compile $code
Common subdirectories: tcltcc-0.4.orig/tclconfig and tcltcc-0.4/tclconfig
Common subdirectories: tcltcc-0.4.orig/tests and tcltcc-0.4/tests
Common subdirectories: tcltcc-0.4.orig/tools and tcltcc-0.4/tools

Deleted tcc/patchscripts/tcltcc-0.4-addtclfuncs.sh version [f0194cd9c1].

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19



















-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#! /bin/bash

function find_syms() {
	${CC:-gcc} ${CPPFLAGS} -E include/tcl.h  | grep '^ *extern.*Tcl_'| sed 's@^ *extern *@@;s@([^(]*$@@;s@.* *\**  *@@'  | sort -u | grep '^Tcl_' | grep -v ';$' | while read -r sym; do
		echo "    TCCSYM($sym)"
	done
}

add="$(find_syms)"

awk -v add="${add}" '/TCCSyms tcc_syms.*=/{
	print
	print add
	next
} { print }' generic/tcc.h > generic/tcc.h.new
cat generic/tcc.h.new > generic/tcc.h
rm -f generic/tcc.h.new

exit 0

Added tcc4tcl/build.sh version [c3ecd9940b].
































































































































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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#! /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.5"
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="${KC_TCC4TCL_LDFLAGS}"
CFLAGS="${KC_TCC4TCL_CFLAGS}"
CPPFLAGS="${KC_TCC4TCL_CPPFLAGS}"
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

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

	exit 0
) || exit 1

exit 0