aboutsummaryrefslogtreecommitdiffhomepage
path: root/platform_tools/android/bin
diff options
context:
space:
mode:
authorGravatar djsollen <djsollen@google.com>2016-03-07 12:30:47 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-07 12:30:47 -0800
commitf9deeb66d0941adfade8a24fc3b8217f9473bb1d (patch)
tree2d5d9e75507680c80c4d74c0e976d2f09e440311 /platform_tools/android/bin
parent71aca549914c868d50cd51ddff3fb7a5bfe250cd (diff)
Update android_make to support both --gcc and --clang options.
This CL also fixes all the errors that resulted from compiling with clang and ccache. BUG=skia:4948 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1774503004 Review URL: https://codereview.chromium.org/1774503004
Diffstat (limited to 'platform_tools/android/bin')
-rwxr-xr-xplatform_tools/android/bin/android_setup.sh10
-rwxr-xr-xplatform_tools/android/bin/utils/setup_toolchain.sh16
2 files changed, 18 insertions, 8 deletions
diff --git a/platform_tools/android/bin/android_setup.sh b/platform_tools/android/bin/android_setup.sh
index d9799c21bd..3af118ef65 100755
--- a/platform_tools/android/bin/android_setup.sh
+++ b/platform_tools/android/bin/android_setup.sh
@@ -12,6 +12,7 @@
set -e
BUILDTYPE=${BUILDTYPE-Debug}
+USE_CLANG="false"
while (( "$#" )); do
if [[ "$1" == "-d" ]]; then
@@ -29,9 +30,10 @@ while (( "$#" )); do
shift
elif [[ "$1" == "--release" ]]; then
BUILDTYPE=Release
+ elif [[ "$1" == "--gcc" ]]; then
+ USE_CLANG="false"
elif [[ "$1" == "--clang" ]]; then
- USE_CLANG="true"
- export GYP_DEFINES="skia_clang_build=1 $GYP_DEFINES"
+ USE_CLANG="true"
elif [[ "$1" == "--logcat" ]]; then
LOGCAT=1
elif [[ "$1" == "--verbose" ]]; then
@@ -42,6 +44,10 @@ while (( "$#" )); do
shift
done
+if [ "$USE_CLANG" == "true" ]; then
+ export GYP_DEFINES="skia_clang_build=1 $GYP_DEFINES"
+fi
+
function verbose {
if [[ -n $VERBOSE ]]; then
echo $@
diff --git a/platform_tools/android/bin/utils/setup_toolchain.sh b/platform_tools/android/bin/utils/setup_toolchain.sh
index a61b50727f..b423446812 100755
--- a/platform_tools/android/bin/utils/setup_toolchain.sh
+++ b/platform_tools/android/bin/utils/setup_toolchain.sh
@@ -99,7 +99,7 @@ CCACHE=${ANDROID_MAKE_CCACHE-$(which ccache || true)}
# should be compiled on Linux for performance reasons.
# TODO (msarett): Collect more information about this.
if [ $(uname) == "Linux" ]; then
- if [ -z $USE_CLANG ]; then
+ if [ "$USE_CLANG" != "true" ]; 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"
@@ -107,8 +107,6 @@ if [ $(uname) == "Linux" ]; then
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"
@@ -126,13 +124,11 @@ if [ $(uname) == "Linux" ]; then
exportVar OBJCOPY_host "objcopy"
exportVar STRIP_host "strip"
else
- if [ -z $USE_CLANG ]; then
+ if [ "$USE_CLANG" != "true" ]; 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"
@@ -153,4 +149,12 @@ if [ $(uname) == "Darwin" ]; then
ln -sf $ANDROID_TOOLCHAIN_PREFIX-as $ANDROID_TOOLCHAIN/as
fi
+# fix bug in the toolchain in order to enable ccache to work with clang
+if [ $(head -c 2 $ANDROID_TOOLCHAIN_PREFIX-clang) != "#!" ]; then
+ echo -e "#!/bin/bash\n$(cat $ANDROID_TOOLCHAIN_PREFIX-clang)" > $ANDROID_TOOLCHAIN_PREFIX-clang
+fi
+if [ $(head -c 2 $ANDROID_TOOLCHAIN_PREFIX-clang++) != "#!" ]; then
+ echo -e "#!/bin/bash\n$(cat $ANDROID_TOOLCHAIN_PREFIX-clang++)" > $ANDROID_TOOLCHAIN_PREFIX-clang++
+fi
+
exportVar PATH $ANDROID_TOOLCHAIN:$PATH