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 21 matching lines...) Expand all Loading... |
32 export OFFICIAL_BUILD=1 | 32 export OFFICIAL_BUILD=1 |
33 export CHROMIUM_BUILD="_google_chrome" | 33 export CHROMIUM_BUILD="_google_chrome" |
34 export CHROME_BUILD_TYPE="_official" | 34 export CHROME_BUILD_TYPE="_official" |
35 fi | 35 fi |
36 | 36 |
37 # TODO(thakis), Jan 18 2014: Remove this after two weeks or so, after telling | 37 # TODO(thakis), Jan 18 2014: Remove this after two weeks or so, after telling |
38 # everyone to set use_goma in GYP_DEFINES instead of a GOMA_DIR env var. | 38 # everyone to set use_goma in GYP_DEFINES instead of a GOMA_DIR env var. |
39 if [[ -d $GOMA_DIR ]]; then | 39 if [[ -d $GOMA_DIR ]]; then |
40 DEFINES+=" use_goma=1 gomadir=$GOMA_DIR" | 40 DEFINES+=" use_goma=1 gomadir=$GOMA_DIR" |
41 fi | 41 fi |
42 | |
43 # The following defines will affect ARM code generation of both C/C++ compiler | |
44 # and V8 mksnapshot. | |
45 case "${TARGET_ARCH}" in | |
46 "arm") | |
47 DEFINES+=" target_arch=arm" | |
48 ;; | |
49 "x86") | |
50 DEFINES+=" target_arch=ia32" | |
51 ;; | |
52 "mips") | |
53 DEFINES+=" target_arch=mipsel" | |
54 ;; | |
55 *) | |
56 echo "TARGET_ARCH: ${TARGET_ARCH} is not supported." >& 2 | |
57 print_usage | |
58 return 1 | |
59 esac | |
60 } | 42 } |
61 | 43 |
62 | 44 |
63 ################################################################################ | 45 ################################################################################ |
64 # Prints out help message on usage. | 46 # Prints out help message on usage. |
65 ################################################################################ | 47 ################################################################################ |
66 print_usage() { | 48 print_usage() { |
67 echo "usage: ${0##*/} [--target-arch=value] [--help]" >& 2 | 49 echo "usage: ${0##*/} [--help]" >& 2 |
68 echo "--target-arch=value target CPU architecture (arm=default, x86)" >& 2 | |
69 echo "--help this help" >& 2 | 50 echo "--help this help" >& 2 |
70 } | 51 } |
71 | 52 |
72 ################################################################################ | 53 ################################################################################ |
73 # Process command line options. | 54 # Process command line options. |
74 ################################################################################ | 55 ################################################################################ |
75 process_options() { | 56 process_options() { |
76 while [[ -n $1 ]]; do | 57 while [[ -n $1 ]]; do |
77 case "$1" in | 58 case "$1" in |
78 --target-arch=*) | 59 --target-arch=*) |
79 target_arch="$(echo "$1" | sed 's/^[^=]*=//')" | 60 echo "WARNING: --target-arch is ignored and will be an error soon." |
80 ;; | 61 echo "Pass -Dtarget_arch=foo to gyp instead." |
81 --help) | 62 echo "(x86 is spelled ia32 in gyp, mips becomes mipsel, arm stays arm)" |
82 print_usage | |
83 return 1 | |
84 ;; | 63 ;; |
85 *) | 64 *) |
86 # Ignore other command line options | 65 # Ignore other command line options |
87 echo "Unknown option: $1" | 66 echo "Unknown option: $1" |
88 ;; | 67 ;; |
89 esac | 68 esac |
90 shift | 69 shift |
91 done | 70 done |
92 | |
93 # Sets TARGET_ARCH. Defaults to arm if not specified. | |
94 TARGET_ARCH=${target_arch:-arm} | |
95 } | 71 } |
96 | 72 |
97 ################################################################################ | 73 ################################################################################ |
98 # Initializes environment variables for NDK/SDK build. | 74 # Initializes environment variables for NDK/SDK build. |
99 ################################################################################ | 75 ################################################################################ |
100 sdk_build_init() { | 76 sdk_build_init() { |
101 # Allow the caller to override a few environment variables. If any of them is | 77 # Allow the caller to override a few environment variables. If any of them is |
102 # unset, we default to a sane value that's known to work. This allows for | 78 # unset, we default to a sane value that's known to work. This allows for |
103 # experimentation with a custom SDK. | 79 # experimentation with a custom SDK. |
104 if [[ -z "${ANDROID_NDK_ROOT}" || ! -d "${ANDROID_NDK_ROOT}" ]]; then | 80 if [[ -z "${ANDROID_NDK_ROOT}" || ! -d "${ANDROID_NDK_ROOT}" ]]; then |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 DEFINES+=" android_sdk_root=\$(PWD)/${ANDROID_SDK}" | 130 DEFINES+=" android_sdk_root=\$(PWD)/${ANDROID_SDK}" |
155 DEFINES+=" android_sdk_tools=\$(PWD)/${ANDROID_SDK_TOOLS}" | 131 DEFINES+=" android_sdk_tools=\$(PWD)/${ANDROID_SDK_TOOLS}" |
156 DEFINES+=" android_sdk_version=sdk_version_unused_in_webview_build" | 132 DEFINES+=" android_sdk_version=sdk_version_unused_in_webview_build" |
157 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" | 133 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" |
158 if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then | 134 if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then |
159 DEFINES+=" logging_like_official_build=1" | 135 DEFINES+=" logging_like_official_build=1" |
160 DEFINES+=" tracing_like_official_build=1" | 136 DEFINES+=" tracing_like_official_build=1" |
161 fi | 137 fi |
162 export GYP_DEFINES="${DEFINES}" | 138 export GYP_DEFINES="${DEFINES}" |
163 } | 139 } |
OLD | NEW |