forked from ghc-ios/ghc-ios-scripts
-
Notifications
You must be signed in to change notification settings - Fork 9
/
android-toolchain.config
47 lines (40 loc) · 2.41 KB
/
android-toolchain.config
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
# Android
ANDROID_NDK=${ANDROID_HOME:-$HOME/Library/Android/sdk}/ndk-bundle
ANDROID_API=24
ANDROID_GCC_VERSION=4.9
ANDROID_SYSROOT="${ANDROID_NDK}/sysroot"
lowercase () {
echo "$1" | tr '[:upper:]' '[:lower:]'
}
# Get the current <host>-<arch> name.
# Used to compute the android toolchain binary path (if needed).
ANDROID_BUILD_OS=$(lowercase $(uname -s))
ANDROID_BUILD_ARCH=$(lowercase $(uname -m))
ANDROID_BUILD=${ANDROID_BUILD_OS}-${ANDROID_BUILD_ARCH}
ANDROID_ARM_TRIPLE=arm-linux-androideabi
ANDROID_ARM_ARCH=arm
ANDROID_ARM_CFLAGS="--target=armv7-linux-androideabi"
ANDROID_ARM_CFLAGS+=" --sysroot ${ANDROID_SYSROOT}"
ANDROID_ARM_CFLAGS+=" -isystem ${ANDROID_NDK}/sysroot/usr/include/${ANDROID_ARM_TRIPLE}"
ANDROID_ARM_CFLAGS+=" -D__ANDROID_API__=${ANDROID_API}"
ANDROID_ARM_LDFLAGS="--sysroot=${ANDROID_NDK}/platforms/android-${ANDROID_API}/arch-${ANDROID_ARM_ARCH}"
ANDROID_ARM_PATH="${ANDROID_NDK}/toolchains/llvm/prebuilt/${ANDROID_BUILD}/bin"
ANDROID_ARM_PATH+=":${ANDROID_NDK}/toolchains/${ANDROID_ARM_TRIPLE}-${ANDROID_GCC_VERSION}/prebuilt/${ANDROID_BUILD}/${ANDROID_ARM_TRIPLE}/bin"
ANDROID_ARM64_TRIPLE=aarch64-linux-android
ANDROID_ARM64_ARCH=arm64
ANDROID_ARM64_CFLAGS="--target=${ANDROID_ARM64_TRIPLE}"
ANDROID_ARM64_CFLAGS+=" --sysroot ${ANDROID_SYSROOT}"
ANDROID_ARM64_CFLAGS+=" -isystem ${ANDROID_NDK}/sysroot/usr/include/${ANDROID_ARM64_TRIPLE}"
ANDROID_ARM64_CFLAGS+=" -D__ANDROID_API__=${ANDROID_API}"
ANDROID_ARM64_LDFLAGS="--sysroot ${ANDROID_NDK}/platforms/android-${ANDROID_API}/arch-${ANDROID_ARM64_TRIPLE}/"
ANDROID_ARM64_PATH="${ANDROID_NDK}/toolchains/llvm/prebuilt/${ANDROID_BUILD}/bin"
ANDROID_ARM64_PATH+=":${ANDROID_NDK}/toolchains/${ANDROID_ARM64_TRIPLE}-${ANDROID_GCC_VERSION}/prebuilt/${ANDROID_BUILD}/${ANDROID_ARM64_TRIPLE}/bin"
ANDROID_X86_64_TRIPLE=x86_64-linux-android
ANDROID_X86_64_ARCH=x86_64
ANDROID_X86_64_CFLAGS="--target=${ANDROID_X86_64_TRIPLE}"
ANDROID_X86_64_CFLAGS+=" --sysroot ${ANDROID_SYSROOT}"
ANDROID_X86_64_CFLAGS+=" -isystem ${ANDROID_NDK}/sysroot/usr/include/${ANDROID_X86_64_TRIPLE}"
ANDROID_X86_64_CFLAGS+=" -D__ANDROID_API__=${ANDROID_API}"
ANDROID_X86_64_LDFLAGS="--sysroot ${ANDROID_NDK}/platforms/android-${ANDROID_API}/arch-${ANDROID_X86_64_ARCH}/"
ANDROID_X86_64_PATH="${ANDROID_NDK}/toolchains/llvm/prebuilt/${ANDROID_BUILD}/bin"
ANDROID_X86_64_PATH+=":${ANDROID_NDK}/toolchains/${ANDROID_X86_64_ARCH}-${ANDROID_GCC_VERSION}/prebuilt/${ANDROID_BUILD}/${ANDROID_X86_64_TRIPLE}/bin"