Chromium Code Reviews| 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. |
| 11 | 11 |
| 12 ################################################################################ | 12 ################################################################################ |
| 13 # Exports environment variables common to both sdk and non-sdk build (e.g. PATH) | 13 # Exports environment variables common to both sdk and non-sdk build (e.g. PATH) |
| 14 # based on CHROME_SRC, along with DEFINES for GYP_DEFINES. | 14 # based on CHROME_SRC, along with DEFINES for GYP_DEFINES. |
| 15 ################################################################################ | 15 ################################################################################ |
| 16 common_vars_defines() { | 16 common_vars_defines() { |
| 17 # Add Android SDK tools to system path. | 17 # Add Android SDK tools to system path. |
| 18 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools | 18 export PATH=$PATH:${ANDROID_SDK_ROOT}/tools |
| 19 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools | 19 export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools |
| 20 export PATH=$PATH:${ANDROID_SDK_ROOT}/build-tools/\ | 20 export PATH=$PATH:${ANDROID_SDK_ROOT}/build-tools/\ |
| 21 ${ANDROID_SDK_BUILD_TOOLS_VERSION} | 21 ${ANDROID_SDK_BUILD_TOOLS_VERSION} |
| 22 | 22 |
| 23 # Add Chromium Android development scripts to system path. | 23 # Add Chromium Android development scripts to system path. |
| 24 # Must be after CHROME_SRC is set. | 24 # Must be after CHROME_SRC is set. |
| 25 export PATH=$PATH:${CHROME_SRC}/build/android | 25 export PATH=$PATH:${CHROME_SRC}/build/android |
| 26 | 26 |
| 27 # The set of GYP_DEFINES to pass to gyp. | 27 # The set of GYP_DEFINES to pass to gyp. |
| 28 DEFINES="OS=android" | 28 DEFINES="OS=android" |
| 29 DEFINES+=" host_os=${host_os}" | |
| 30 | 29 |
| 31 if [[ -n "$CHROME_ANDROID_OFFICIAL_BUILD" ]]; then | 30 if [[ -n "$CHROME_ANDROID_OFFICIAL_BUILD" ]]; then |
| 32 DEFINES+=" branding=Chrome" | 31 DEFINES+=" branding=Chrome" |
| 33 DEFINES+=" buildtype=Official" | 32 DEFINES+=" buildtype=Official" |
| 34 | 33 |
| 35 # These defines are used by various chrome build scripts to tag the binary's | 34 # These defines are used by various chrome build scripts to tag the binary's |
| 36 # version string as 'official' in linux builds (e.g. in | 35 # version string as 'official' in linux builds (e.g. in |
| 37 # chrome/trunk/src/chrome/tools/build/version.py). | 36 # chrome/trunk/src/chrome/tools/build/version.py). |
| 38 export OFFICIAL_BUILD=1 | 37 export OFFICIAL_BUILD=1 |
| 39 export CHROMIUM_BUILD="_google_chrome" | 38 export CHROMIUM_BUILD="_google_chrome" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 65 esac | 64 esac |
| 66 } | 65 } |
| 67 | 66 |
| 68 | 67 |
| 69 ################################################################################ | 68 ################################################################################ |
| 70 # Prints out help message on usage. | 69 # Prints out help message on usage. |
| 71 ################################################################################ | 70 ################################################################################ |
| 72 print_usage() { | 71 print_usage() { |
| 73 echo "usage: ${0##*/} [--target-arch=value] [--help]" >& 2 | 72 echo "usage: ${0##*/} [--target-arch=value] [--help]" >& 2 |
| 74 echo "--target-arch=value target CPU architecture (arm=default, x86)" >& 2 | 73 echo "--target-arch=value target CPU architecture (arm=default, x86)" >& 2 |
| 75 echo "--host-os=value override host OS detection (linux, mac)" >&2 | |
| 76 echo "--help this help" >& 2 | 74 echo "--help this help" >& 2 |
| 77 } | 75 } |
| 78 | 76 |
| 79 ################################################################################ | 77 ################################################################################ |
| 80 # Process command line options. | 78 # Process command line options. |
| 81 ################################################################################ | 79 ################################################################################ |
| 82 process_options() { | 80 process_options() { |
| 83 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') | |
| 84 while [[ -n $1 ]]; do | 81 while [[ -n $1 ]]; do |
| 85 case "$1" in | 82 case "$1" in |
| 86 --target-arch=*) | 83 --target-arch=*) |
| 87 target_arch="$(echo "$1" | sed 's/^[^=]*=//')" | 84 target_arch="$(echo "$1" | sed 's/^[^=]*=//')" |
| 88 ;; | 85 ;; |
| 89 --host-os=*) | |
| 90 host_os="$(echo "$1" | sed 's/^[^=]*=//')" | |
| 91 ;; | |
| 92 --help) | 86 --help) |
| 93 print_usage | 87 print_usage |
| 94 return 1 | 88 return 1 |
| 95 ;; | 89 ;; |
| 96 *) | 90 *) |
| 97 # Ignore other command line options | 91 # Ignore other command line options |
| 98 echo "Unknown option: $1" | 92 echo "Unknown option: $1" |
| 99 ;; | 93 ;; |
| 100 esac | 94 esac |
| 101 shift | 95 shift |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 165 ${ANDROID_SDK_VERSION} | 159 ${ANDROID_SDK_VERSION} |
| 166 | 160 |
| 167 common_vars_defines | 161 common_vars_defines |
| 168 | 162 |
| 169 # We need to supply SDK paths relative to the top of the Android tree to make | 163 # We need to supply SDK paths relative to the top of the Android tree to make |
| 170 # sure the generated Android makefiles are portable, as they will be checked | 164 # sure the generated Android makefiles are portable, as they will be checked |
| 171 # into the Android tree. | 165 # into the Android tree. |
| 172 ANDROID_SDK=$(python -c \ | 166 ANDROID_SDK=$(python -c \ |
| 173 "import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', \ | 167 "import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', \ |
| 174 '${ANDROID_BUILD_TOP}')") | 168 '${ANDROID_BUILD_TOP}')") |
| 175 case "${host_os}" in | 169 ANDROID_SDK_TOOLS=$(python -c \ |
| 176 "linux") | 170 "import os.path, sys; \ |
| 177 ANDROID_SDK_TOOLS=$(python -c \ | 171 print os.path.relpath( \ |
| 178 "import os.path; \ | 172 '${ANDROID_SDK_ROOT}/../tools/' + sys.platform.rstrip('23'), \ |
|
Torne
2014/02/21 11:32:49
Unfortunately this broke downstream mac builds and
Nico
2014/02/21 15:07:44
D'oh, sorry!
| |
| 179 print os.path.relpath('${ANDROID_SDK_ROOT}/../tools/linux', \ | 173 '${ANDROID_BUILD_TOP}')") |
| 180 '${ANDROID_BUILD_TOP}')") | |
| 181 ;; | |
| 182 "mac") | |
| 183 ANDROID_SDK_TOOLS=$(python -c \ | |
| 184 "import os.path; \ | |
| 185 print os.path.relpath('${ANDROID_SDK_ROOT}/../tools/darwin', \ | |
| 186 '${ANDROID_BUILD_TOP}')") | |
| 187 ;; | |
| 188 esac | |
| 189 DEFINES+=" android_webview_build=1" | 174 DEFINES+=" android_webview_build=1" |
| 190 DEFINES+=" android_src=\$(PWD)" | 175 DEFINES+=" android_src=\$(PWD)" |
| 191 DEFINES+=" android_sdk=\$(PWD)/${ANDROID_SDK}" | 176 DEFINES+=" android_sdk=\$(PWD)/${ANDROID_SDK}" |
| 192 DEFINES+=" android_sdk_root=\$(PWD)/${ANDROID_SDK}" | 177 DEFINES+=" android_sdk_root=\$(PWD)/${ANDROID_SDK}" |
| 193 DEFINES+=" android_sdk_tools=\$(PWD)/${ANDROID_SDK_TOOLS}" | 178 DEFINES+=" android_sdk_tools=\$(PWD)/${ANDROID_SDK_TOOLS}" |
| 194 DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}" | 179 DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}" |
| 195 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" | 180 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" |
| 196 if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then | 181 if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then |
| 197 DEFINES+=" logging_like_official_build=1" | 182 DEFINES+=" logging_like_official_build=1" |
| 198 DEFINES+=" tracing_like_official_build=1" | 183 DEFINES+=" tracing_like_official_build=1" |
| 199 fi | 184 fi |
| 200 export GYP_DEFINES="${DEFINES}" | 185 export GYP_DEFINES="${DEFINES}" |
| 201 } | 186 } |
| OLD | NEW |