1#!/bin/sh 2set -ex 3 4URL=https://dl.google.com/android/repository 5 6download_ndk() { 7 mkdir -p /android/ndk 8 cd /android/ndk 9 curl -fO $URL/$1 10 unzip -q $1 11 rm $1 12 mv android-ndk-* ndk 13} 14 15make_standalone_toolchain() { 16 # See https://developer.android.com/ndk/guides/standalone_toolchain.htm 17 python3 /android/ndk/ndk/build/tools/make_standalone_toolchain.py \ 18 --install-dir /android/ndk/$1-$2 \ 19 --arch $1 \ 20 --api $2 21} 22 23remove_ndk() { 24 rm -rf /android/ndk/ndk 25} 26 27download_and_make_toolchain() { 28 download_ndk $1 && \ 29 make_standalone_toolchain $2 $3 && \ 30 remove_ndk 31} 32