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 -m) |
| 33 case "${host_arch}" in |
| 34 x86_64) # pass |
| 35 ;; |
| 36 i?86) |
| 37 if [[ -z "${try_32bit_host_build}" ]]; then |
| 38 echo "ERROR: Android build requires a 64-bit host build machine." |
| 39 echo "If you really want to try it on this machine, use the \ |
| 40 --try-32bit-host flag." |
| 41 echo "Be warned that this may fail horribly at link time, due \ |
| 42 very large binaries." |
| 43 return 1 |
| 44 else |
| 45 echo "WARNING: 32-bit host build enabled. Here be dragons!" |
| 46 host_arch=x86 |
| 47 fi |
| 48 ;; |
| 49 *) |
| 50 echo "ERROR: Unsupported host architecture (${host_arch})." |
| 51 echo "Try running this script on a Linux/x86_64 machine instead." |
| 52 return 1 |
| 53 esac |
| 54 |
30 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') | 55 host_os=$(uname -s | sed -e 's/Linux/linux/;s/Darwin/mac/') |
31 | 56 |
32 case "${host_os}" in | 57 case "${host_os}" in |
33 "linux") | 58 "linux") |
34 toolchain_dir="linux-x86_64" | 59 toolchain_dir="linux-${host_arch}" |
35 ;; | 60 ;; |
36 "mac") | 61 "mac") |
37 toolchain_dir="darwin-x86" | 62 toolchain_dir="darwin-${host_arch}" |
38 ;; | 63 ;; |
39 *) | 64 *) |
40 echo "Host platform ${host_os} is not supported" >& 2 | 65 echo "Host platform ${host_os} is not supported" >& 2 |
41 return 1 | 66 return 1 |
42 esac | 67 esac |
43 | 68 |
44 CURRENT_DIR="$(readlink -f "$(dirname $BASH_SOURCE)/../../")" | 69 CURRENT_DIR="$(readlink -f "$(dirname $BASH_SOURCE)/../../")" |
45 if [[ -z "${CHROME_SRC}" ]]; then | 70 if [[ -z "${CHROME_SRC}" ]]; then |
46 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. | 71 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. |
47 export CHROME_SRC="${CURRENT_DIR}" | 72 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 | 131 # This is just a simple wrapper of gyp_chromium, please don't add anything |
107 # in this function. | 132 # in this function. |
108 echo "GYP_GENERATORS set to '$GYP_GENERATORS'" | 133 echo "GYP_GENERATORS set to '$GYP_GENERATORS'" |
109 ( | 134 ( |
110 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@" | 135 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@" |
111 ) | 136 ) |
112 } | 137 } |
113 | 138 |
114 # FLOCK needs to be null on system that has no flock | 139 # FLOCK needs to be null on system that has no flock |
115 which flock > /dev/null || export FLOCK= | 140 which flock > /dev/null || export FLOCK= |
OLD | NEW |