forked from open-quantum-safe/liboqs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure-android
executable file
·56 lines (43 loc) · 1.3 KB
/
configure-android
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
53
54
55
#!/bin/bash
HOST="aarch64-linux-android"
ANDROID_NDK_TOOLCHAIN_DIR=""
#parse arguments
for arg in "$@"
do
case $arg in
-h=*|--host=*)
HOST="${arg#*=}"
shift
;;
-t=*|--toolchain=*)
ANDROID_NDK_TOOLCHAIN_DIR="${arg#*=}"
shift
;;
esac
done
#validate arguments
function print_help {
cat << EOF
Usage: $0 [OPTION]... [VAR=VALUE]...
--host=HOST cross-compile to build programs to run on HOST [default: aarch64-linux-android]
--toolchain=DIR Android NDK standalone toolchain
Example usage: $0 --host=aarch64-linux-android --toolchain=/ram/arm
EOF
exit 0
}
if [[ ! -d $ANDROID_NDK_TOOLCHAIN_DIR ]]; then
print_help
fi
# configure
ANDROID_NDK_ROOT=${ANDROID_NDK_TOOLCHAIN_DIR}
ANDROID_NDK_BIN="${ANDROID_NDK_ROOT}/bin"
ANDROID_SYSROOT_DIR="${ANDROID_NDK_ROOT}/sysroot"
COMPILER_PREFIX=$HOST
export CC=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-gcc
export CPP=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-cpp
export CXX=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-g++
export LD=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-ld
export AR=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-ar
export RANLIB=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-ranlib
export STRIP=${ANDROID_NDK_BIN}/${COMPILER_PREFIX}-strip
./configure --host="${COMPILER_PREFIX}" --disable-aes-ni --with-sysroot="${ANDROID_SYSROOT_DIR}"