From c3d0f1b66659905491671abc4bb5d6415f642e6d Mon Sep 17 00:00:00 2001 From: ReenigneCA <15387520+ReenigneCA@users.noreply.github.com> Date: Tue, 28 Dec 2021 16:12:52 -0500 Subject: [PATCH] update android build scripts to support latest ndk version and prebuilt toolchains (#1138) * Update android-armv7-a.sh update HOST_COMPILER variable to be compatible with updated android-build.sh that supports latest ndk and use of prebuilt toolchains. * Update android-build.sh update to allow use of prebuilt toolchains in latest ndk. The latest ndk does not support arm prior to armv7a and the HOST_COMPILER for armv7a must now be armv7a not just arm. * Delete android-arm.sh arm prior to armv7a is no longer supported by android ndk. * Update android-build.sh removing unneeded MAKE_TOOLCHAIN variable * Update Makefile.am removing obsolete android targets * Delete android-mips32.sh * Delete android-mips64.sh --- dist-build/Makefile.am | 3 --- dist-build/android-arm.sh | 4 ---- dist-build/android-armv7-a.sh | 2 +- dist-build/android-build.sh | 19 ++++++------------- dist-build/android-mips32.sh | 4 ---- dist-build/android-mips64.sh | 4 ---- 6 files changed, 7 insertions(+), 29 deletions(-) delete mode 100755 dist-build/android-arm.sh delete mode 100755 dist-build/android-mips32.sh delete mode 100755 dist-build/android-mips64.sh diff --git a/dist-build/Makefile.am b/dist-build/Makefile.am index a505400b..2513259a 100644 --- a/dist-build/Makefile.am +++ b/dist-build/Makefile.am @@ -1,11 +1,8 @@ EXTRA_DIST = \ android-build.sh \ - android-arm.sh \ android-armv7-a.sh \ android-armv8-a.sh \ - android-mips32.sh \ - android-mips64.sh \ android-x86.sh \ android-x86_64.sh \ emscripten.sh \ diff --git a/dist-build/android-arm.sh b/dist-build/android-arm.sh deleted file mode 100755 index eb97828c..00000000 --- a/dist-build/android-arm.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -export TARGET_ARCH=armv6 -export CFLAGS="-Os -mthumb -marm -march=${TARGET_ARCH}" -ARCH=arm HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh" diff --git a/dist-build/android-armv7-a.sh b/dist-build/android-armv7-a.sh index a8725082..6cfa80ae 100755 --- a/dist-build/android-armv7-a.sh +++ b/dist-build/android-armv7-a.sh @@ -1,4 +1,4 @@ #!/bin/sh export TARGET_ARCH=armv7-a export CFLAGS="-Os -mfloat-abi=softfp -mfpu=vfpv3-d16 -mthumb -marm -march=${TARGET_ARCH}" -ARCH=arm HOST_COMPILER=arm-linux-androideabi "$(dirname "$0")/android-build.sh" +ARCH=arm HOST_COMPILER=armv7a-linux-androideabi "$(dirname "$0")/android-build.sh" diff --git a/dist-build/android-build.sh b/dist-build/android-build.sh index 22b41b2a..f1ebcd73 100755 --- a/dist-build/android-build.sh +++ b/dist-build/android-build.sh @@ -23,15 +23,14 @@ if [ "x$TARGET_ARCH" = 'x' ] || [ "x$ARCH" = 'x' ] || [ "x$HOST_COMPILER" = 'x' exit 1 fi -export MAKE_TOOLCHAIN="${ANDROID_NDK_HOME}/build/tools/make_standalone_toolchain.py" - export PREFIX="$(pwd)/libsodium-android-${TARGET_ARCH}" -export TOOLCHAIN_DIR="$(pwd)/android-toolchain-${TARGET_ARCH}" +export TOOLCHAIN_OS_DIR="`uname | tr '[:upper:]' '[:lower:]'`-x86_64/" +export TOOLCHAIN_DIR="$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/${TOOLCHAIN_OS_DIR}" +echo "$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/${TOOLCHAIN_OS_DIR}/${HOST_COMPILER}" + export PATH="${PATH}:${TOOLCHAIN_DIR}/bin" - -export CC=${CC:-"${HOST_COMPILER}-clang"} - -rm -rf "${TOOLCHAIN_DIR}" "${PREFIX}" +SDK_VERSION_NUM=`echo $NDK_PLATFORM | cut -d'-' -f2` +export CC=${CC:-"${HOST_COMPILER}${SDK_VERSION_NUM}-clang"} echo echo "Warnings related to headers being present but not usable are due to functions" @@ -47,9 +46,6 @@ else fi echo -env - PATH="$PATH" \ - "$MAKE_TOOLCHAIN" --force --api="$NDK_API_VERSION_COMPAT" \ - --arch="$ARCH" --install-dir="$TOOLCHAIN_DIR" || exit 1 if [ -z "$LIBSODIUM_FULL_BUILD" ]; then export LIBSODIUM_ENABLE_MINIMAL_FLAG="--enable-minimal" @@ -69,9 +65,6 @@ if [ "$NDK_PLATFORM" != "$NDK_PLATFORM_COMPAT" ]; then echo echo "Configuring again for platform [${NDK_PLATFORM}]" echo - env - PATH="$PATH" \ - "$MAKE_TOOLCHAIN" --force --api="$NDK_API_VERSION" \ - --arch="$ARCH" --install-dir="$TOOLCHAIN_DIR" || exit 1 ./configure \ --disable-soname-versions \ diff --git a/dist-build/android-mips32.sh b/dist-build/android-mips32.sh deleted file mode 100755 index ab5f6314..00000000 --- a/dist-build/android-mips32.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -export TARGET_ARCH=mips32 -export CFLAGS="-Os" -ARCH=mips HOST_COMPILER=mipsel-linux-android "$(dirname "$0")/android-build.sh" diff --git a/dist-build/android-mips64.sh b/dist-build/android-mips64.sh deleted file mode 100755 index 75dd6eaa..00000000 --- a/dist-build/android-mips64.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -export TARGET_ARCH=mips64r6 -export CFLAGS="-Os -march=${TARGET_ARCH}" -CC="mips64el-linux-android-gcc" NDK_PLATFORM=android-21 ARCH=mips64 HOST_COMPILER=mips64el-linux-android "$(dirname "$0")/android-build.sh"