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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 # > . build/android/envsetup.sh --sdk | 165 # > . build/android/envsetup.sh --sdk |
166 # > make | 166 # > make |
167 ################################################################################ | 167 ################################################################################ |
168 sdk_build_init() { | 168 sdk_build_init() { |
169 # If ANDROID_NDK_ROOT is set when envsetup is run, use the ndk pointed to by | 169 # If ANDROID_NDK_ROOT is set when envsetup is run, use the ndk pointed to by |
170 # the environment variable. Otherwise, use the default ndk from the tree. | 170 # the environment variable. Otherwise, use the default ndk from the tree. |
171 if [ ! -d "${ANDROID_NDK_ROOT}" ]; then | 171 if [ ! -d "${ANDROID_NDK_ROOT}" ]; then |
172 export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/" | 172 export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/" |
173 fi | 173 fi |
174 | 174 |
175 # If ANDROID_SDK_ROOT is set when envsetup is run, use the sdk pointed to by | 175 # If ANDROID_SDK_ROOT is set when envsetup is run, and if it has the |
176 # the environment variable. Otherwise, use the default sdk from the tree. | 176 # right SDK-compatible directory layout, use the sdk pointed to by the |
177 if [ ! -d "${ANDROID_SDK_ROOT}" ]; then | 177 # environment variable. Otherwise, use the default sdk from the tree. |
178 local sdk_suffix=platforms/android-${ANDROID_SDK_VERSION} | |
179 if [ ! -d "${ANDROID_SDK_ROOT}" -o \ | |
180 ! -d "${ANDROID_SDK_ROOT}/${sdk_suffix}" ]; then | |
Isaac (away)
2012/09/05 16:47:36
can we simplify this to just check the latter dire
digit1
2012/09/05 17:04:39
Done, also changed the test to verify that the var
| |
178 export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/" | 181 export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/" |
179 fi | 182 fi |
180 | 183 |
181 # Makes sure ANDROID_BUILD_TOP is unset if build has option --sdk | 184 # Makes sure ANDROID_BUILD_TOP is unset if build has option --sdk |
182 unset ANDROID_BUILD_TOP | 185 unset ANDROID_BUILD_TOP |
183 | 186 |
184 # Set default target. | 187 # Set default target. |
185 export TARGET_PRODUCT="${TARGET_PRODUCT:-trygon}" | 188 export TARGET_PRODUCT="${TARGET_PRODUCT:-trygon}" |
186 | 189 |
187 # Unset toolchain so that it can be set based on TARGET_PRODUCT. | 190 # Unset toolchain so that it can be set based on TARGET_PRODUCT. |
(...skipping 11 matching lines...) Expand all Loading... | |
199 ;; | 202 ;; |
200 esac | 203 esac |
201 | 204 |
202 # Sets android specific directories to NOT_SDK_COMPLIANT. This will allow | 205 # Sets android specific directories to NOT_SDK_COMPLIANT. This will allow |
203 # android_gyp to generate make files, but will cause errors when (and only | 206 # android_gyp to generate make files, but will cause errors when (and only |
204 # when) building targets that depend on these directories. | 207 # when) building targets that depend on these directories. |
205 DEFINES+=" android_src='NOT_SDK_COMPLIANT'" | 208 DEFINES+=" android_src='NOT_SDK_COMPLIANT'" |
206 DEFINES+=" android_product_out=${CHROME_SRC}/out/android" | 209 DEFINES+=" android_product_out=${CHROME_SRC}/out/android" |
207 DEFINES+=" android_lib='NOT_SDK_COMPLIANT'" | 210 DEFINES+=" android_lib='NOT_SDK_COMPLIANT'" |
208 DEFINES+=" android_static_lib='NOT_SDK_COMPLIANT'" | 211 DEFINES+=" android_static_lib='NOT_SDK_COMPLIANT'" |
209 DEFINES+=\ | 212 DEFINES+=" android_sdk=${ANDROID_SDK_ROOT}/${sdk_suffix}" |
210 " android_sdk=${ANDROID_SDK_ROOT}/platforms/android-${ANDROID_SDK_VERSION}" | |
211 DEFINES+=" android_sdk_root=${ANDROID_SDK_ROOT}" | 213 DEFINES+=" android_sdk_root=${ANDROID_SDK_ROOT}" |
212 DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/platform-tools" | 214 DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/platform-tools" |
213 DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}" | 215 DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}" |
214 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" | 216 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" |
215 | 217 |
216 common_gyp_vars | 218 common_gyp_vars |
217 | 219 |
218 if [ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]; then | 220 if [ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]; then |
219 # Can not build WebView with NDK/SDK because it needs the Android build | 221 # Can not build WebView with NDK/SDK because it needs the Android build |
220 # system and build inside an Android source tree. | 222 # system and build inside an Android source tree. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
305 | 307 |
306 export GYP_GENERATORS="android" | 308 export GYP_GENERATORS="android" |
307 | 309 |
308 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" | 310 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All" |
309 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} limit_to_target_all=1" | 311 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} limit_to_target_all=1" |
310 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} auto_regeneration=0" | 312 export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} auto_regeneration=0" |
311 | 313 |
312 # TODO(torne): This isn't upstream yet. Upstream it or remove this setting. | 314 # TODO(torne): This isn't upstream yet. Upstream it or remove this setting. |
313 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android_webview.gyp" | 315 export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android_webview.gyp" |
314 } | 316 } |
OLD | NEW |