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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 # > export ANDROID_NDK_ROOT=<android ndk root> | 216 # > export ANDROID_NDK_ROOT=<android ndk root> |
217 # > export ANDROID_SDK_ROOT=<android sdk root> # to override the default sdk | 217 # > export ANDROID_SDK_ROOT=<android sdk root> # to override the default sdk |
218 # > . build/android/envsetup.sh | 218 # > . build/android/envsetup.sh |
219 # > make | 219 # > make |
220 ################################################################################ | 220 ################################################################################ |
221 sdk_build_init() { | 221 sdk_build_init() { |
222 | 222 |
223 # Allow the caller to override a few environment variables. If any of them is | 223 # Allow the caller to override a few environment variables. If any of them is |
224 # unset, we default to a sane value that's known to work. This allows for | 224 # unset, we default to a sane value that's known to work. This allows for |
225 # experimentation with a custom SDK. | 225 # experimentation with a custom SDK. |
| 226 local sdk_defines="" |
226 if [[ -z "${ANDROID_NDK_ROOT}" || ! -d "${ANDROID_NDK_ROOT}" ]]; then | 227 if [[ -z "${ANDROID_NDK_ROOT}" || ! -d "${ANDROID_NDK_ROOT}" ]]; then |
227 export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/" | 228 export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/" |
228 fi | 229 fi |
229 if [[ -z "${ANDROID_SDK_VERSION}" ]]; then | 230 if [[ -z "${ANDROID_SDK_VERSION}" ]]; then |
230 export ANDROID_SDK_VERSION=18 | 231 export ANDROID_SDK_VERSION=18 |
| 232 else |
| 233 sdk_defines+=" android_sdk_version=${ANDROID_SDK_VERSION}" |
231 fi | 234 fi |
232 local sdk_suffix=platforms/android-${ANDROID_SDK_VERSION} | 235 local sdk_suffix=platforms/android-${ANDROID_SDK_VERSION} |
233 if [[ -z "${ANDROID_SDK_ROOT}" || \ | 236 if [[ -z "${ANDROID_SDK_ROOT}" || \ |
234 ! -d "${ANDROID_SDK_ROOT}/${sdk_suffix}" ]]; then | 237 ! -d "${ANDROID_SDK_ROOT}/${sdk_suffix}" ]]; then |
235 export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/" | 238 export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/" |
| 239 else |
| 240 sdk_defines+=" android_sdk_root=${ANDROID_SDK_ROOT}" |
236 fi | 241 fi |
237 if [[ -z "${ANDROID_SDK_BUILD_TOOLS_VERSION}" ]]; then | 242 if [[ -z "${ANDROID_SDK_BUILD_TOOLS_VERSION}" ]]; then |
238 export ANDROID_SDK_BUILD_TOOLS_VERSION=18.0.1 | 243 export ANDROID_SDK_BUILD_TOOLS_VERSION=18.0.1 |
239 fi | 244 fi |
240 | 245 |
241 unset ANDROID_BUILD_TOP | 246 unset ANDROID_BUILD_TOP |
242 | 247 |
243 # Set default target. | 248 # Set default target. |
244 export TARGET_PRODUCT="${TARGET_PRODUCT:-trygon}" | 249 export TARGET_PRODUCT="${TARGET_PRODUCT:-trygon}" |
245 | 250 |
246 # Unset toolchain so that it can be set based on TARGET_PRODUCT. | 251 # Unset toolchain so that it can be set based on TARGET_PRODUCT. |
247 # This makes it easy to switch between architectures. | 252 # This makes it easy to switch between architectures. |
248 unset ANDROID_TOOLCHAIN | 253 unset ANDROID_TOOLCHAIN |
249 | 254 |
250 common_vars_defines | 255 common_vars_defines |
| 256 |
| 257 DEFINES+="${sdk_defines}" |
| 258 |
251 common_gyp_vars | 259 common_gyp_vars |
252 | 260 |
253 if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then | 261 if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then |
254 # Can not build WebView with NDK/SDK because it needs the Android build | 262 # Can not build WebView with NDK/SDK because it needs the Android build |
255 # system and build inside an Android source tree. | 263 # system and build inside an Android source tree. |
256 echo "Can not build WebView with NDK/SDK. Requires android source tree." \ | 264 echo "Can not build WebView with NDK/SDK. Requires android source tree." \ |
257 >& 2 | 265 >& 2 |
258 echo "Try . build/android/envsetup.sh instead." >& 2 | 266 echo "Try . build/android/envsetup.sh instead." >& 2 |
259 return 1 | 267 return 1 |
260 fi | 268 fi |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 export GYP_DEFINES="${DEFINES}" | 326 export GYP_DEFINES="${DEFINES}" |
319 | 327 |
320 export GYP_GENERATORS="android" | 328 export GYP_GENERATORS="android" |
321 | 329 |
322 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" | 330 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" |
323 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} limit_to_target_all=1" | 331 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} limit_to_target_all=1" |
324 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} auto_regeneration=0" | 332 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} auto_regeneration=0" |
325 | 333 |
326 export CHROMIUM_GYP_FILE="${CHROME_SRC}/android_webview/all_webview.gyp" | 334 export CHROMIUM_GYP_FILE="${CHROME_SRC}/android_webview/all_webview.gyp" |
327 } | 335 } |
OLD | NEW |