| OLD | NEW |
| 1 function exportVar { | 1 function exportVar { |
| 2 NAME=$1 | 2 NAME=$1 |
| 3 VALUE=$2 | 3 VALUE=$2 |
| 4 echo export $NAME=\"$VALUE\" | 4 echo export $NAME=\"$VALUE\" |
| 5 export $NAME="$VALUE" | 5 export $NAME="$VALUE" |
| 6 } | 6 } |
| 7 | 7 |
| 8 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 8 SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" |
| 9 | 9 |
| 10 # A valid Android SDK installation is required to build the sample app. | 10 # A valid Android SDK installation is required to build the sample app. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 echo "Using Mac toolchain." | 58 echo "Using Mac toolchain." |
| 59 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-mac_v$API_LEVEL | 59 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-mac_v$API_LEVEL |
| 60 else | 60 else |
| 61 echo "Could not automatically determine toolchain! Defaulting to Linux." | 61 echo "Could not automatically determine toolchain! Defaulting to Linux." |
| 62 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL | 62 TOOLCHAIN_TYPE=ndk-r$NDK_REV-$ANDROID_ARCH-linux_v$API_LEVEL |
| 63 fi | 63 fi |
| 64 exportVar ANDROID_TOOLCHAIN ${TOOLCHAIN_DIR}/${TOOLCHAIN_TYPE}/bin | 64 exportVar ANDROID_TOOLCHAIN ${TOOLCHAIN_DIR}/${TOOLCHAIN_TYPE}/bin |
| 65 | 65 |
| 66 # if the toolchain doesn't exist on your machine then we need to fetch it | 66 # if the toolchain doesn't exist on your machine then we need to fetch it |
| 67 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then | 67 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then |
| 68 # gsutil must be installed on your system and in your PATH | |
| 69 gsutil version &> /dev/null | |
| 70 if [[ "$?" != "0" ]]; then | |
| 71 echo "ERROR: Unable to find gsutil. Please install it before proceeding." | |
| 72 exit 1 | |
| 73 fi | |
| 74 # create the toolchain directory if needed | 68 # create the toolchain directory if needed |
| 75 if [ ! -d "$TOOLCHAIN_DIR" ]; then | 69 if [ ! -d "$TOOLCHAIN_DIR" ]; then |
| 76 mkdir $TOOLCHAIN_DIR | 70 mkdir $TOOLCHAIN_DIR |
| 77 fi | 71 fi |
| 78 # enter the toolchain directory then download, unpack, and remove the tarball | 72 # enter the toolchain directory then download, unpack, and remove the tarball |
| 79 pushd $TOOLCHAIN_DIR | 73 pushd $TOOLCHAIN_DIR |
| 80 TARBALL=ndk-r$NDK_REV-v$API_LEVEL.tgz | 74 TARBALL=ndk-r$NDK_REV-v$API_LEVEL.tgz |
| 81 gsutil cp gs://chromium-skia-gm/android-toolchains/$TARBALL $TARBALL | 75 |
| 76 echo "Downloading $TARBALL ..." |
| 77 ${SCRIPT_DIR}/download_toolchains.py http://chromium-skia-gm.commondatastorage
.googleapis.com/android-toolchains/$TARBALL $TOOLCHAIN_DIR/$TARBALL |
| 78 if [[ "$?" != "0" ]]; then |
| 79 echo "ERROR: Unable to download toolchain $TARBALL." |
| 80 exit 1 |
| 81 fi |
| 82 |
| 82 echo "Untarring $TOOLCHAIN_TYPE from $TARBALL." | 83 echo "Untarring $TOOLCHAIN_TYPE from $TARBALL." |
| 83 tar -xzf $TARBALL $TOOLCHAIN_TYPE | 84 tar -xzf $TARBALL $TOOLCHAIN_TYPE |
| 84 echo "Removing $TARBALL" | 85 echo "Removing $TARBALL" |
| 85 rm $TARBALL | 86 rm $TARBALL |
| 86 popd | 87 popd |
| 87 fi | 88 fi |
| 88 | 89 |
| 89 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then | 90 if [ ! -d "$ANDROID_TOOLCHAIN" ]; then |
| 90 echo "ERROR: unable to download/setup the required toolchain (${TOOLCHAIN_TYPE
})" | 91 echo "ERROR: unable to download/setup the required toolchain (${TOOLCHAIN_TYPE
})" |
| 91 return 1; | 92 return 1; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 # Use the "android" flavor of the Makefile generator for both Linux and OS X. | 192 # Use the "android" flavor of the Makefile generator for both Linux and OS X. |
| 192 exportVar GYP_GENERATORS "make-android" | 193 exportVar GYP_GENERATORS "make-android" |
| 193 | 194 |
| 194 # Helper function so that when we run "make" to build for clank it exports | 195 # Helper function so that when we run "make" to build for clank it exports |
| 195 # the toolchain variables to make. | 196 # the toolchain variables to make. |
| 196 #make_android() { | 197 #make_android() { |
| 197 # CC="$CROSS_CC" CXX="$CROSS_CXX" LINK="$CROSS_LINK" \ | 198 # CC="$CROSS_CC" CXX="$CROSS_CXX" LINK="$CROSS_LINK" \ |
| 198 # AR="$CROSS_AR" RANLIB="$CROSS_RANLIB" \ | 199 # AR="$CROSS_AR" RANLIB="$CROSS_RANLIB" \ |
| 199 # command make $* | 200 # command make $* |
| 200 #} | 201 #} |
| OLD | NEW |