| OLD | NEW |
| 1 # Copyright 2015 Google Inc. | 1 # Copyright 2015 Google Inc. |
| 2 # | 2 # |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 #!/bin/bash | 6 #!/bin/bash |
| 7 # | 7 # |
| 8 # setup_toolchain.sh: Sets toolchain environment variables used by other scripts
. | 8 # setup_toolchain.sh: Sets toolchain environment variables used by other scripts
. |
| 9 | 9 |
| 10 # Fail-fast if anything in the script fails. | 10 # Fail-fast if anything in the script fails. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 TOOLCHAIN=$ANDROID_ARCH-$NDK-$API | 46 TOOLCHAIN=$ANDROID_ARCH-$NDK-$API |
| 47 HOST=`uname | tr '[A-Z]' '[a-z]'` | 47 HOST=`uname | tr '[A-Z]' '[a-z]'` |
| 48 | 48 |
| 49 exportVar ANDROID_TOOLCHAIN "${TOOLCHAINS}/${TOOLCHAIN}/bin" | 49 exportVar ANDROID_TOOLCHAIN "${TOOLCHAINS}/${TOOLCHAIN}/bin" |
| 50 | 50 |
| 51 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then | 51 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then |
| 52 mkdir -p $TOOLCHAINS | 52 mkdir -p $TOOLCHAINS |
| 53 pushd $TOOLCHAINS | 53 pushd $TOOLCHAINS |
| 54 curl -o $NDK.zip https://dl.google.com/android/repository/android-ndk-$NDK-$
HOST-x86_64.zip | 54 curl -o $NDK.zip https://dl.google.com/android/repository/android-ndk-$NDK-$
HOST-x86_64.zip |
| 55 unzip $NDK.zip | 55 unzip $NDK.zip |
| 56 UNZIPPED=android-ndk-$NDK-$HOST-x86_64.tar.bz2 | 56 UNZIPPED=android-ndk-$NDK |
| 57 ./$UNZIPPED/build/tools/make-standalone-toolchain.sh \ | 57 ./$UNZIPPED/build/tools/make-standalone-toolchain.sh \ |
| 58 --use-llvm \ | 58 --use-llvm \ |
| 59 --arch=$ANDROID_ARCH \ | 59 --arch=$ANDROID_ARCH \ |
| 60 --platform=android-$API \ | 60 --platform=android-$API \ |
| 61 --install_dir=$TOOLCHAIN | 61 --install_dir=$TOOLCHAIN |
| 62 cp $UNZIPPED/prebuilt/android-$ANDROID_ARCH/gdbserver/gdbserver $TOOLCHAIN | 62 cp $UNZIPPED/prebuilt/android-$ANDROID_ARCH/gdbserver/gdbserver $TOOLCHAIN |
| 63 cp $UNZIPPED/prebuilt/${HOST}-x86_64/bin/gdb $TOOLCHAIN |
| 63 rm $NDK.zip | 64 rm $NDK.zip |
| 64 rm -rf $UNZIPPED | 65 rm -rf $UNZIPPED |
| 65 popd | 66 popd |
| 66 fi | 67 fi |
| 67 | 68 |
| 68 verbose "Targeting NDK API $API (NDK Revision $NDK)" | 69 verbose "Targeting NDK API $API (NDK Revision $NDK)" |
| 69 } | 70 } |
| 70 | 71 |
| 71 #check to see if the toolchain has been defined and if not setup the default too
lchain | 72 #check to see if the toolchain has been defined and if not setup the default too
lchain |
| 72 if [ -z "$ANDROID_TOOLCHAIN" ]; then | 73 if [ -z "$ANDROID_TOOLCHAIN" ]; then |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 # Create symlinks for nm & readelf and add them to the path so that the ninja | 143 # Create symlinks for nm & readelf and add them to the path so that the ninja |
| 143 # build uses them instead of attempting to use the one on the system. | 144 # build uses them instead of attempting to use the one on the system. |
| 144 # This is required to build using ninja on a Mac. | 145 # This is required to build using ninja on a Mac. |
| 145 if [ $(uname) == "Darwin" ]; then | 146 if [ $(uname) == "Darwin" ]; then |
| 146 ln -sf $ANDROID_TOOLCHAIN_PREFIX-nm $ANDROID_TOOLCHAIN/nm | 147 ln -sf $ANDROID_TOOLCHAIN_PREFIX-nm $ANDROID_TOOLCHAIN/nm |
| 147 ln -sf $ANDROID_TOOLCHAIN_PREFIX-readelf $ANDROID_TOOLCHAIN/readelf | 148 ln -sf $ANDROID_TOOLCHAIN_PREFIX-readelf $ANDROID_TOOLCHAIN/readelf |
| 148 ln -sf $ANDROID_TOOLCHAIN_PREFIX-as $ANDROID_TOOLCHAIN/as | 149 ln -sf $ANDROID_TOOLCHAIN_PREFIX-as $ANDROID_TOOLCHAIN/as |
| 149 fi | 150 fi |
| 150 | 151 |
| 151 exportVar PATH $ANDROID_TOOLCHAIN:$PATH | 152 exportVar PATH $ANDROID_TOOLCHAIN:$PATH |
| OLD | NEW |