OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 3 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Sets up environment for building Chromium on Android. Only Android NDK, | 7 # Sets up environment for building Chromium on Android. Only Android NDK, |
8 # Revision 6b on Linux or Mac is offically supported. | 8 # Revision 6b on Linux or Mac is offically supported. |
9 # | 9 # |
10 # To run this script, the system environment ANDROID_NDK_ROOT must be set | 10 # To run this script, the system environment ANDROID_NDK_ROOT must be set |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 if [ -z "${CHROME_SRC}" ]; then | 59 if [ -z "${CHROME_SRC}" ]; then |
60 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. | 60 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. |
61 export CHROME_SRC=$(readlink -f .) | 61 export CHROME_SRC=$(readlink -f .) |
62 fi | 62 fi |
63 | 63 |
64 if [ ! -d "${CHROME_SRC}" ]; then | 64 if [ ! -d "${CHROME_SRC}" ]; then |
65 echo "CHROME_SRC must be set to the path of Chrome source code." >& 2 | 65 echo "CHROME_SRC must be set to the path of Chrome source code." >& 2 |
66 return 1 | 66 return 1 |
67 fi | 67 fi |
68 | 68 |
69 make() { | |
70 # TODO(michaelbai): how to use ccache in NDK. | |
71 if [ -n "${USE_CCACHE}" ]; then | |
72 if [ -e "${PREBUILT_CCACHE_PATH}" ]; then | |
73 use_ccache_var="$PREBUILT_CCACHE_PATH " | |
74 else | |
75 use_ccache_var="" | |
76 fi | |
77 fi | |
78 # Only cross-compile if the build is being done either from Chromium's src/ | |
79 # directory, or through WebKit, in which case the WEBKIT_ANDROID_BUILD | |
80 # environment variable will be defined. WebKit uses a different directory. | |
81 if [ -f "$PWD/build/android/envsetup.sh" ] || | |
82 [ -n "${WEBKIT_ANDROID_BUILD}" ]; then | |
83 CC="${use_ccache_var}${CROSS_CC}" CXX="${use_ccache_var}${CROSS_CXX}" \ | |
84 LINK="${CROSS_LINK}" AR="${CROSS_AR}" RANLIB="${CROSS_RANLIB}" \ | |
85 command make $* | |
86 else | |
87 command make $* | |
88 fi | |
89 } | |
90 | |
91 # Performs a gyp_chromium run to convert gyp->Makefile for android code. | 69 # Performs a gyp_chromium run to convert gyp->Makefile for android code. |
92 android_gyp() { | 70 android_gyp() { |
93 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" | 71 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" |
94 } | 72 } |
95 | 73 |
96 firstword() { | 74 firstword() { |
97 echo "${1}" | 75 echo "${1}" |
98 } | 76 } |
99 | 77 |
100 export CROSS_AR="$(firstword "${ANDROID_TOOLCHAIN}"/*-ar)" | 78 export CROSS_AR="$(firstword "${ANDROID_TOOLCHAIN}"/*-ar)" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 export GYP_DEFINES="${DEFINES}" | 124 export GYP_DEFINES="${DEFINES}" |
147 | 125 |
148 # Use the "android" flavor of the Makefile generator for both Linux and OS X. | 126 # Use the "android" flavor of the Makefile generator for both Linux and OS X. |
149 export GYP_GENERATORS="make-android" | 127 export GYP_GENERATORS="make-android" |
150 | 128 |
151 # Use our All target as the default | 129 # Use our All target as the default |
152 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" | 130 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" |
153 | 131 |
154 # We want to use our version of "all" targets. | 132 # We want to use our version of "all" targets. |
155 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" | 133 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android.gyp" |
OLD | NEW |