diff --git a/gpkg/glibc/build.sh b/gpkg/glibc/build.sh
index 397f1a32f..009ea3eab 100644
--- a/gpkg/glibc/build.sh
+++ b/gpkg/glibc/build.sh
@@ -11,27 +11,7 @@ TERMUX_PKG_RECOMMENDS="glibc-runner"
TERMUX_PKG_NO_STATICSPLIT=true
TERMUX_PKG_CONFFILES="glibc/etc/gai.conf, glibc/etc/locale.gen"
TERMUX_PKG_SEPARATE_SUB_DEPENDS=true
-
-# Variables for glibc32 compilation
-TERMUX_PKG_BUILD32=$(test "$TERMUX_ARCH" = "aarch64" || test "$TERMUX_ARCH" = "arm" && \
- test "$TERMUX_ON_DEVICE_BUILD" = "false" && echo "true" || echo "false")
-TERMUX_PKG_BUILDDIR32="${TERMUX_TOPDIR}/${TERMUX_PKG_NAME}/build32"
-#if [ "$TERMUX_PKG_BUILD32" = "true" ]; then
-# TERMUX_PKG_BUILD_DEPENDS="glibc32"
-#fi
-
-termux_setup_build32() {
- case $TERMUX_ARCH in
- "aarch64")
- TERMUX_ARCH="arm"
- TERMUX_HOST_PLATFORM="arm-linux-gnueabihf";;
- "x86_64")
- TERMUX_ARCH="i686"
- TERMUX_HOST_PLATFORM="i686-linux-gnu";;
- esac
- termux_step_setup_toolchain
- cd ${TERMUX_PKG_BUILDDIR32}
-}
+TERMUX_PKG_BUILD32=true
termux_step_pre_configure() {
if [ "$TERMUX_PACKAGE_LIBRARY" != "glibc" ]; then
@@ -112,8 +92,8 @@ termux_step_pre_configure() {
# replacing some hard paths that may not exist in some device
for i in /dev/stderr:/proc/self/fd/2 \
- /dev/stdin:/proc/self/fd/0 \
- /dev/stdout:/proc/self/fd/1; do
+ /dev/stdin:/proc/self/fd/0 \
+ /dev/stdout:/proc/self/fd/1; do
for j in $(grep -s -r -l ${i%%:*} ${TERMUX_PKG_SRCDIR}); do
sed -i "s|${i%%:*}|${i//*:}|g" ${j}
done
@@ -124,20 +104,16 @@ termux_step_pre_configure() {
# specifying the current release (use only when developing glibc)
sed -i "s/stable/dev.$(git -C ${TERMUX_PKG_BUILDER_DIR} rev-parse --short HEAD).$(date +%Y%m%d%H%M%S)/" ${TERMUX_PKG_SRCDIR}/version.h
-
- if [ "$TERMUX_PKG_BUILD32" = "true" ]; then
- rm -fr ${TERMUX_PKG_BUILDDIR32}
- mkdir -p ${TERMUX_PKG_BUILDDIR32}
- fi
}
-termux_glibc_configure() {
- local libdir="${1}"
-
- echo "slibdir=${TERMUX_PREFIX}/${libdir}" > configparms
- echo "rtlddir=${TERMUX_PREFIX}/${libdir}" >> configparms
+termux_step_configure() {
+ echo "slibdir=${TERMUX_LIB_PATH}" > configparms
+ echo "rtlddir=${TERMUX_LIB_PATH}" >> configparms
echo "sbindir=${TERMUX_PREFIX}/bin" >> configparms
echo "rootsbindir=${TERMUX_PREFIX}/bin" >> configparms
+ if [ "$TERMUX_ARCH" != "$TERMUX_REAL_ARCH" ]; then
+ echo 'build-programs=no' >> configparms
+ fi
local _configure_flags=()
case $TERMUX_ARCH in
@@ -153,8 +129,8 @@ termux_glibc_configure() {
${TERMUX_PKG_SRCDIR}/configure \
--prefix=$TERMUX_PREFIX \
- --libdir=${TERMUX_PREFIX}/${libdir} \
- --libexecdir=${TERMUX_PREFIX}/${libdir} \
+ --libdir=$TERMUX_LIB_PATH \
+ --libexecdir=$TERMUX_LIB_PATH \
--host=$TERMUX_HOST_PLATFORM \
--build=$TERMUX_HOST_PLATFORM \
--target=$TERMUX_HOST_PLATFORM \
@@ -171,35 +147,17 @@ termux_glibc_configure() {
"${_configure_flags[@]}"
}
-termux_step_configure() {
- termux_glibc_configure "lib"
-
- if [ "$TERMUX_PKG_BUILD32" = "true" ]; then
- (
- termux_setup_build32
- termux_glibc_configure "lib32"
- echo 'build-programs=no' >> configparms
- )
- fi
-}
-
termux_step_make() {
make -O
- make info
-
- if [ "$TERMUX_PKG_BUILD32" = "true" ]; then
- (
- termux_setup_build32
- make -O
- )
+ if [ "$TERMUX_ARCH" = "$TERMUX_REAL_ARCH" ]; then
+ make info
fi
}
termux_glibc_make_syscall_without_fsc() {
local libname="libsyscall_without_fsc.so"
- local libdir="$1"
echo "Compiling '${libname}'..."
- $CC ${TERMUX_PKG_BUILDER_DIR}/syscall.c -o ${TERMUX_PREFIX}/${libdir}/${libname} \
+ $CC ${TERMUX_PKG_BUILDER_DIR}/syscall.c -o ${TERMUX_LIB_PATH}/${libname} \
-shared -DWITHOUT_FAKESYSCALL
echo "DONE"
}
@@ -210,11 +168,11 @@ termux_step_make_install() {
make install_root="/" install
rm -f ${TERMUX_PREFIX}/etc/ld.so.cache
- rm -f ${TERMUX_PREFIX}/bin/{tzselect,zdump,zic}
+ #rm -f ${TERMUX_PREFIX}/bin/{tzselect,zdump,zic}
- install -dm755 ${TERMUX_PREFIX}/lib/tmpfiles.d
+ install -dm755 ${TERMUX_LIB_PATH}/tmpfiles.d
install -m644 ${TERMUX_PKG_SRCDIR}/nscd/nscd.conf ${TERMUX_PREFIX}/etc/nscd.conf
- install -m644 ${TERMUX_PKG_SRCDIR}/nscd/nscd.tmpfiles ${TERMUX_PREFIX}/lib/tmpfiles.d/nscd.conf
+ install -m644 ${TERMUX_PKG_SRCDIR}/nscd/nscd.tmpfiles ${TERMUX_LIB_PATH}/tmpfiles.d/nscd.conf
install -m644 ${TERMUX_PKG_SRCDIR}/posix/gai.conf ${TERMUX_PREFIX}/etc/gai.conf
install -m755 ${TERMUX_PKG_BUILDER_DIR}/locale-gen ${TERMUX_PREFIX}/bin
sed -i "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g; s|@TERMUX_PREFIX_CLASSICAL@|$TERMUX_PREFIX_CLASSICAL|g" \
@@ -227,7 +185,7 @@ termux_step_make_install() {
sed -e '1,3d' -e 's|/| |g' -e 's| \\||g' \
${TERMUX_PKG_SRCDIR}/localedata/SUPPORTED > ${TERMUX_PREFIX}/share/i18n/SUPPORTED
- install -dm755 ${TERMUX_PREFIX}/lib/locale
+ install -dm755 ${TERMUX_LIB_PATH}/locale
make -C ${TERMUX_PKG_SRCDIR}/localedata objdir=${TERMUX_PKG_BUILDDIR} \
SUPPORTED-LOCALES="C.UTF-8/UTF-8 en_US.UTF-8/UTF-8" install-locale-files
sed -i '/#C\.UTF-8 /d' ${TERMUX_PREFIX}/etc/locale.gen
@@ -236,24 +194,23 @@ termux_step_make_install() {
install -Dm644 ${TERMUX_PKG_BUILDER_DIR}/sdt-config.h ${TERMUX_PREFIX}/include/sys/sdt-config.h
ln -sfr $PATH_DYNAMIC_LINKER ${TERMUX_PREFIX}/bin/ld.so
- ln -sfr $PATH_DYNAMIC_LINKER ${TERMUX_PREFIX}/lib/ld.so
-
- termux_glibc_make_syscall_without_fsc "lib"
+ ln -sfr $PATH_DYNAMIC_LINKER ${TERMUX_LIB_PATH}/ld.so
- if [ "$TERMUX_PKG_BUILD32" = "true" ]; then
- (
- termux_setup_build32
+ termux_glibc_make_syscall_without_fsc
+}
- make DESTDIR=${TERMUX_PKG_BUILDDIR32} install
+termux_step_make_install32() {
+ make DESTDIR=${TERMUX_PKG_BUILD32DIR} install
- cp -r ${TERMUX_PKG_BUILDDIR32}/${TERMUX_PREFIX}/lib32 $TERMUX_PREFIX
+ cp -r ${TERMUX_PKG_BUILD32DIR}/${TERMUX_LIB_PATH} $TERMUX_PREFIX
+ install -dm755 ${TERMUX_PREFIX}/include32
+ cp -r ${TERMUX_PKG_BUILD32DIR}/${TERMUX_PREFIX}/include/* ${TERMUX_PREFIX}/include32
- ln -sfr ${TERMUX_PREFIX}/lib/locale ${TERMUX_PREFIX}/lib32/locale
+ ln -sfr ${TERMUX_LIB64_PATH}/locale ${TERMUX_LIB_PATH}/locale
- ln -sfr ${TERMUX_PREFIX}/lib32/${DYNAMIC_LINKER} $PATH_DYNAMIC_LINKER
- ln -sfr ${TERMUX_PREFIX}/lib32/${DYNAMIC_LINKER} ${TERMUX_PREFIX}/lib32/ld.so
+ ln -sfr ${TERMUX_LIB_PATH}/${DYNAMIC_LINKER} $PATH_DYNAMIC_LINKER
+ ln -sfr ${TERMUX_LIB_PATH}/${DYNAMIC_LINKER} ${TERMUX_PREFIX}/bin/ld32.so
+ ln -sfr ${TERMUX_LIB_PATH}/${DYNAMIC_LINKER} ${TERMUX_LIB_PATH}/ld.so
- termux_glibc_make_syscall_without_fsc "lib32"
- )
- fi
+ termux_glibc_make_syscall_without_fsc
}
diff --git a/gpkg/glibc/glibc32.subpackage.sh b/gpkg/glibc/glibc32.subpackage.sh
index fbc333fa3..05c573f0d 100644
--- a/gpkg/glibc/glibc32.subpackage.sh
+++ b/gpkg/glibc/glibc32.subpackage.sh
@@ -2,6 +2,9 @@ TERMUX_SUBPKG_DESCRIPTION="GNU C Library (32-bit)"
TERMUX_SUBPKG_DEPENDS="linux-api-headers-glibc"
TERMUX_SUBPKG_EXCLUDED_ARCHES="arm, i686"
TERMUX_SUBPKG_INCLUDE="
+glibc/bin/ld32.so
glibc/lib32/
glibc/lib/ld-linux-armhf.so.3
-glibc/lib/ld-linux.so.2"
+glibc/lib/ld-linux.so.2
+glibc/include32/
+"
diff --git a/gpkg/glibc/set-sigrestore.patch b/gpkg/glibc/set-sigrestore.patch
new file mode 100644
index 000000000..5c51ae1a6
--- /dev/null
+++ b/gpkg/glibc/set-sigrestore.patch
@@ -0,0 +1,36 @@
+diff --git a/sysdeps/unix/sysv/linux/arm/sigrestorer.S b/sysdeps/unix/sysv/linux/arm/sigrestorer.S
+index 6eacc3f4..7d33283d 100644
+--- a/sysdeps/unix/sysv/linux/arm/sigrestorer.S
++++ b/sysdeps/unix/sysv/linux/arm/sigrestorer.S
+@@ -16,6 +16,7 @@
+ . */
+
+ #include
++#include
+
+ /* If no SA_RESTORER function was specified by the application we use
+ one of these. This avoids the need for the kernel to synthesise a return
+diff --git a/sysdeps/unix/sysv/linux/i386/libc_sigaction.c b/sysdeps/unix/sysv/linux/i386/libc_sigaction.c
+index 9d225d5e..70dcf24c 100644
+--- a/sysdeps/unix/sysv/linux/i386/libc_sigaction.c
++++ b/sysdeps/unix/sysv/linux/i386/libc_sigaction.c
+@@ -18,6 +18,7 @@
+
+ #include
+ #include
++#include
+
+ #define SA_RESTORER 0x04000000
+
+diff --git a/sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c b/sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c
+index b39812f8..59c6b490 100644
+--- a/sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c
++++ b/sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c
+@@ -17,6 +17,7 @@
+ . */
+
+ #include
++#include
+ #define SA_RESTORER 0x04000000
+
+ extern void restore_rt (void) asm ("__restore_rt") attribute_hidden;
diff --git a/gpkg/glibc/sigrestorer.S.patch b/gpkg/glibc/sigrestorer.S.patch
deleted file mode 100644
index 7f0982fca..000000000
--- a/gpkg/glibc/sigrestorer.S.patch
+++ /dev/null
@@ -1,10 +0,0 @@
---- glibc-2.39/sysdeps/unix/sysv/linux/arm/sigrestorer.S 2024-01-31 03:34:58.000000000 +0300
-+++ glibc-2.39/sysdeps/unix/sysv/linux/arm/sigrestorer.S.patch 2024-09-01 15:21:37.555593719 +0300
-@@ -16,6 +16,7 @@
- . */
-
- #include
-+#include
-
- /* If no SA_RESTORER function was specified by the application we use
- one of these. This avoids the need for the kernel to synthesise a return