Browse Source

Work against 64-bit builds

android-5
Fredrik Fornwall 10 years ago
parent
commit
8f7dda8321
  1. 7
      build-package.sh
  2. 16
      ndk_patches/sys-wait.h.patch
  3. 35
      packages/libandroid-support/build.sh
  4. 0
      packages/libandroid-support/setlocale.c.patch32

7
build-package.sh

@ -34,6 +34,10 @@ if [ ! -d "$NDK" ]; then echo 'ERROR: $NDK not defined as pointing at a director
: ${TERMUX_MAKE_PROCESSES:='4'}
: ${TERMUX_TOPDIR:="$HOME/termux"}
: ${TERMUX_ARCH:="arm"} # (arm|aarch64|i686|x86_64) - the 64 bit variants do not work yet
TERMUX_ARCH_BITS="32"
if [ "x86_64" = $TERMUX_ARCH -o "aarch64" = $TERMUX_ARCH ]; then
TERMUX_ARCH_BITS="64"
fi
: ${TERMUX_HOST_PLATFORM:="${TERMUX_ARCH}-linux-android"}
if [ $TERMUX_ARCH = "arm" ]; then TERMUX_HOST_PLATFORM="${TERMUX_HOST_PLATFORM}eabi"; fi
: ${TERMUX_PREFIX:='/data/data/com.termux/files/usr'}
@ -287,7 +291,8 @@ termux_step_host_build () {
# This should not be overridden
termux_step_patch_package () {
cd $TERMUX_PKG_SRCDIR
for patch in $TERMUX_PKG_BUILDER_DIR/*.patch; do
# Suffix patch with ".patch32" or ".patch64" to only apply for these bitnesses:
for patch in $TERMUX_PKG_BUILDER_DIR/*.patch{$TERMUX_ARCH_BITS,}; do
test -f $patch && sed "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $patch | patch -p1
done

16
ndk_patches/sys-wait.h.patch

@ -1,11 +1,17 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/wait.h ./usr/include/sys/wait.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm/usr/include/sys/wait.h 2014-10-14 22:53:49.000000000 -0400
+++ ./usr/include/sys/wait.h 2015-05-15 18:28:58.428331748 -0400
@@ -44,6 +44,7 @@
diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/sys/wait.h ./usr/include/sys/wait.h
--- /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/include/sys/wait.h 2014-10-14 22:53:49.000000000 -0400
+++ ./usr/include/sys/wait.h 2015-06-25 06:32:11.975176739 -0400
@@ -44,10 +44,13 @@
#define WIFEXITED(s) (WTERMSIG(s) == 0)
#define WIFSTOPPED(s) (WTERMSIG(s) == 0x7f)
#define WIFSIGNALED(s) (WTERMSIG((s)+1) >= 2)
+#define WIFCONTINUED(x) (WIFSTOPPED(x) && WSTOPSIG(x) == 0x13)
extern pid_t wait(int *);
extern pid_t waitpid(pid_t, int *, int);
extern pid_t wait4(pid_t, int *, int, struct rusage *);
+/* Termux addition: Add wait3() declaration used by busybox. Available in libc for 32-bit only. */
+static pid_t wait3(int* status, int options, struct rusage* rusage) { wait4(-1, status, options, rusage); }
/* Posix states that idtype_t should be an enumeration type, but
* the kernel headers define P_ALL, P_PID and P_PGID as constant macros

35
packages/libandroid-support/build.sh

@ -7,23 +7,36 @@ TERMUX_PKG_ESSENTIAL=yes
termux_step_post_extract_package () {
cd $TERMUX_PKG_SRCDIR
cp -Rf $NDK/sources/android/support/* .
if [ "$TERMUX_ARCH_BITS" = "64" ]; then
# https://android.googlesource.com/platform/ndk.git/+/7c811775212f8ae0ecdcf60d05fefb1582207038
# For 64-bit bionic has almost everything except the following:
mkdir -p src/musl-locale/ include/
cp $NDK/sources/android/support/src/musl-locale/{catclose.c,catgets.c,catopen.c} src/musl-locale/
cp $NDK/sources/android/support/include/* include/
else
cp -Rf $NDK/sources/android/support/* .
# See Android.mk for files not to build:
rm src/musl-stdio/vwscanf.c \
src/musl-stdio/wscanf.c \
src/musl-locale/newlocale.c \
src/musl-locale/nl_langinfo_l.c \
src/musl-locale/strcoll_l.c \
src/musl-locale/strxfrm_l.c \
src/musl-locale/wcscoll_l.c \
src/musl-locale/wcsxfrm_l.c
fi
}
termux_step_make_install () {
rm src/musl-stdio/vwscanf.c \
src/musl-stdio/wscanf.c \
src/musl-locale/newlocale.c \
src/musl-locale/nl_langinfo_l.c \
src/musl-locale/strcoll_l.c \
src/musl-locale/strxfrm_l.c \
src/musl-locale/wcscoll_l.c \
src/musl-locale/wcsxfrm_l.c
if [ "$TERMUX_ARCH_BITS" = "64" ]; then
_C_FILES="src/musl-*/*.c"
else
_C_FILES="src/locale/*.c src/musl-*/*.c src/stdio/*.c src/*.c"
fi
# Link against libm to avoid linkers having to do it
$CC $CFLAGS -std=c99 -DNULL=0 $CPPFLAGS $LDFLAGS -lm \
-Iinclude -Isrc/locale \
src/locale/*.c src/musl-*/*.c src/stdio/*.c src/*.c \
$_C_FILES \
-shared -fpic \
-o libandroid-support.so

0
packages/libandroid-support/setlocale.c.patch → packages/libandroid-support/setlocale.c.patch32

Loading…
Cancel
Save