135
136
137
138
139
140
141
142
143
144
145
146
147
148
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
|
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}"
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 | xargs -n 1 rm -f --
find "${OUTDIR}" -name '*.a' -type f | grep -v '/lib/libtcc1\.a$' | xargs rm -f
exit 0
) || exit 1
exit 0
|