Skip to content

Commit

Permalink
Android NDK 15 (#510)
Browse files Browse the repository at this point in the history
`NDKABI?=9` is important for specifying something custom for testing.
  • Loading branch information
Frenzie committed Sep 17, 2017
1 parent 999741a commit ba97174
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 13 deletions.
19 changes: 12 additions & 7 deletions .ci/android_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ env:
- TARGET=android NDKREV=r9c
- TARGET=android NDKREV=r11c
- TARGET=android NDKREV=r12b
- TARGET=android NDKREV=r15c

addons:
apt:
Expand Down
7 changes: 7 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion Makefile.defs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions toolchain/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ba97174

Please sign in to comment.