OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # setup_toolchain.sh: Sets toolchain environment variables used by other scripts
. | 3 # setup_toolchain.sh: Sets toolchain environment variables used by other scripts
. |
4 | 4 |
5 # Fail-fast if anything in the script fails. | 5 # Fail-fast if anything in the script fails. |
6 set -e | 6 set -e |
7 | 7 |
8 # check that the preconditions for this script are met | 8 # check that the preconditions for this script are met |
9 if [ $(type -t verbose) != 'function' ]; then | 9 if [ $(type -t verbose) != 'function' ]; then |
10 echo "ERROR: The verbose function is expected to be defined" | 10 echo "ERROR: The verbose function is expected to be defined" |
11 return 1 | 11 return 1 |
12 fi | 12 fi |
13 | 13 |
14 if [ $(type -t exportVar) != 'function' ]; then | 14 if [ $(type -t exportVar) != 'function' ]; then |
15 echo "ERROR: The exportVar function is expected to be defined" | 15 echo "ERROR: The exportVar function is expected to be defined" |
16 return 1 | 16 return 1 |
17 fi | 17 fi |
18 | 18 |
19 if [ $(type -t absPath) != 'function' ]; then | 19 if [ $(type -t absPath) != 'function' ]; then |
20 echo "ERROR: The absPath function is expected to be defined" | 20 echo "ERROR: The absPath function is expected to be defined" |
21 return 1 | 21 return 1 |
22 fi | 22 fi |
23 | 23 |
24 if [ -z "$SCRIPT_DIR" ]; then | 24 if [ -z "$SCRIPT_DIR" ]; then |
25 echo "ERROR: The SCRIPT_DIR variable is expected to be defined" | 25 echo "ERROR: The SCRIPT_DIR variable is expected to be defined" |
26 return 1 | 26 return 1 |
27 fi | 27 fi |
28 | 28 |
29 function default_toolchain() { | 29 function default_toolchain() { |
30 NDK_REV=${NDK_REV-10exp} | 30 NDK_REV=${NDK_REV-10c} |
31 ANDROID_ARCH=${ANDROID_ARCH-arm} | 31 ANDROID_ARCH=${ANDROID_ARCH-arm} |
32 | 32 |
33 if [[ $ANDROID_ARCH == *64* ]]; then | 33 if [[ $ANDROID_ARCH == *64* ]]; then |
34 API_LEVEL=L # Experimental Android L-Release system images | 34 API_LEVEL=21 # Official Android 5.0 (Lollipop) system images |
35 else | 35 else |
36 API_LEVEL=14 # Official Android 4.0 system images | 36 API_LEVEL=14 # Official Android 4.0 system images |
37 fi | 37 fi |
38 | 38 |
39 TOOLCHAIN_DIR=${SCRIPT_DIR}/../toolchains | 39 TOOLCHAIN_DIR=${SCRIPT_DIR}/../toolchains |
40 if [ $(uname) == "Darwin" ]; then | 40 if [ $(uname) == "Darwin" ]; then |
41 verbose "Using Mac toolchain." | 41 verbose "Using Mac toolchain." |
42 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-darwin_v$API_LEVEL | 42 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-darwin_v$API_LEVEL |
43 else | 43 else |
44 verbose "Using Linux toolchain." | 44 verbose "Using Linux toolchain." |
45 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL | 45 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL |
46 fi | 46 fi |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 exportVar OBJCOPY "$ANDROID_TOOLCHAIN_PREFIX-objcopy" | 93 exportVar OBJCOPY "$ANDROID_TOOLCHAIN_PREFIX-objcopy" |
94 exportVar STRIP "$ANDROID_TOOLCHAIN_PREFIX-strip" | 94 exportVar STRIP "$ANDROID_TOOLCHAIN_PREFIX-strip" |
95 | 95 |
96 # Create symlinks for nm & readelf and add them to the path so that the ninja | 96 # Create symlinks for nm & readelf and add them to the path so that the ninja |
97 # build uses them instead of attempting to use the one on the system. | 97 # build uses them instead of attempting to use the one on the system. |
98 # This is required to build using ninja on a Mac. | 98 # This is required to build using ninja on a Mac. |
99 ln -sf $ANDROID_TOOLCHAIN_PREFIX-nm $ANDROID_TOOLCHAIN/nm | 99 ln -sf $ANDROID_TOOLCHAIN_PREFIX-nm $ANDROID_TOOLCHAIN/nm |
100 ln -sf $ANDROID_TOOLCHAIN_PREFIX-readelf $ANDROID_TOOLCHAIN/readelf | 100 ln -sf $ANDROID_TOOLCHAIN_PREFIX-readelf $ANDROID_TOOLCHAIN/readelf |
101 ln -sf $ANDROID_TOOLCHAIN_PREFIX-as $ANDROID_TOOLCHAIN/as | 101 ln -sf $ANDROID_TOOLCHAIN_PREFIX-as $ANDROID_TOOLCHAIN/as |
102 exportVar PATH $ANDROID_TOOLCHAIN:$PATH | 102 exportVar PATH $ANDROID_TOOLCHAIN:$PATH |
OLD | NEW |