From c30d38226bca5f9a23bc2eeaa4ddb3050a69718c Mon Sep 17 00:00:00 2001 From: Fredrik Fornwall Date: Thu, 10 Mar 2016 12:01:58 +0100 Subject: [PATCH] Initial stab at NDK r11 support --- README.md | 2 +- build-package.sh | 10 ++++++++-- ndk_patches/sys-user.h.patch | 20 -------------------- packages/busybox/include-platform.h.patch | 18 ++++++++++++++++++ packages/busybox/include-platform.h.patch64 | 14 -------------- 5 files changed, 27 insertions(+), 37 deletions(-) create mode 100644 packages/busybox/include-platform.h.patch delete mode 100644 packages/busybox/include-platform.h.patch64 diff --git a/README.md b/README.md index 70ef9297..a750b173 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ setup steps: * Install the Android SDK at `$HOME/lib/android-sdk`. Override this by setting the environment variable `$ANDROID_HOME` to point at another location. -* Install the Android NDK, version r10e, at `$HOME/lib/android-ndk`. Override this by setting +* Install the Android NDK, version r11, at `$HOME/lib/android-ndk`. Override this by setting the environment variable `$NDK` to point at another location. Alternatively a Dockerfile is provided which sets up a pristine image diff --git a/build-package.sh b/build-package.sh index 8c8e5fc9..a8ce863e 100755 --- a/build-package.sh +++ b/build-package.sh @@ -59,7 +59,13 @@ export TERMUX_TOUCH="touch" test `uname` = "Darwin" && TERMUX_TOUCH=gtouch # Compute NDK version. We remove the first character (the r in e.g. r9d) to get a version number which can be used in packages): -export TERMUX_NDK_VERSION=`cut -d ' ' -f 1 $NDK/RELEASE.TXT | cut -c 2-` +export TERMUX_NDK_VERSION=11 +if grep -s -q "Pkg.Revision = $TERMUX_NDK_VERSION" $NDK/source.properties; then + : +else + echo "Wrong NDK version - we need $TERMUX_NDK_VERSION" + exit 1 +fi export prefix=${TERMUX_PREFIX} # prefix is used by some makefiles #export ACLOCAL="aclocal -I $TERMUX_PREFIX/share/aclocal" @@ -127,7 +133,7 @@ if [ ! -d $TERMUX_STANDALONE_TOOLCHAIN ]; then _TERMUX_NDK_TOOLCHAIN_NAME="$TERMUX_HOST_PLATFORM" fi bash $NDK/build/tools/make-standalone-toolchain.sh --platform=android-$TERMUX_API_LEVEL --toolchain=${_TERMUX_NDK_TOOLCHAIN_NAME}-${TERMUX_GCC_VERSION} \ - --install-dir=$TERMUX_STANDALONE_TOOLCHAIN --system=`uname | tr '[:upper:]' '[:lower:]'`-x86_64 + --install-dir=$TERMUX_STANDALONE_TOOLCHAIN if [ "arm" = $TERMUX_ARCH ]; then # Fix to allow e.g. to be included: cp $TERMUX_STANDALONE_TOOLCHAIN/include/c++/$TERMUX_GCC_VERSION/arm-linux-androideabi/armv7-a/bits/* $TERMUX_STANDALONE_TOOLCHAIN/include/c++/$TERMUX_GCC_VERSION/bits diff --git a/ndk_patches/sys-user.h.patch b/ndk_patches/sys-user.h.patch index fa4861ba..73f2578a 100644 --- a/ndk_patches/sys-user.h.patch +++ b/ndk_patches/sys-user.h.patch @@ -15,23 +15,3 @@ diff -u -r /home/fornwall/lib/android-ndk/platforms/android-21/arch-arm64/usr/in #elif defined(__x86_64__) struct user_fpregs_struct { -@@ -234,7 +240,18 @@ - - #elif defined(__aarch64__) - --// There are no user structures for 64 bit arm. -+/* From https://codereview.chromium.org/1291983003 */ -+struct user_regs_struct { -+ __u64 regs[31]; -+ __u64 sp; -+ __u64 pc; -+ __u64 pstate; -+}; -+struct user_fpsimd_struct { -+ __uint128_t vregs[32]; -+ __u32 fpsr; -+ __u32 fpcr; -+}; - - #else - diff --git a/packages/busybox/include-platform.h.patch b/packages/busybox/include-platform.h.patch new file mode 100644 index 00000000..cd525a30 --- /dev/null +++ b/packages/busybox/include-platform.h.patch @@ -0,0 +1,18 @@ +The r11 of NDK removed dprintf. + +diff -u -r ../busybox-1.24.1/include/platform.h ./include/platform.h +--- ../busybox-1.24.1/include/platform.h 2015-07-13 04:18:47.000000000 +0200 ++++ ./include/platform.h 2016-03-10 11:47:06.000000000 +0100 +@@ -480,11 +480,7 @@ + #endif + + #if defined(ANDROID) || defined(__ANDROID__) +-# if __ANDROID_API__ < 8 +-# undef HAVE_DPRINTF +-# else +-# define dprintf fdprintf +-# endif ++# undef HAVE_DPRINTF + # if __ANDROID_API__ < 21 + # undef HAVE_TTYNAME_R + # undef HAVE_GETLINE diff --git a/packages/busybox/include-platform.h.patch64 b/packages/busybox/include-platform.h.patch64 deleted file mode 100644 index fa5b6e1b..00000000 --- a/packages/busybox/include-platform.h.patch64 +++ /dev/null @@ -1,14 +0,0 @@ -fdprintf() does not exist in 64-bit bionic. - -diff -u -r ../busybox-1.24.1/include/platform.h ./include/platform.h ---- ../busybox-1.24.1/include/platform.h 2015-07-12 22:18:47.000000000 -0400 -+++ ./include/platform.h 2015-11-26 16:14:37.061610995 -0500 -@@ -480,7 +480,7 @@ - #endif - - #if defined(ANDROID) || defined(__ANDROID__) --# if __ANDROID_API__ < 8 -+# if __ANDROID_API__ < 8 || defined(__LP64__) - # undef HAVE_DPRINTF - # else - # define dprintf fdprintf -- 2.11.0