|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
3 |
| -set -e |
4 |
| - |
5 | 3 | if [ -z "$ANDROID_NDK" ]; then
|
6 | 4 | echo "export the ANDROID_NDK environment variable"
|
7 | 5 | exit 1
|
8 | 6 | fi
|
9 | 7 |
|
| 8 | +# Allow the caller to specify which build to run |
| 9 | +abiToBuild="all" |
| 10 | +if [ -n "$ARCHS" ]; then |
| 11 | + abiRegex="^(all|armeabi-v7a|arm64-v8a|x86|x86_64)$" |
| 12 | + [[ $ARCHS =~ $abiRegex ]] |
| 13 | + |
| 14 | + if [[ $? == 0 ]]; then |
| 15 | + abiToBuild="$ARCHS" |
| 16 | + echo "manually selected ABI: $abiToBuild" |
| 17 | + else |
| 18 | + echo "invalid ARCHS environment variable, the following are accepted: all, armeabi-v7a, arm64-v8a, x86 or x86_64" |
| 19 | + exit 1 |
| 20 | + fi |
| 21 | +fi |
| 22 | + |
| 23 | +# Ensure all commands after this point exit upon erroring |
| 24 | +set -e |
| 25 | + |
10 | 26 | # Get the location of the android NDK build tools to build with
|
11 | 27 | asm=""
|
12 | 28 | if [ "$(uname)" == "Darwin" ]; then
|
@@ -66,10 +82,18 @@ build()
|
66 | 82 | make install
|
67 | 83 | }
|
68 | 84 |
|
69 |
| -build armeabi-v7a armv7a-linux-androideabi |
70 |
| -build arm64-v8a aarch64-linux-android |
71 |
| -build x86 i686-linux-android |
72 |
| -build x86-64 x86_64-linux-android |
| 85 | +if [[ $abiToBuild == "all" ]] || [[ $abiToBuild == "armeabi-v7a" ]]; then |
| 86 | + build armeabi-v7a armv7a-linux-androideabi |
| 87 | +fi |
| 88 | +if [[ $abiToBuild == "all" ]] || [[ $abiToBuild == "arm64-v8a" ]]; then |
| 89 | + build arm64-v8a aarch64-linux-android |
| 90 | +fi |
| 91 | +if [[ $abiToBuild == "all" ]] || [[ $abiToBuild == "x86" ]]; then |
| 92 | + build x86 i686-linux-android |
| 93 | +fi |
| 94 | +if [[ $abiToBuild == "all" ]] || [[ $abiToBuild == "x86_64" ]]; then |
| 95 | + build x86_64 x86_64-linux-android |
| 96 | +fi |
73 | 97 |
|
74 | 98 | make clean
|
75 | 99 |
|
|
0 commit comments