Index: platform_tools/android/bin/utils/setup_toolchain.sh |
diff --git a/platform_tools/android/bin/utils/setup_toolchain.sh b/platform_tools/android/bin/utils/setup_toolchain.sh |
index 6bb6b004ab2e6653a766f455d06d8f3457be18e0..8164493bca56749296b73b822d8a9b840984a675 100755 |
--- a/platform_tools/android/bin/utils/setup_toolchain.sh |
+++ b/platform_tools/android/bin/utils/setup_toolchain.sh |
@@ -1,3 +1,8 @@ |
+# Copyright 2015 Google Inc. |
+# |
+# Use of this source code is governed by a BSD-style license that can be |
+# found in the LICENSE file. |
+ |
#!/bin/bash |
# |
# setup_toolchain.sh: Sets toolchain environment variables used by other scripts. |
@@ -90,22 +95,60 @@ ANDROID_TOOLCHAIN_PREFIX=${GCC%%-gcc} |
CCACHE=${ANDROID_MAKE_CCACHE-$(which ccache || true)} |
-if [ -z $USE_CLANG ]; then |
- exportVar CC "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-gcc" |
- exportVar CXX "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-g++" |
- exportVar LINK "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-gcc" |
+# Cross compiling Android on Mac is not currently supported by gyp. |
+# It doesn't appear to be supported on Windows either. |
+# As of now, we will only support cross compiling on Linux. |
+# libjpeg-turbo assembly code for x86 and x86-64 Android devices |
+# must be disabled for Android on non-Linux platforms because |
+# of this issue. We still support compiling on Mac and other |
+# variants for local development, but shipping versions of Skia |
+# should be compiled on Linux for performance reasons. |
+# TODO (msarett): Collect more information about this. |
+if [ $(uname) == "Linux" ]; then |
+ if [ -z $USE_CLANG ]; then |
+ exportVar CC_target "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-gcc" |
+ exportVar CXX_target "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-g++" |
+ exportVar LINK_target "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-gcc" |
+ exportVar CC_host "$CCACHE cc" |
+ exportVar CXX_host "$CCACHE c++" |
+ exportVar LINK_host "$CCACHE cc" |
+ else |
+ # temporarily disable ccache as it is generating errors |
+ CCACHE="" |
+ exportVar CC_target "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-clang" |
+ exportVar CXX_target "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-clang++" |
+ exportVar LINK_target "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-clang" |
+ exportVar CC_host "$CCACHE clang" |
+ exportVar CXX_host "$CCACHE clang++" |
+ exportVar LINK_host "$CCACHE clang" |
+ fi |
+ |
+ exportVar AR_target "$ANDROID_TOOLCHAIN_PREFIX-ar" |
+ exportVar RANLIB_target "$ANDROID_TOOLCHAIN_PREFIX-ranlib" |
+ exportVar OBJCOPY_target "$ANDROID_TOOLCHAIN_PREFIX-objcopy" |
+ exportVar STRIP_target "$ANDROID_TOOLCHAIN_PREFIX-strip" |
+ exportVar AR_host "ar" |
+ exportVar RANLIB_host "ranlib" |
+ exportVar OBJCOPY_host "objcopy" |
+ exportVar STRIP_host "strip" |
else |
- # temporarily disable ccache as it is generating errors |
- CCACHE="" |
- exportVar CC "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-clang" |
- exportVar CXX "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-clang++" |
- exportVar LINK "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-clang" |
-fi |
+ if [ -z $USE_CLANG ]; then |
+ exportVar CC "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-gcc" |
+ exportVar CXX "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-g++" |
+ exportVar LINK "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-gcc" |
+ else |
+ # temporarily disable ccache as it is generating errors |
+ CCACHE="" |
+ exportVar CC "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-clang" |
+ exportVar CXX "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-clang++" |
+ exportVar LINK "$CCACHE $ANDROID_TOOLCHAIN_PREFIX-clang" |
+ fi |
-exportVar AR "$ANDROID_TOOLCHAIN_PREFIX-ar" |
-exportVar RANLIB "$ANDROID_TOOLCHAIN_PREFIX-ranlib" |
-exportVar OBJCOPY "$ANDROID_TOOLCHAIN_PREFIX-objcopy" |
-exportVar STRIP "$ANDROID_TOOLCHAIN_PREFIX-strip" |
+ exportVar AR "$ANDROID_TOOLCHAIN_PREFIX-ar" |
+ exportVar RANLIB "$ANDROID_TOOLCHAIN_PREFIX-ranlib" |
+ exportVar OBJCOPY "$ANDROID_TOOLCHAIN_PREFIX-objcopy" |
+ exportVar STRIP "$ANDROID_TOOLCHAIN_PREFIX-strip" |
+fi |
# Create symlinks for nm & readelf and add them to the path so that the ninja |
# build uses them instead of attempting to use the one on the system. |