Browse Source

Initial changes for NDK r19 support

android-5
Fredrik Fornwall 6 years ago
parent
commit
b9c36e8a37
  1. 20
      build-package.sh
  2. 14
      ndk-patches/cstddef.cpppatch
  3. 2
      scripts/properties.sh
  4. 2
      scripts/setup-android-sdk.sh

20
build-package.sh

@ -892,7 +892,7 @@ termux_step_setup_toolchain() {
# Setup the cpp preprocessor:
cp $_TERMUX_TOOLCHAIN_TMPDIR/bin/$TERMUX_HOST_PLATFORM-clang \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$TERMUX_HOST_PLATFORM-cpp
sed -i 's/clang70/clang70 -E/' \
sed -i 's/clang80/clang80 -E/' \
$_TERMUX_TOOLCHAIN_TMPDIR/bin/$TERMUX_HOST_PLATFORM-cpp
cd $_TERMUX_TOOLCHAIN_TMPDIR/sysroot
@ -917,9 +917,7 @@ termux_step_setup_toolchain() {
sed -i "s/define __ANDROID_API__ __ANDROID_API_FUTURE__/define __ANDROID_API__ $TERMUX_PKG_API_LEVEL/" \
usr/include/android/api-level.h
local _LIBDIR=usr/lib
if [ $TERMUX_ARCH = x86_64 ]; then _LIBDIR+=64; fi
$TERMUX_ELF_CLEANER $_LIBDIR/*.so
$TERMUX_ELF_CLEANER usr/lib/*/*/*.so
# zlib is really version 1.2.8 in the Android platform (at least
# starting from Android 5), not older as the NDK headers claim.
@ -928,11 +926,6 @@ termux_step_setup_toolchain() {
https://raw.githubusercontent.com/madler/zlib/v1.2.8/$file
done
unset file
cd $_TERMUX_TOOLCHAIN_TMPDIR/include/c++/4.9.x
sed "s%\@TERMUX_HOST_PLATFORM\@%${TERMUX_HOST_PLATFORM}%g" $TERMUX_SCRIPTDIR/ndk-patches/*.cpppatch | patch -p1
# Fix relative path in gcc/g++ script:
sed -i "s%\`dirname \$0\`/../../../../%$NDK/toolchains/%g" $_TERMUX_TOOLCHAIN_TMPDIR/bin/${TERMUX_HOST_PLATFORM}-gcc
sed -i "s%\`dirname \$0\`/../../../../%$NDK/toolchains/%g" $_TERMUX_TOOLCHAIN_TMPDIR/bin/${TERMUX_HOST_PLATFORM}-g++
mv $_TERMUX_TOOLCHAIN_TMPDIR $TERMUX_STANDALONE_TOOLCHAIN
fi
@ -949,14 +942,7 @@ termux_step_setup_toolchain() {
mkdir -p "$TERMUX_PREFIX/lib"
cd "$TERMUX_PREFIX/lib"
local _STL_LIBFILE=
if [ "$TERMUX_ARCH" = arm ]; then
local _STL_LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/${TERMUX_HOST_PLATFORM}/lib/armv7-a/$_STL_LIBFILE_NAME
elif [ "$TERMUX_ARCH" = x86_64 ]; then
local _STL_LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/${TERMUX_HOST_PLATFORM}/lib64/$_STL_LIBFILE_NAME
else
local _STL_LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/${TERMUX_HOST_PLATFORM}/lib/$_STL_LIBFILE_NAME
fi
local _STL_LIBFILE=$TERMUX_STANDALONE_TOOLCHAIN/sysroot/usr/lib/${TERMUX_HOST_PLATFORM}/$_STL_LIBFILE_NAME
cp "$_STL_LIBFILE" .
$STRIP --strip-unneeded $_STL_LIBFILE_NAME

14
ndk-patches/cstddef.cpppatch

@ -1,14 +0,0 @@
--- /home/builder/cstddef.orig 2017-07-15 01:17:10.637496279 +0000
+++ ./cstddef 2017-07-15 10:28:28.526713523 +0000
@@ -40,7 +40,11 @@
#endif
// Don't include our own <stddef.h>; we don't want to declare ::nullptr_t.
+#ifdef __clang__
#include_next <stddef.h>
+#else
+#include "../../../lib/gcc/@TERMUX_HOST_PLATFORM@/4.9.x/include/stddef.h"
+#endif
#include <__nullptr>
_LIBCPP_BEGIN_NAMESPACE_STD

2
scripts/properties.sh

@ -1,5 +1,5 @@
TERMUX_NDK_VERSION=18
TERMUX_ANDROID_BUILD_TOOLS_VERSION=28.0.3
TERMUX_NDK_VERSION=19
test -f "$HOME/.termuxrc" && . "$HOME/.termuxrc"

2
scripts/setup-android-sdk.sh

@ -7,7 +7,7 @@ set -e -u
ANDROID_SDK_FILE=sdk-tools-linux-4333796.zip
ANDROID_SDK_SHA256=92ffee5a1d98d856634e8b71132e8a95d96c83a63fde1099be3d86df3106def9
ANDROID_NDK_FILE=android-ndk-r${TERMUX_NDK_VERSION}-Linux-x86_64.zip
ANDROID_NDK_SHA256=c413dd014edc37f822d0dc88fabc05b64232d07d5c6e9345224e47073fdf140b
ANDROID_NDK_SHA256=c0a2425206191252197b97ea5fcc7eab9f693a576e69ef4773a9ed1690feed53
if [ ! -d $ANDROID_HOME ]; then
mkdir -p $ANDROID_HOME

Loading…
Cancel
Save