Check-in [437d69d82c]
Overview
Comment:Updated to include many Tcl symbols
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | tcc
Files: files | file ages | folders
SHA1: 437d69d82cc1f8754f639a285bd262b4d97ca932
User & Date: rkeene on 2014-04-28 14:02:34
Other Links: branch diff | manifest | tags
Context
2014-04-28
16:33
Updated to more accepting of C compilers when fixing up TCC check-in: 35718d9982 user: rkeene tags: tcc
14:02
Updated to include many Tcl symbols check-in: 437d69d82c user: rkeene tags: tcc
2014-04-27
05:52
More work towards getting a usable TclTCC check-in: 2a3d2138b6 user: rkeene tags: tcc
Changes

Modified tcc/build.sh from [bdd97ba1c5] to [bb5492c154].

13
14
15
16
17
18
19

20
21

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

22
23
24
25
26
27
28
29







+

-
+








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 PATCHDIR
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
57
58
59
60
61
62
63




64
65
66
67
68
69
70
71
72




73






74
75
76
77
78
79
80
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







+
+
+
+









+
+
+
+
-
+
+
+
+
+
+







		)
	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}"
	cd "${BUILDDIR}" || exit 1

			(
				. "${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
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







+
+
+
+







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







-














-
+













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

	touch include/windows.h
	cp -r include/* "${incDir}"
	cp -r ../../../{tcl,tk}/inst/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}" cu ../lib/libtcc1.a *.o
		"${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

Added tcc/patchscripts/tcltcc-0.4-addtclfuncs.sh version [cd3e226cba].





























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

function find_syms() {
	if [ -z "${NM}" ]; then
		if echo "${CC}" | sed 's@ .*$@@' | grep '[-]' >/dev/null; then
			NM="$(echo "${CC}" | sed 's@ .*$@@;s@\(.*\)-[^-]*$@\1-nm@')"
		else
			NM='nm'
		fi
	fi

	# "${NM}" "${LIBTCL}" | sed 's@:.*$@@' | sed 's@.* @@' | grep '^Tcl_' | sort -u | while read -r sym; do
	"${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