Android build script which supports target specification (#727) r=self

This commit is contained in:
Grisha Kruglov 2018-05-31 12:25:24 -07:00 committed by GitHub
parent 250e35b726
commit 93b7d25446
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 4 deletions

View file

@ -1,4 +0,0 @@
# This will eventually become a complete build script, not just for Android
cargo build -p mentat_ffi --target i686-linux-android --release
cargo build -p mentat_ffi --target armv7-linux-androideabi --release
cargo build -p mentat_ffi --target aarch64-linux-android --release

32
scripts/android_build.sh Executable file
View file

@ -0,0 +1,32 @@
#!/bin/bash
# This will eventually become a complete build script, not just for Android
set -e
declare -A android_targets
android_targets=(
["x86"]="i686-linux-android"
["arm"]="armv7-linux-androideabi"
["arm64"]="aarch64-linux-android"
)
if [ "$#" -eq 0 ]
then
selected_targets=(x86 arm arm64)
else
for target_arg in "$@"
do
[[ -z "${android_targets[$target_arg]+yes}" ]] && echo "Unrecognized target $target_arg. Supported targets: ${!android_targets[@]}" && exit 1
selected_targets=("${selected_targets[@]}" $target_arg)
done
fi
echo "Building selected targets: ${selected_targets[@]}."
for target in "${selected_targets[@]}"
do
echo "Building target $target. Signature: ${android_targets[$target]}"
cargo build -p mentat_ffi --target ${android_targets[$target]} --release
done