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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 ;; | 105 ;; |
106 *) | 106 *) |
107 echo "TARGET_ARCH: ${TARGET_ARCH} is not supported." >& 2 | 107 echo "TARGET_ARCH: ${TARGET_ARCH} is not supported." >& 2 |
108 print_usage | 108 print_usage |
109 return 1 | 109 return 1 |
110 esac | 110 esac |
111 } | 111 } |
112 | 112 |
113 | 113 |
114 ################################################################################ | 114 ################################################################################ |
115 # Exports common GYP variables based on variable DEFINES and CHROME_SRC. | |
116 ################################################################################ | |
117 common_gyp_vars() { | |
118 export GYP_DEFINES="${DEFINES}" | |
119 | |
120 # TODO(thakis): Remove this after a week or two. Sourcing envsetup.sh used to | |
121 # set this variable, but now that all_android.gyp is gone having it set will | |
122 # lead to errors, so explicitly unset it to remove it from the environment of | |
123 # developers who keep their shells open for weeks (most of them, probably). | |
124 unset CHROMIUM_GYP_FILE | |
125 } | |
126 | |
127 | |
128 ################################################################################ | |
129 # Prints out help message on usage. | 115 # Prints out help message on usage. |
130 ################################################################################ | 116 ################################################################################ |
131 print_usage() { | 117 print_usage() { |
132 echo "usage: ${0##*/} [--target-arch=value] [--help]" >& 2 | 118 echo "usage: ${0##*/} [--target-arch=value] [--help]" >& 2 |
133 echo "--target-arch=value target CPU architecture (arm=default, x86)" >& 2 | 119 echo "--target-arch=value target CPU architecture (arm=default, x86)" >& 2 |
134 echo "--host-os=value override host OS detection (linux, mac)" >&2 | 120 echo "--host-os=value override host OS detection (linux, mac)" >&2 |
135 echo "--help this help" >& 2 | 121 echo "--help this help" >& 2 |
136 } | 122 } |
137 | 123 |
138 ################################################################################ | 124 ################################################################################ |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 export ANDROID_SDK_BUILD_TOOLS_VERSION=19.0.0 | 176 export ANDROID_SDK_BUILD_TOOLS_VERSION=19.0.0 |
191 fi | 177 fi |
192 | 178 |
193 # Unset toolchain. This makes it easy to switch between architectures. | 179 # Unset toolchain. This makes it easy to switch between architectures. |
194 unset ANDROID_TOOLCHAIN | 180 unset ANDROID_TOOLCHAIN |
195 | 181 |
196 common_vars_defines | 182 common_vars_defines |
197 | 183 |
198 DEFINES+="${sdk_defines}" | 184 DEFINES+="${sdk_defines}" |
199 | 185 |
200 common_gyp_vars | 186 export GYP_DEFINES="${DEFINES}" |
201 | 187 |
202 if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then | 188 if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then |
203 # Can not build WebView with NDK/SDK because it needs the Android build | 189 # Can not build WebView with NDK/SDK because it needs the Android build |
204 # system and build inside an Android source tree. | 190 # system and build inside an Android source tree. |
205 echo "Can not build WebView with NDK/SDK. Requires android source tree." \ | 191 echo "Can not build WebView with NDK/SDK. Requires android source tree." \ |
206 >& 2 | 192 >& 2 |
207 echo "Try . build/android/envsetup.sh instead." >& 2 | 193 echo "Try . build/android/envsetup.sh instead." >& 2 |
208 return 1 | 194 return 1 |
209 fi | 195 fi |
210 | 196 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 DEFINES+=" android_sdk_root=\$(PWD)/${ANDROID_SDK}" | 241 DEFINES+=" android_sdk_root=\$(PWD)/${ANDROID_SDK}" |
256 DEFINES+=" android_sdk_tools=\$(PWD)/${ANDROID_SDK_TOOLS}" | 242 DEFINES+=" android_sdk_tools=\$(PWD)/${ANDROID_SDK_TOOLS}" |
257 DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}" | 243 DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}" |
258 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" | 244 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" |
259 if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then | 245 if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then |
260 DEFINES+=" logging_like_official_build=1" | 246 DEFINES+=" logging_like_official_build=1" |
261 DEFINES+=" tracing_like_official_build=1" | 247 DEFINES+=" tracing_like_official_build=1" |
262 fi | 248 fi |
263 export GYP_DEFINES="${DEFINES}" | 249 export GYP_DEFINES="${DEFINES}" |
264 } | 250 } |
OLD | NEW |