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" |
(...skipping 21 matching lines...) Expand all Loading... |
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=L # Experimental Android L-Release 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-mac_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 |
47 exportVar ANDROID_TOOLCHAIN "${TOOLCHAIN_DIR}/${TOOLCHAIN_TYPE}/bin" | 47 exportVar ANDROID_TOOLCHAIN "${TOOLCHAIN_DIR}/${TOOLCHAIN_TYPE}/bin" |
48 | 48 |
49 # if the toolchain doesn't exist on your machine then we need to fetch it | 49 # if the toolchain doesn't exist on your machine then we need to fetch it |
50 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then | 50 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then |
51 mkdir -p $TOOLCHAIN_DIR | 51 mkdir -p $TOOLCHAIN_DIR |
52 # enter the toolchain directory then download, unpack, and remove the tarbal
l | 52 # enter the toolchain directory then download, unpack, and remove the tarbal
l |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 exportVar AR "$ANDROID_TOOLCHAIN_PREFIX-ar" | 91 exportVar AR "$ANDROID_TOOLCHAIN_PREFIX-ar" |
92 exportVar RANLIB "$ANDROID_TOOLCHAIN_PREFIX-ranlib" | 92 exportVar RANLIB "$ANDROID_TOOLCHAIN_PREFIX-ranlib" |
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 exportVar PATH $ANDROID_TOOLCHAIN:$PATH | 102 exportVar PATH $ANDROID_TOOLCHAIN:$PATH |
OLD | NEW |