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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 done | 91 done |
92 | 92 |
93 # Sets TARGET_ARCH. Defaults to arm if not specified. | 93 # Sets TARGET_ARCH. Defaults to arm if not specified. |
94 TARGET_ARCH=${target_arch:-arm} | 94 TARGET_ARCH=${target_arch:-arm} |
95 } | 95 } |
96 | 96 |
97 ################################################################################ | 97 ################################################################################ |
98 # Initializes environment variables for NDK/SDK build. | 98 # Initializes environment variables for NDK/SDK build. |
99 ################################################################################ | 99 ################################################################################ |
100 sdk_build_init() { | 100 sdk_build_init() { |
101 | |
102 # Allow the caller to override a few environment variables. If any of them is | 101 # Allow the caller to override a few environment variables. If any of them is |
103 # unset, we default to a sane value that's known to work. This allows for | 102 # unset, we default to a sane value that's known to work. This allows for |
104 # experimentation with a custom SDK. | 103 # experimentation with a custom SDK. |
105 local sdk_defines="" | |
106 if [[ -z "${ANDROID_NDK_ROOT}" || ! -d "${ANDROID_NDK_ROOT}" ]]; then | 104 if [[ -z "${ANDROID_NDK_ROOT}" || ! -d "${ANDROID_NDK_ROOT}" ]]; then |
107 export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/" | 105 export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/" |
108 fi | 106 fi |
109 if [[ -z "${ANDROID_SDK_ROOT}" || ! -d "${ANDROID_SDK_ROOT}" ]]; then | 107 if [[ -z "${ANDROID_SDK_ROOT}" || ! -d "${ANDROID_SDK_ROOT}" ]]; then |
110 export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/" | 108 export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/" |
111 else | |
112 sdk_defines+=" android_sdk_root=${ANDROID_SDK_ROOT}" | |
113 fi | |
114 if [[ -z "${ANDROID_SDK_BUILD_TOOLS_VERSION}" ]]; then | |
115 export ANDROID_SDK_BUILD_TOOLS_VERSION=19.0.0 | |
116 fi | 109 fi |
117 | 110 |
118 common_vars_defines | 111 common_vars_defines |
119 | 112 |
120 DEFINES+="${sdk_defines}" | |
121 | |
122 export GYP_DEFINES="${DEFINES}" | 113 export GYP_DEFINES="${DEFINES}" |
123 | 114 |
124 if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then | 115 if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then |
125 # Can not build WebView with NDK/SDK because it needs the Android build | 116 # Can not build WebView with NDK/SDK because it needs the Android build |
126 # system and build inside an Android source tree. | 117 # system and build inside an Android source tree. |
127 echo "Can not build WebView with NDK/SDK. Requires android source tree." \ | 118 echo "Can not build WebView with NDK/SDK. Requires android source tree." \ |
128 >& 2 | 119 >& 2 |
129 echo "Try . build/android/envsetup.sh instead." >& 2 | 120 echo "Try . build/android/envsetup.sh instead." >& 2 |
130 return 1 | 121 return 1 |
131 fi | 122 fi |
132 | |
133 # Directory containing build-tools: aapt, aidl, dx | |
134 export ANDROID_SDK_TOOLS="${ANDROID_SDK_ROOT}/build-tools/\ | |
135 ${ANDROID_SDK_BUILD_TOOLS_VERSION}" | |
136 } | 123 } |
137 | 124 |
138 ################################################################################ | 125 ################################################################################ |
139 # To build WebView, we use the Android build system and build inside an Android | 126 # To build WebView, we use the Android build system and build inside an Android |
140 # source tree. | 127 # source tree. |
141 ############################################################################# | 128 ############################################################################# |
142 webview_build_init() { | 129 webview_build_init() { |
143 # Use the latest API in the AOSP prebuilts directory (change with AOSP roll). | 130 # Use the latest API in the AOSP prebuilts directory (change with AOSP roll). |
144 android_sdk_version=18 | 131 android_sdk_version=18 |
145 | 132 |
(...skipping 21 matching lines...) Expand all Loading... |
167 DEFINES+=" android_sdk_root=\$(PWD)/${ANDROID_SDK}" | 154 DEFINES+=" android_sdk_root=\$(PWD)/${ANDROID_SDK}" |
168 DEFINES+=" android_sdk_tools=\$(PWD)/${ANDROID_SDK_TOOLS}" | 155 DEFINES+=" android_sdk_tools=\$(PWD)/${ANDROID_SDK_TOOLS}" |
169 DEFINES+=" android_sdk_version=${android_sdk_version}" | 156 DEFINES+=" android_sdk_version=${android_sdk_version}" |
170 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" | 157 DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}" |
171 if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then | 158 if [[ -n "$CHROME_ANDROID_WEBVIEW_OFFICIAL_BUILD" ]]; then |
172 DEFINES+=" logging_like_official_build=1" | 159 DEFINES+=" logging_like_official_build=1" |
173 DEFINES+=" tracing_like_official_build=1" | 160 DEFINES+=" tracing_like_official_build=1" |
174 fi | 161 fi |
175 export GYP_DEFINES="${DEFINES}" | 162 export GYP_DEFINES="${DEFINES}" |
176 } | 163 } |
OLD | NEW |