aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android
diff options
context:
space:
mode:
authorGravatar msarett <msarett@google.com>2015-07-21 12:01:48 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-07-21 12:01:48 -0700
commitcf2a6a47e4db5682798fe46f9e3ef14a27ff4b2b (patch)
treed928b4fd1197d8494de5f20fd3b89d836190adf6 /platform_tools/android
parent259fbf191625d504e20c7ede69d988735fc569ad (diff)
Reenable yasm for Android x86 and x86-64 on Linux host
It turns out that gyp (kind of) has support for cross compiling with a different host and target. We simply need to specify CC_host and CC_target instead of CC. Making this change allows us to compile yasm on a Linux host for Android. We run into problems on Mac because the linker on a Mac host requires different command line arguments than the linker on the Android target. In looking through the code for gyp itself and speaking to Ben, it doesn't appear to me that gyp supports passing different arguments to host and target linkers. I would imagine that we would have similar problems on Windows. Below is a link to a CL that would fix this issue in gyp. It looks like it has been dropped for a long time. Thanks to Ben for this link! https://chromiumcodereview.appspot.com/10795044/ Also I'm adding a link to the build instructions for Chrome (thanks again Ben). It looks like they only support building for Android from Linux. https://code.google.com/p/chromium/wiki/AndroidBuildInstructions My next steps are: 1) Getting in touch with Torne or someone else with gyp to see if people are aware of this issue or interested in fixing it. 2) Deciding if skia should care about this issue. 3) Deciding if skia should work around this issue. It'd be really great to hear your thoughts on (2) and (3). My first thought is that we shouldn't care because, as long as we always compile the production copy of skia for Android on Linux, we will get the fast code. Is this a valid conclusion? Is there a way to write Android apps on Mac that accidentally use the slower code? If we do care, there are workarounds: For Mac, we can check in a yasm binary - it's a little smaller than the one I am deleting in this CL :-/ For Windows, we *might* be able to use the yasm.exe binary already in externals (we get this from DEPS because this is how chromium uses yasm on Windows). Are there other platforms that we care about? Let me know what you think! BUG=skia:4028 DOCS_PREVIEW= https://skia.org/?cl=1239333002 Review URL: https://codereview.chromium.org/1239333002
Diffstat (limited to 'platform_tools/android')
-rwxr-xr-xplatform_tools/android/bin/utils/setup_toolchain.sh71
1 files changed, 57 insertions, 14 deletions
diff --git a/platform_tools/android/bin/utils/setup_toolchain.sh b/platform_tools/android/bin/utils/setup_toolchain.sh
index 6bb6b004ab..8164493bca 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.