-
Notifications
You must be signed in to change notification settings - Fork 2
/
common.sh
68 lines (60 loc) · 1.47 KB
/
common.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Don't mess up the shell if this is interactive.
if [ -z "$PS1" ]; then
if [ -n "$VERBOSE" ]; then
set -x
fi
set -e
fi
NDK=${PWD/ndk\/*/ndk}
: ${LLVM_VERSION:=3.4}
: ${API_VERSION:=9}
: ${TOOLCHAIN:=clang++}
: ${BUILD_DIR:="/tmp/ndk-libcxx-${TOOLCHAIN}"}
: ${INSTALL_DIR:="/tmp/ndk-api${API_VERSION}-arm-${TOOLCHAIN}"}
: ${SRC_DIR:="/tmp/ndk-${USER}"}
: ${NDK_DOWNLOAD_DIR:="/tmp/ndk-${USER}-download"}
: ${ABIS:=armeabi-v7a}
if [ -z "${PLATFORM}" ]; then
case $OSTYPE in
darwin*)
PLATFORM="mac"
;;
linux*)
PLATFORM="linux"
;;
esac
fi
case $PLATFORM in
mac)
TOOLCHAIN_PLATFORM="darwin"
PARALLEL=$(sysctl -n hw.ncpu)
;;
linux)
TOOLCHAIN_PLATFORM="linux"
PARALLEL=$(grep -c -e processor /proc/cpuinfo)
;;
esac
ANDROID_TOOLCHAIN_ROOT="android-ndk-r${API_VERSION}d"
ANDROID_TOOLCHAIN_X86_TARBZ="${ANDROID_TOOLCHAIN_ROOT}-${TOOLCHAIN_PLATFORM}-x86.tar.bz2"
ANDROID_TOOLCHAIN_X86_64_TARBZ="${ANDROID_TOOLCHAIN_ROOT}-${TOOLCHAIN_PLATFORM}-x86_64.tar.bz2"
# Needed by various android build scripts. Tells them we're using clang.
if [ "${TOOLCHAIN}" = "clang++" ]; then
export LLVM_VERSION
fi
# Turn off some functionality if bootstraping for first checkout.
if [ -z "$BOOTSTRAP_CHECKOUT" ]; then
if [[ ! "${NDK}" =~ '/ndk' ]]; then
echo "Must be somewhere under your /ndk directory"
exit 1
fi
function ndk {
if [ -z $1 ]; then
cd ${NDK}
else
pushd ${NDK}
eval $*
popd
fi
}
fi