forked from mozilla/application-services
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-all-android.sh
executable file
·52 lines (44 loc) · 1.75 KB
/
build-all-android.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/usr/bin/env bash
set -euvx
abspath () { case "$1" in /*)printf "%s\\n" "$1";; *)printf "%s\\n" "$PWD/$1";; esac; }
export -f abspath
# Our short-names for the architectures.
TARGET_ARCHS=("x86" "arm64" "arm")
# The directories required for the Android-Gradle plugin and APK
# layout, like `jniLibs/x86` or `lib/x86` respectively.
TARGET_ARCHS_DISTS=("x86" "arm64-v8a" "armeabi-v7a")
# The corresponding Rust target names.
TARGET_ARCHS_TOOLCHAINS=("i686-linux-android" "aarch64-linux-android" "arm-linux-androideabi")
# End of configuration.
if [ "$#" -ne 2 ]
then
echo "Usage:"
echo "./build-all-android.sh <OPENSSL_SRC_PATH> <SQLCIPHER_SRC_PATH>"
exit 1
fi
source "$(dirname "$0")/android_defaults.sh"
OPENSSL_SRC_PATH=$1
SQLCIPHER_SRC_PATH=$2
echo "# Building openssl"
for i in "${!TARGET_ARCHS[@]}"; do
ARCH=${TARGET_ARCHS[$i]}
DIST=${TARGET_ARCHS_DISTS[$i]}
DIST_DIR=$(abspath "android/""$DIST""/openssl")
if [ -d "$DIST_DIR" ]; then
echo "$DIST_DIR already exists. Skipping building openssl."
else
./build-openssl-android.sh "$OPENSSL_SRC_PATH" "$DIST_DIR" "$ANDROID_NDK_TOOLCHAIN_DIR/$ARCH-$ANDROID_NDK_API_VERSION" "${TARGET_ARCHS_TOOLCHAINS[$i]}" "$ANDROID_NDK_API_VERSION" || exit 1
fi
done
echo "# Building sqlcipher"
for i in "${!TARGET_ARCHS[@]}"; do
ARCH=${TARGET_ARCHS[$i]}
DIST=${TARGET_ARCHS_DISTS[$i]}
OPENSSL_DIR=$(abspath "android/""$DIST""/openssl")
DIST_DIR=$(abspath "android/""$DIST""/sqlcipher")
if [ -d "$DIST_DIR" ]; then
echo "$DIST_DIR already exists. Skipping building sqlcipher."
else
./build-sqlcipher-android.sh "$SQLCIPHER_SRC_PATH" "$DIST_DIR" "$ANDROID_NDK_TOOLCHAIN_DIR/$ARCH-$ANDROID_NDK_API_VERSION" "${TARGET_ARCHS_TOOLCHAINS[$i]}" "$ANDROID_NDK_API_VERSION" "$OPENSSL_DIR" || exit 1
fi
done