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 # Defines functions for envsetup.sh which sets up environment for building | 7 # Defines functions for envsetup.sh which sets up environment for building |
8 # Chromium on Android. The build can be either use the Android NDK/SDK or | 8 # Chromium on Android. The build can be either use the Android NDK/SDK or |
9 # android source tree. Each has a unique init function which calls functions | 9 # android source tree. Each has a unique init function which calls functions |
10 # prefixed with "common_" that is common for both environment setups. | 10 # prefixed with "common_" that is common for both environment setups. |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 # Sets android specific directories to NOT_SDK_COMPLIANT. This will allow | 196 # Sets android specific directories to NOT_SDK_COMPLIANT. This will allow |
197 # android_gyp to generate make files, but will cause errors when (and only | 197 # android_gyp to generate make files, but will cause errors when (and only |
198 # when) building targets that depend on these directories. | 198 # when) building targets that depend on these directories. |
199 DEFINES+=" android_src='NOT_SDK_COMPLIANT'" | 199 DEFINES+=" android_src='NOT_SDK_COMPLIANT'" |
200 DEFINES+=" android_product_out=${CHROME_SRC}/out/android" | 200 DEFINES+=" android_product_out=${CHROME_SRC}/out/android" |
201 DEFINES+=" android_lib='NOT_SDK_COMPLIANT'" | 201 DEFINES+=" android_lib='NOT_SDK_COMPLIANT'" |
202 DEFINES+=" android_static_lib='NOT_SDK_COMPLIANT'" | 202 DEFINES+=" android_static_lib='NOT_SDK_COMPLIANT'" |
203 DEFINES+=\ | 203 DEFINES+=\ |
204 " android_sdk=${ANDROID_SDK_ROOT}/platforms/android-${ANDROID_SDK_VERSION}" | 204 " android_sdk=${ANDROID_SDK_ROOT}/platforms/android-${ANDROID_SDK_VERSION}" |
| 205 DEFINES+=" android_sdk_root=${ANDROID_SDK_ROOT}" |
205 DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/platform-tools" | 206 DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/platform-tools" |
| 207 DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}" |
| 208 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" |
206 | 209 |
207 common_gyp_vars | 210 common_gyp_vars |
208 | 211 |
209 if [ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]; then | 212 if [ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]; then |
210 # Can not build WebView with NDK/SDK because it needs the Android build | 213 # Can not build WebView with NDK/SDK because it needs the Android build |
211 # system and build inside an Android source tree. | 214 # system and build inside an Android source tree. |
212 echo "Can not build WebView with NDK/SDK. Requires android source tree." \ | 215 echo "Can not build WebView with NDK/SDK. Requires android source tree." \ |
213 >& 2 | 216 >& 2 |
214 echo "Try . build/android/envsetup.sh instead." >& 2 | 217 echo "Try . build/android/envsetup.sh instead." >& 2 |
215 return 1 | 218 return 1 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 DEFINES+=" android_product_out=${ANDROID_PRODUCT_OUT}" | 252 DEFINES+=" android_product_out=${ANDROID_PRODUCT_OUT}" |
250 | 253 |
251 if [ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]; then | 254 if [ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]; then |
252 webview_build_init | 255 webview_build_init |
253 return | 256 return |
254 fi | 257 fi |
255 | 258 |
256 # The non-SDK build currently requires the SDK path to build the framework | 259 # The non-SDK build currently requires the SDK path to build the framework |
257 # Java aidl files. TODO(steveblock): Investigate avoiding this requirement. | 260 # Java aidl files. TODO(steveblock): Investigate avoiding this requirement. |
258 DEFINES+=" android_sdk=${ANDROID_SDK_ROOT}" | 261 DEFINES+=" android_sdk=${ANDROID_SDK_ROOT}" |
| 262 DEFINES+=" android_sdk_root=${ANDROID_SDK_ROOT}" |
259 DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/../tools/linux" | 263 DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/../tools/linux" |
| 264 DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}" |
| 265 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" |
260 | 266 |
261 common_gyp_vars | 267 common_gyp_vars |
262 } | 268 } |
263 | 269 |
264 ################################################################################ | 270 ################################################################################ |
265 # To build WebView, we use the Android build system and build inside an Android | 271 # To build WebView, we use the Android build system and build inside an Android |
266 # source tree. This method is called from non_sdk_build_init() and adds to the | 272 # source tree. This method is called from non_sdk_build_init() and adds to the |
267 # settings specified there. | 273 # settings specified there. |
268 ############################################################################# | 274 ############################################################################# |
269 webview_build_init() { | 275 webview_build_init() { |
270 # We need to supply SDK paths relative to the top of the Android tree to make | 276 # We need to supply SDK paths relative to the top of the Android tree to make |
271 # sure the generated Android makefiles are portable, as they will be checked | 277 # sure the generated Android makefiles are portable, as they will be checked |
272 # into the Android tree. | 278 # into the Android tree. |
273 ANDROID_SDK=$(python -c \ | 279 ANDROID_SDK=$(python -c \ |
274 "import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', '${TOP}')") | 280 "import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', '${TOP}')") |
275 ANDROID_SDK_TOOLS=$(python -c \ | 281 ANDROID_SDK_TOOLS=$(python -c \ |
276 "import os.path; \ | 282 "import os.path; \ |
277 print os.path.relpath('${ANDROID_SDK_ROOT}/../tools/linux', \ | 283 print os.path.relpath('${ANDROID_SDK_ROOT}/../tools/linux', \ |
278 '${TOP}')") | 284 '${TOP}')") |
279 DEFINES+=" android_build_type=1" | 285 DEFINES+=" android_build_type=1" |
280 DEFINES+=" android_upstream_bringup=1" | 286 DEFINES+=" android_upstream_bringup=1" |
281 DEFINES+=" android_sdk=\$(GYP_ABS_ANDROID_TOP_DIR)/${ANDROID_SDK}" | 287 DEFINES+=" android_sdk=\$(GYP_ABS_ANDROID_TOP_DIR)/${ANDROID_SDK}" |
| 288 DEFINES+=" android_sdk_root=${ANDROID_SDK_ROOT}" |
282 DEFINES+=" android_sdk_tools=\$(GYP_ABS_ANDROID_TOP_DIR)/${ANDROID_SDK_TOOLS}" | 289 DEFINES+=" android_sdk_tools=\$(GYP_ABS_ANDROID_TOP_DIR)/${ANDROID_SDK_TOOLS}" |
| 290 DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}" |
| 291 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" |
283 export GYP_DEFINES="${DEFINES}" | 292 export GYP_DEFINES="${DEFINES}" |
284 | 293 |
285 export GYP_GENERATORS="android" | 294 export GYP_GENERATORS="android" |
286 | 295 |
287 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" | 296 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" |
288 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} limit_to_target_all=1" | 297 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} limit_to_target_all=1" |
289 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} auto_regeneration=0" | 298 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} auto_regeneration=0" |
290 | 299 |
291 # TODO(torne): This isn't upstream yet. Upstream it or remove this setting. | 300 # TODO(torne): This isn't upstream yet. Upstream it or remove this setting. |
292 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android_webview.gyp" | 301 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android_webview.gyp" |
293 } | 302 } |
OLD | NEW |