disabled packages: add tcc from unstable repo

TCC is a Tiny C Compiler. It doesn't support PIE executables but has
been added for its ability to act as C code interpreter. I don't know
whether package is still needed at all and considering its limited
usage scope on Android, I have moved it to disabled packages.
This commit is contained in:
Leonid Pliushch 2021-10-24 18:38:41 +00:00
parent 625f2aab3c
commit 23e4884159
No known key found for this signature in database
GPG Key ID: 45F2964132545795
3 changed files with 105 additions and 0 deletions

View File

@ -0,0 +1,58 @@
TERMUX_PKG_HOMEPAGE=https://bellard.org/tcc/
TERMUX_PKG_DESCRIPTION="Tiny C Compiler"
TERMUX_PKG_LICENSE="LGPL-2.1"
TERMUX_PKG_MAINTAINER="Leonid Pliushch <leonid.pliushch@gmail.com>"
TERMUX_PKG_VERSION=1:0.9.27
TERMUX_PKG_REVISION=10
TERMUX_PKG_SRCURL=https://repo.or.cz/tinycc.git/snapshot/fef838db2d124db3f1357385972371ccba7af2c6.tar.gz
TERMUX_PKG_SHA256=f6a022994b9903485a1777540c0c9e0571990fc339a2b325be6127b616534f33
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_NO_STATICSPLIT=true
termux_step_configure() {
unset CFLAGS CXXFLAGS
if [ "${TERMUX_ARCH}" = "arm" ] || [ "${TERMUX_ARCH}" = "i686" ]; then
ELF_INTERPRETER_PATH="/system/bin/linker"
ANDROID_LIB_PATH="/system/lib:/system/vendor/lib"
else
ELF_INTERPRETER_PATH="/system/bin/linker64"
ANDROID_LIB_PATH="/system/lib64:/system/vendor/lib64"
fi
}
termux_step_make() {
(
unset CC CFLAGS LDFLAGS
./configure --prefix="/tmp/tcc.host" --cpu="${TERMUX_ARCH}"
make -j $TERMUX_MAKE_PROCESSES tcc
mv -f tcc tcc.host
make distclean
)
./configure \
--prefix="$TERMUX_PREFIX" \
--cross-prefix="${CC//clang}" \
--cc="clang" \
--cpu="$TERMUX_ARCH" \
--disable-rpath \
--elfinterp="$ELF_INTERPRETER_PATH" \
--crtprefix="$TERMUX_PREFIX/lib/tcc/crt" \
--sysincludepaths="$TERMUX_PREFIX/include:$TERMUX_PREFIX/lib/tcc/include" \
--libpaths="$TERMUX_PREFIX/lib:$TERMUX_PREFIX/lib/tcc:$ANDROID_LIB_PATH"
mv tcc.host tcc
touch -d "next minute" tcc
make -j ${TERMUX_MAKE_PROCESSES} libtcc1.a
rm -f tcc
make -j ${TERMUX_MAKE_PROCESSES} tcc
make install
for file in crtbegin_dynamic.o crtbegin_so.o crtend_android.o crtend_so.o; do
install -Dm600 \
"${TERMUX_STANDALONE_TOOLCHAIN}/sysroot/usr/lib/$TERMUX_HOST_PLATFORM/$TERMUX_PKG_API_LEVEL/$file" \
"${TERMUX_PREFIX}/lib/tcc/crt/$file"
done
}

View File

@ -0,0 +1,25 @@
diff -uNr tcc-0.9.27/libtcc.c tcc-0.9.27.mod/libtcc.c
--- tcc-0.9.27/libtcc.c 2017-12-17 10:27:05.000000000 +0200
+++ tcc-0.9.27.mod/libtcc.c 2018-08-09 19:25:44.086756864 +0300
@@ -974,9 +974,20 @@
/* add libc crt1/crti objects */
if ((output_type == TCC_OUTPUT_EXE || output_type == TCC_OUTPUT_DLL) &&
!s->nostdlib) {
- if (output_type != TCC_OUTPUT_DLL)
+
+#ifdef __ANDROID__
+ if (output_type != TCC_OUTPUT_DLL) {
+ tcc_add_crt(s, "crtbegin_dynamic.o");
+ } else {
+ tcc_add_crt(s, "crtbegin_so.o");
+ }
+#else
+ if (output_type != TCC_OUTPUT_DLL) {
tcc_add_crt(s, "crt1.o");
+ }
tcc_add_crt(s, "crti.o");
+#endif // __ANDROID__
+
}
#endif
return 0;

View File

@ -0,0 +1,22 @@
diff -uNr tcc-0.9.27/tccelf.c tcc-0.9.27.mod/tccelf.c
--- tcc-0.9.27/tccelf.c 2017-12-17 10:27:05.000000000 +0200
+++ tcc-0.9.27.mod/tccelf.c 2018-08-09 19:28:33.036752853 +0300
@@ -1202,8 +1202,17 @@
#endif
tcc_add_support(s1, TCC_LIBTCC1);
/* add crt end if not memory output */
- if (s1->output_type != TCC_OUTPUT_MEMORY)
+ if (s1->output_type != TCC_OUTPUT_MEMORY) {
+#ifdef __ANDROID__
+ if (s1->output_type == TCC_OUTPUT_DLL) {
+ tcc_add_crt(s1, "crtend_so.o");
+ } else {
+ tcc_add_crt(s1, "crtend_android.o");
+ }
+#else
tcc_add_crt(s1, "crtn.o");
+#endif
+ }
}
}