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 --sdk". Environment variable | 9 # NDK/SDK: ". build/android/envsetup.sh --sdk". 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 |
(...skipping 22 matching lines...) Expand all Loading... |
33 ;; | 33 ;; |
34 "mac") | 34 "mac") |
35 toolchain_dir="darwin-x86" | 35 toolchain_dir="darwin-x86" |
36 ;; | 36 ;; |
37 *) | 37 *) |
38 echo "Host platform ${host_os} is not supported" >& 2 | 38 echo "Host platform ${host_os} is not supported" >& 2 |
39 return 1 | 39 return 1 |
40 esac | 40 esac |
41 | 41 |
42 CURRENT_DIR="$(readlink -f "$(dirname $BASH_SOURCE)/../../")" | 42 CURRENT_DIR="$(readlink -f "$(dirname $BASH_SOURCE)/../../")" |
43 if [ -z "${CHROME_SRC}" ]; then | 43 if [[ -z "${CHROME_SRC}" ]]; then |
44 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. | 44 # If $CHROME_SRC was not set, assume current directory is CHROME_SRC. |
45 export CHROME_SRC="${CURRENT_DIR}" | 45 export CHROME_SRC="${CURRENT_DIR}" |
46 fi | 46 fi |
47 | 47 |
48 if [ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]; then | 48 if [[ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]]; then |
49 # If current directory is not in $CHROME_SRC, it might be set for other | 49 # If current directory is not in $CHROME_SRC, it might be set for other |
50 # source tree. If $CHROME_SRC was set correctly and we are in the correct | 50 # source tree. If $CHROME_SRC was set correctly and we are in the correct |
51 # directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "". | 51 # directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "". |
52 # Otherwise, it will equal to "${CURRENT_DIR}" | 52 # Otherwise, it will equal to "${CURRENT_DIR}" |
53 echo "Warning: Current directory is out of CHROME_SRC, it may not be \ | 53 echo "Warning: Current directory is out of CHROME_SRC, it may not be \ |
54 the one you want." | 54 the one you want." |
55 echo "${CHROME_SRC}" | 55 echo "${CHROME_SRC}" |
56 fi | 56 fi |
57 | 57 |
58 # Android sdk platform version to use | 58 # Android sdk platform version to use |
59 export ANDROID_SDK_VERSION=16 | 59 export ANDROID_SDK_VERSION=16 |
60 | 60 |
61 # Source functions script. The file is in the same directory as this script. | 61 # Source functions script. The file is in the same directory as this script. |
62 . "$(dirname $BASH_SOURCE)"/envsetup_functions.sh | 62 . "$(dirname $BASH_SOURCE)"/envsetup_functions.sh |
63 | 63 |
64 if [ "${ANDROID_SDK_BUILD}" -eq 1 ]; then | 64 if [[ "${ANDROID_SDK_BUILD}" -eq 1 ]]; then |
65 sdk_build_init | 65 sdk_build_init |
66 # Sets up environment for building Chromium for Android with source. Expects | 66 # Sets up environment for building Chromium for Android with source. Expects |
67 # android environment setup and lunch. | 67 # android environment setup and lunch. |
68 elif [ -z "$ANDROID_BUILD_TOP" -o -z "$ANDROID_TOOLCHAIN" -o \ | 68 elif [[ -z "$ANDROID_BUILD_TOP" || \ |
69 -z "$ANDROID_PRODUCT_OUT" ]; then | 69 -z "$ANDROID_TOOLCHAIN" || \ |
| 70 -z "$ANDROID_PRODUCT_OUT" ]]; then |
70 echo "Android build environment variables must be set." | 71 echo "Android build environment variables must be set." |
71 echo "Please cd to the root of your Android tree and do: " | 72 echo "Please cd to the root of your Android tree and do: " |
72 echo " . build/envsetup.sh" | 73 echo " . build/envsetup.sh" |
73 echo " lunch" | 74 echo " lunch" |
74 echo "Then try this again." | 75 echo "Then try this again." |
75 echo "Or did you mean NDK/SDK build. Run envsetup.sh with --sdk argument." | 76 echo "Or did you mean NDK/SDK build. Run envsetup.sh with --sdk argument." |
76 return 1 | 77 return 1 |
77 else | 78 else |
78 non_sdk_build_init | 79 non_sdk_build_init |
79 fi | 80 fi |
80 | 81 |
81 # Workaround for valgrind build | 82 # Workaround for valgrind build |
82 if [ -n "$CHROME_ANDROID_VALGRIND_BUILD" ]; then | 83 if [[ -n "$CHROME_ANDROID_VALGRIND_BUILD" ]]; then |
83 # arm_thumb=0 is a workaround for https://bugs.kde.org/show_bug.cgi?id=270709 | 84 # arm_thumb=0 is a workaround for https://bugs.kde.org/show_bug.cgi?id=270709 |
84 DEFINES+=" arm_thumb=0 release_extra_cflags='-fno-inline\ | 85 DEFINES+=" arm_thumb=0 release_extra_cflags='-fno-inline\ |
85 -fno-omit-frame-pointer -fno-builtin' release_valgrind_build=1\ | 86 -fno-omit-frame-pointer -fno-builtin' release_valgrind_build=1\ |
86 release_optimize=1" | 87 release_optimize=1" |
87 fi | 88 fi |
88 | 89 |
89 # Source a bunch of helper functions | 90 # Source a bunch of helper functions |
90 . ${CHROME_SRC}/build/android/adb_device_functions.sh | 91 . ${CHROME_SRC}/build/android/adb_device_functions.sh |
91 | 92 |
92 ANDROID_GOMA_WRAPPER="" | 93 ANDROID_GOMA_WRAPPER="" |
93 if [[ -d $GOMA_DIR ]]; then | 94 if [[ -d $GOMA_DIR ]]; then |
94 ANDROID_GOMA_WRAPPER="$GOMA_DIR/gomacc" | 95 ANDROID_GOMA_WRAPPER="$GOMA_DIR/gomacc" |
95 fi | 96 fi |
96 export ANDROID_GOMA_WRAPPER | 97 export ANDROID_GOMA_WRAPPER |
97 | 98 |
98 export CC_target="${ANDROID_GOMA_WRAPPER} $(echo -n ${ANDROID_TOOLCHAIN}/*-gcc)" | 99 export CC_target="${ANDROID_GOMA_WRAPPER} $(echo -n ${ANDROID_TOOLCHAIN}/*-gcc)" |
99 export CXX_target="${ANDROID_GOMA_WRAPPER} \ | 100 export CXX_target="${ANDROID_GOMA_WRAPPER} \ |
100 $(echo -n ${ANDROID_TOOLCHAIN}/*-g++)" | 101 $(echo -n ${ANDROID_TOOLCHAIN}/*-g++)" |
101 export LINK_target=$(echo -n ${ANDROID_TOOLCHAIN}/*-gcc) | 102 export LINK_target=$(echo -n ${ANDROID_TOOLCHAIN}/*-gcc) |
102 export AR_target=$(echo -n ${ANDROID_TOOLCHAIN}/*-ar) | 103 export AR_target=$(echo -n ${ANDROID_TOOLCHAIN}/*-ar) |
103 | 104 |
104 # Performs a gyp_chromium run to convert gyp->Makefile for android code. | 105 # Performs a gyp_chromium run to convert gyp->Makefile for android code. |
105 android_gyp() { | 106 android_gyp() { |
106 echo "GYP_GENERATORS set to '$GYP_GENERATORS'" | 107 echo "GYP_GENERATORS set to '$GYP_GENERATORS'" |
107 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@" | 108 "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@" |
108 } | 109 } |
109 | 110 |
110 # FLOCK needs to be null on system that has no flock | 111 # FLOCK needs to be null on system that has no flock |
111 which flock > /dev/null || export FLOCK= | 112 which flock > /dev/null || export FLOCK= |
OLD | NEW |