From ba97174c9a73754ec6e7b7ee38d7ecddd7fce0cb Mon Sep 17 00:00:00 2001 From: Frans de Jonge Date: Sun, 17 Sep 2017 15:31:38 +0200 Subject: [PATCH] Android NDK 15 (#510) `NDKABI?=9` is important for specifying something custom for testing. --- .ci/android_install.sh | 19 ++++++++++++------- .travis.yml | 1 + Makefile | 7 +++++++ Makefile.defs | 3 ++- toolchain/Makefile | 13 ++++++++----- 5 files changed, 30 insertions(+), 13 deletions(-) diff --git a/.ci/android_install.sh b/.ci/android_install.sh index 70002b831..b35e37685 100755 --- a/.ci/android_install.sh +++ b/.ci/android_install.sh @@ -6,19 +6,24 @@ sudo apt-get update sudo apt-get install zlib1g:i386 libc6-dev-i386 linux-libc-dev:i386 if [ "$NDKREV" = "r9c" ]; then - curl -L http://dl.google.com/android/ndk/android-ndk-${NDKREV}-linux-x86_64.tar.bz2 -O + curl -L "http://dl.google.com/android/ndk/android-ndk-${NDKREV}-linux-x86_64.tar.bz2" -O echo "extracting android ndk" - bzip2 -dc android-ndk-${NDKREV}-linux-x86_64.tar.bz2 | tar xf - + bzip2 -dc "android-ndk-${NDKREV}-linux-x86_64.tar.bz2" | tar xf - elif [ "$NDKREV" = "r11c" ]; then - curl -L http://dl.google.com/android/repository/android-ndk-${NDKREV}-linux-x86_64.zip -O + curl -L "http://dl.google.com/android/repository/android-ndk-${NDKREV}-linux-x86_64.zip" -O echo "extracting android ndk" - unzip -q android-ndk-${NDKREV}-linux-x86_64.zip + unzip -q "android-ndk-${NDKREV}-linux-x86_64.zip" elif [ "$NDKREV" = "r12b" ]; then - wget https://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip + wget "https://dl.google.com/android/repository/android-ndk-${NDKREV}-linux-x86_64.zip" echo "extracting android ndk" - unzip -q android-ndk-${NDKREV}-linux-x86_64.zip + unzip -q "android-ndk-${NDKREV}-linux-x86_64.zip" +elif [ "$NDKREV" = "r15c" ]; then + wget "https://dl.google.com/android/repository/android-ndk-${NDKREV}-linux-x86_64.zip" + echo "extracting android ndk" + unzip -q "android-ndk-${NDKREV}-linux-x86_64.zip" fi -export NDK=`pwd`/android-ndk-${NDKREV} +NDK=$(pwd)/android-ndk-${NDKREV} +export NDK export PATH=$PATH:${NDK} make android-toolchain diff --git a/.travis.yml b/.travis.yml index fe9683ce5..8576f10dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,6 +22,7 @@ env: - TARGET=android NDKREV=r9c - TARGET=android NDKREV=r11c - TARGET=android NDKREV=r12b + - TARGET=android NDKREV=r15c addons: apt: diff --git a/Makefile b/Makefile index 9e681387f..9b8a91dbb 100644 --- a/Makefile +++ b/Makefile @@ -141,15 +141,22 @@ $(OUTPUT_DIR)/extr: extr.c $(MUPDF_LIB) $(MUPDF_DIR)/include $(JPEG_LIB) $(FREET # helper target for creating standalone android toolchain from NDK # NDK variable should be set in your environment and it should point to # the root directory of the NDK +# +# make-standalone-toolchain.sh is obsolete, for NDK <=11 +# --deprecated-headers is necessary in NDK 15, but will fail in 12-14 android-toolchain: +ifneq ($(wildcard $(NDK)/build/tools),) ifeq ($(wildcard $(NDK)/build/tools/make_standalone_toolchain.py),) install -d $(ANDROID_TOOLCHAIN) $(NDK)/build/tools/make-standalone-toolchain.sh --platform=android-$(NDKABI) \ --install-dir=$(ANDROID_TOOLCHAIN) else + $(NDK)/build/tools/make_standalone_toolchain.py --force --install-dir=$(ANDROID_TOOLCHAIN) \ + --arch arm --api $(NDKABI) --deprecated-headers || \ $(NDK)/build/tools/make_standalone_toolchain.py --force --install-dir=$(ANDROID_TOOLCHAIN) \ --arch arm --api $(NDKABI) endif +endif # =========================================================================== # helper target for creating standalone pocket toolchain from diff --git a/Makefile.defs b/Makefile.defs index c15ee876a..7cd634fd3 100644 --- a/Makefile.defs +++ b/Makefile.defs @@ -14,7 +14,8 @@ MAKEFILE_DIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) TOOLCHAIN_DIR=$(MAKEFILE_DIR)toolchain POCKETBOOK_TOOLCHAIN=$(TOOLCHAIN_DIR)/pocketbook-toolchain ANDROID_TOOLCHAIN=$(TOOLCHAIN_DIR)/android-toolchain -NDKABI=9 +NDK?=$(TOOLCHAIN_DIR)/android-ndk-r15c +NDKABI?=9 # CMAKE=cmake --no-warn-unused-cli CMAKE=cmake diff --git a/toolchain/Makefile b/toolchain/Makefile index ec2ad1a85..65f6516a2 100644 --- a/toolchain/Makefile +++ b/toolchain/Makefile @@ -12,17 +12,20 @@ android-sdk: [[ "$$CHECKSUM" = $(SDK_SUM) ]] || \ { echo "$(SDK_TARBALL) has the wrong checksum!"; exit 1; } tar xvf $(SDK_TARBALL) + pushd android-sdk-linux/tools && \ + ./android update sdk -u --filter "platform-tools,build-tools-26.0.1,android-14,android-19" && \ + popd rm -f $(SDK_TARBALL) -NDK_DL_URL=https://dl.google.com/android/repository/android-ndk-r12b-linux-x86_64.zip -NDK_TARBALL=android-ndk-r12b-linux-x86_64.zip -NDK_SUM="1d1a5ee71a5123be01e0dd9adb5df80d" -NDK_DIR=android-ndk-r12b +NDK_DL_URL=https://dl.google.com/android/repository/android-ndk-r15c-linux-x86_64.zip +NDK_TARBALL=android-ndk-r15c-linux-x86_64.zip +NDK_SUM="0bf02d4e8b85fd770fd7b9b2cdec57f9441f27a2" +NDK_DIR=android-ndk-r15c android-ndk: [ -e $(NDK_TARBALL) ] || wget $(NDK_DL_URL) - CHECKSUM=`md5sum $(NDK_TARBALL) | awk '{ print $$1 }'`; \ + CHECKSUM=`sha1sum $(NDK_TARBALL) | awk '{ print $$1 }'`; \ [[ "$$CHECKSUM" = $(NDK_SUM) ]] || \ { echo "$(NDK_TARBALL) has the wrong checksum!"; exit 1; } unzip $(NDK_TARBALL)