Diff

Differences From Artifact [bdd97ba1c5]:

To Artifact [bb5492c154]:


13
14
15
16
17
18
19

20
21
22
23
24
25
26
27
28

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"

PATCHDIR="$(pwd)/patches"
export TCLTCCVERS SRC SRCURL BUILDDIR OUTDIR INSTDIR 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







>

|







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 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
		)
	else    
		cp -rp ../buildsrc/* './'
	fi

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




	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





	cd "${BUILDDIR}" || exit 1






	# 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







>
>
>
>









>
>
>
>
|
>
>
>
>
>







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

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




		export CFLAGS

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







>
>
>
>







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

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







<














|












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


	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