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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 # Set only if not already set. | 55 # Set only if not already set. |
56 # Don't override ANDROID_TOOLCHAIN if set by Android configuration env. | 56 # Don't override ANDROID_TOOLCHAIN if set by Android configuration env. |
57 export ANDROID_TOOLCHAIN=${ANDROID_TOOLCHAIN:-${toolchain_path}} | 57 export ANDROID_TOOLCHAIN=${ANDROID_TOOLCHAIN:-${toolchain_path}} |
58 | 58 |
59 common_check_toolchain | 59 common_check_toolchain |
60 | 60 |
61 # Add Android SDK/NDK tools to system path. | 61 # Add Android SDK/NDK tools to system path. |
62 export PATH=$PATH:${ANDROID_NDK_ROOT} | 62 export PATH=$PATH:${ANDROID_NDK_ROOT} |
63 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools | 63 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools |
64 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools | 64 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools |
| 65 export PATH=$PATH:${ANDROID_SDK_ROOT}/build-tools/\ |
| 66 ${ANDROID_SDK_BUILD_TOOLS_VERSION} |
65 | 67 |
66 # This must be set before ANDROID_TOOLCHAIN, so that clang could find the | 68 # This must be set before ANDROID_TOOLCHAIN, so that clang could find the |
67 # gold linker. | 69 # gold linker. |
68 # TODO(michaelbai): Remove this path once the gold linker become the default | 70 # TODO(michaelbai): Remove this path once the gold linker become the default |
69 # linker. | 71 # linker. |
70 export PATH=$PATH:${CHROME_SRC}/build/android/${toolchain_arch}-gold | 72 export PATH=$PATH:${CHROME_SRC}/build/android/${toolchain_arch}-gold |
71 | 73 |
72 # Must have tools like arm-linux-androideabi-gcc on the path for ninja | 74 # Must have tools like arm-linux-androideabi-gcc on the path for ninja |
73 export PATH=$PATH:${ANDROID_TOOLCHAIN} | 75 export PATH=$PATH:${ANDROID_TOOLCHAIN} |
74 | 76 |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 # environment ANDROID_NDK_ROOT must be set to Android NDK's root path. The | 211 # environment ANDROID_NDK_ROOT must be set to Android NDK's root path. The |
210 # ANDROID_SDK_ROOT only needs to be set to override the default SDK which is in | 212 # ANDROID_SDK_ROOT only needs to be set to override the default SDK which is in |
211 # the tree under $ROOT/src/third_party/android_tools/sdk. | 213 # the tree under $ROOT/src/third_party/android_tools/sdk. |
212 # To build Chromium for Android with NDK/SDK follow the steps below: | 214 # To build Chromium for Android with NDK/SDK follow the steps below: |
213 # > export ANDROID_NDK_ROOT=<android ndk root> | 215 # > export ANDROID_NDK_ROOT=<android ndk root> |
214 # > export ANDROID_SDK_ROOT=<android sdk root> # to override the default sdk | 216 # > export ANDROID_SDK_ROOT=<android sdk root> # to override the default sdk |
215 # > . build/android/envsetup.sh | 217 # > . build/android/envsetup.sh |
216 # > make | 218 # > make |
217 ################################################################################ | 219 ################################################################################ |
218 sdk_build_init() { | 220 sdk_build_init() { |
| 221 export ANDROID_SDK_VERSION=18 |
| 222 export ANDROID_SDK_BUILD_TOOLS_VERSION=18.0.1 |
| 223 |
219 # If ANDROID_NDK_ROOT is set when envsetup is run, use the ndk pointed to by | 224 # If ANDROID_NDK_ROOT is set when envsetup is run, use the ndk pointed to by |
220 # the environment variable. Otherwise, use the default ndk from the tree. | 225 # the environment variable. Otherwise, use the default ndk from the tree. |
221 if [[ -z "${ANDROID_NDK_ROOT}" || ! -d "${ANDROID_NDK_ROOT}" ]]; then | 226 if [[ -z "${ANDROID_NDK_ROOT}" || ! -d "${ANDROID_NDK_ROOT}" ]]; then |
222 export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/" | 227 export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/" |
223 fi | 228 fi |
224 | 229 |
225 # If ANDROID_SDK_ROOT is set when envsetup is run, and if it has the | 230 # If ANDROID_SDK_ROOT is set when envsetup is run, and if it has the |
226 # right SDK-compatible directory layout, use the sdk pointed to by the | 231 # right SDK-compatible directory layout, use the sdk pointed to by the |
227 # environment variable. Otherwise, use the default sdk from the tree. | 232 # environment variable. Otherwise, use the default sdk from the tree. |
228 local sdk_suffix=platforms/android-${ANDROID_SDK_VERSION} | 233 local sdk_suffix=platforms/android-${ANDROID_SDK_VERSION} |
(...skipping 16 matching lines...) Expand all Loading... |
245 | 250 |
246 if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then | 251 if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then |
247 # Can not build WebView with NDK/SDK because it needs the Android build | 252 # Can not build WebView with NDK/SDK because it needs the Android build |
248 # system and build inside an Android source tree. | 253 # system and build inside an Android source tree. |
249 echo "Can not build WebView with NDK/SDK. Requires android source tree." \ | 254 echo "Can not build WebView with NDK/SDK. Requires android source tree." \ |
250 >& 2 | 255 >& 2 |
251 echo "Try . build/android/envsetup.sh instead." >& 2 | 256 echo "Try . build/android/envsetup.sh instead." >& 2 |
252 return 1 | 257 return 1 |
253 fi | 258 fi |
254 | 259 |
| 260 # Directory containing build-tools: aapt, aidl, dx |
| 261 export ANDROID_SDK_TOOLS="${ANDROID_SDK_ROOT}/build-tools/\ |
| 262 ${ANDROID_SDK_BUILD_TOOLS_VERSION}" |
255 } | 263 } |
256 | 264 |
257 ################################################################################ | 265 ################################################################################ |
258 # To build WebView, we use the Android build system and build inside an Android | 266 # To build WebView, we use the Android build system and build inside an Android |
259 # source tree. This method is called from non_sdk_build_init() and adds to the | 267 # source tree. This method is called from non_sdk_build_init() and adds to the |
260 # settings specified there. | 268 # settings specified there. |
261 ############################################################################# | 269 ############################################################################# |
262 webview_build_init() { | 270 webview_build_init() { |
| 271 # Use the latest API in the AOSP prebuilts directory (change with AOSP roll). |
| 272 export ANDROID_SDK_VERSION=17 |
| 273 |
263 # For the WebView build we always use the NDK and SDK in the Android tree, | 274 # For the WebView build we always use the NDK and SDK in the Android tree, |
264 # and we don't touch ANDROID_TOOLCHAIN which is already set by Android. | 275 # and we don't touch ANDROID_TOOLCHAIN which is already set by Android. |
265 export ANDROID_NDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/ndk/8 | 276 export ANDROID_NDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/ndk/8 |
266 export ANDROID_SDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/sdk/\ | 277 export ANDROID_SDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/sdk/\ |
267 ${ANDROID_SDK_VERSION} | 278 ${ANDROID_SDK_VERSION} |
268 | 279 |
269 common_vars_defines | 280 common_vars_defines |
270 | 281 |
271 # We need to supply SDK paths relative to the top of the Android tree to make | 282 # We need to supply SDK paths relative to the top of the Android tree to make |
272 # sure the generated Android makefiles are portable, as they will be checked | 283 # sure the generated Android makefiles are portable, as they will be checked |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 export GYP_DEFINES="${DEFINES}" | 316 export GYP_DEFINES="${DEFINES}" |
306 | 317 |
307 export GYP_GENERATORS="android" | 318 export GYP_GENERATORS="android" |
308 | 319 |
309 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" | 320 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" |
310 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} limit_to_target_all=1" | 321 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} limit_to_target_all=1" |
311 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} auto_regeneration=0" | 322 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} auto_regeneration=0" |
312 | 323 |
313 export CHROMIUM_GYP_FILE="${CHROME_SRC}/android_webview/all_webview.gyp" | 324 export CHROMIUM_GYP_FILE="${CHROME_SRC}/android_webview/all_webview.gyp" |
314 } | 325 } |
OLD | NEW |