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 # Sets up environment for building Chromium on Android. It can either be | 7 # Sets up environment for building Chromium on Android. It can either be |
8 # compiled with the Android tree or using the Android SDK/NDK. To build with | 8 # compiled with the Android tree or using the Android SDK/NDK. To build with |
9 # NDK/SDK: ". build/android/envsetup.sh". Environment variable | 9 # NDK/SDK: ". build/android/envsetup.sh". Environment variable |
10 # ANDROID_SDK_BUILD=1 will then be defined and used in the rest of the setup to | 10 # ANDROID_SDK_BUILD=1 will then be defined and used in the rest of the setup to |
11 # specifiy build type. | 11 # specifiy build type. |
12 | 12 |
13 # Source functions script. The file is in the same directory as this script. | 13 # Source functions script. The file is in the same directory as this script. |
14 . "$(dirname $BASH_SOURCE)"/envsetup_functions.sh | 14 . "$(dirname $BASH_SOURCE)"/envsetup_functions.sh |
15 | 15 |
16 export ANDROID_SDK_BUILD=1 # Default to SDK build. | 16 export ANDROID_SDK_BUILD=1 # Default to SDK build. |
17 | 17 |
18 process_options "$@" | 18 process_options "$@" |
19 | 19 |
20 # When building WebView as part of Android we can't use the SDK. Other builds | 20 # When building WebView as part of Android we can't use the SDK. Other builds |
21 # default to using the SDK. | 21 # default to using the SDK. |
22 if [[ "${CHROME_ANDROID_BUILD_WEBVIEW}" -eq 1 ]]; then | 22 if [[ "${CHROME_ANDROID_BUILD_WEBVIEW}" -eq 1 ]]; then |
23 export ANDROID_SDK_BUILD=0 | 23 export ANDROID_SDK_BUILD=0 |
24 fi | 24 fi |
25 | 25 |
26 if [[ "${ANDROID_SDK_BUILD}" -eq 1 ]]; then | 26 if [[ "${ANDROID_SDK_BUILD}" -eq 1 ]]; then |
27 echo "Using SDK build" | 27 echo "Using SDK build" |
28 fi | 28 fi |
29 | 29 |
30 # Get host architecture, and abort if it is 32-bit, unless --try-32 | |
31 # is also used. | |
32 host_arch=$(uname -p) | |
33 case "${host_arch}" in | |
34 "x86_64") # pass | |
Isaac (away)
2012/11/15 01:07:54
nit: quotes unneeded here
digit1
2012/11/15 09:30:24
Sure, will remove.
| |
35 ;; | |
36 i?86) | |
Isaac (away)
2012/11/15 01:07:54
Assuming you made sure '?' works as intended
digit1
2012/11/15 09:30:24
I've been using this for the NDK for a long time n
| |
37 if [[ -z "${try_32bit_build}" ]]; then | |
38 echo "ERROR: Android build requires a 64-bit host." | |
39 echo "If you really want to try it on this machine, use the --try-32" | |
40 echo "flag. Be warned that this may fail horribly at link time, due" | |
41 echo "to some of the final binaries being too large." | |
42 return 1 | |
43 else | |
44 echo "WARNING: 32-bit host build enabled. Here be dragons!" | |
45 host_arch=x86 | |
46 fi | |
47 ;; | |
48 *) | |
49 echo "ERROR: Unsupported host architecture (${host_arch})." | |
50 echo "Try running this script on a Linux/x86_64 machine instead." | |
51 return 1 | |
52 esac | |
53 | |
30 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') | 54 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') |
31 | 55 |
32 case "${host_os}" in | 56 case "${host_os}" in |
33 "linux") | 57 "linux") |
34 toolchain_dir="linux-x86_64" | 58 toolchain_dir="linux-${host_arch}" |
35 ;; | 59 ;; |
36 "mac") | 60 "mac") |
37 toolchain_dir="darwin-x86" | 61 toolchain_dir="darwin-${host_arch}" |
38 ;; | 62 ;; |
39 *) | 63 *) |
40 echo "Host platform ${host_os} is not supported" >& 2 | 64 echo "Host platform ${host_os} is not supported" >& 2 |
41 return 1 | 65 return 1 |
42 esac | 66 esac |
43 | 67 |
44 CURRENT_DIR="$(readlink -f "$(dirname $BASH_SOURCE)/../../")" | 68 CURRENT_DIR="$(readlink -f "$(dirname $BASH_SOURCE)/../../")" |
45 if [[ -z "${CHROME_SRC}" ]]; then | 69 if [[ -z "${CHROME_SRC}" ]]; then |
46 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. | 70 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. |
47 export CHROME_SRC="${CURRENT_DIR}" | 71 export CHROME_SRC="${CURRENT_DIR}" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
106 # This is just a simple wrapper of gyp_chromium, please don't add anything | 130 # This is just a simple wrapper of gyp_chromium, please don't add anything |
107 # in this function. | 131 # in this function. |
108 echo "GYP_GENERATORS set to '$GYP_GENERATORS'" | 132 echo "GYP_GENERATORS set to '$GYP_GENERATORS'" |
109 ( | 133 ( |
110 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@" | 134 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@" |
111 ) | 135 ) |
112 } | 136 } |
113 | 137 |
114 # FLOCK needs to be null on system that has no flock | 138 # FLOCK needs to be null on system that has no flock |
115 which flock > /dev/null || export FLOCK= | 139 which flock > /dev/null || export FLOCK= |
OLD | NEW |