1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
5 # This file contains common system config stuff for the Android build.
8 has_chrome_android_internal =
9 exec_script("//build/dir_exists.py",
10 [ rebase_path("//clank", root_build_dir) ],
13 if (has_chrome_android_internal) {
14 import("//clank/config.gni")
17 if (!defined(default_android_sdk_root)) {
18 default_android_sdk_root = "//third_party/android_tools/sdk"
19 default_android_sdk_version = "23"
20 default_android_sdk_build_tools_version = "23.0.0"
23 if (!defined(default_android_keystore_path)) {
24 default_android_keystore_path =
25 "//build/android/ant/chromium-debug.keystore"
26 default_android_keystore_name = "chromiumdebugkey"
27 default_android_keystore_password = "chromium"
30 if (!defined(google_play_services_library)) {
31 google_play_services_library =
32 "//third_party/android_tools:google_play_services_default_java"
35 if (!defined(google_play_services_resources)) {
36 google_play_services_resources =
37 "//third_party/android_tools:google_play_services_default_resources"
41 android_sdk_root = default_android_sdk_root
42 android_sdk_version = default_android_sdk_version
43 android_sdk_build_tools_version = default_android_sdk_build_tools_version
45 # The path to the keystore to use for signing builds.
46 android_keystore_path = default_android_keystore_path
48 # The name of the keystore to use for signing builds.
49 android_keystore_name = default_android_keystore_name
51 # The password for the keystore to use for signing builds.
52 android_keystore_password = default_android_keystore_password
54 # This is a unique identifier for a given build. It's used for
55 # identifying various build artifacts corresponding to a particular build of
56 # chrome (e.g. where to find archived symbols).
57 android_chrome_build_id = "\"\""
59 # Set to true to run findbugs on JAR targets.
62 # Set to true to enable verbose findbugs logging. This does nothing if
63 # run_findbugs is false.
64 findbugs_verbose = false
66 # Set to true to enable the Errorprone compiler
67 use_errorprone_java_compiler = false
70 # Host stuff -----------------------------------------------------------------
72 # Defines the name the Android build gives to the current host CPU
73 # architecture, which is different than the names GN uses.
74 if (host_cpu == "x64") {
75 android_host_arch = "x86_64"
76 } else if (host_cpu == "x86") {
77 android_host_arch = "x86"
79 assert(false, "Need Android toolchain support for your build CPU arch.")
82 # Defines the name the Android build gives to the current host CPU
83 # architecture, which is different than the names GN uses.
84 if (host_os == "linux") {
85 android_host_os = "linux"
86 } else if (host_os == "mac") {
87 android_host_os = "darwin"
89 assert(false, "Need Android toolchain support for your build OS.")
92 # Directories and files ------------------------------------------------------
94 # We define may of the dirs strings here for each output architecture (rather
95 # than just the current one) since these are needed by the Android toolchain
96 # file to define toolchains for all possible targets in one pass.
98 android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
100 # Path to the Android NDK and SDK.
101 android_ndk_root = "//third_party/android_tools/ndk"
102 android_ndk_include_dir = "$android_ndk_root/usr/include"
104 android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
106 android_sdk_tools = "${android_sdk_root}/tools"
107 android_sdk_build_tools =
108 "${android_sdk_root}/build-tools/$android_sdk_build_tools_version"
110 # Path to the SDK's android.jar
111 android_sdk_jar = "$android_sdk/android.jar"
113 zipalign_path = "$android_sdk_build_tools/zipalign"
115 # Subdirectories inside android_ndk_root that contain the sysroot for the
116 # associated platform.
117 _android_api_level = 16
118 x86_android_sysroot_subdir =
119 "platforms/android-${_android_api_level}/arch-x86"
120 arm_android_sysroot_subdir =
121 "platforms/android-${_android_api_level}/arch-arm"
122 mips_android_sysroot_subdir =
123 "platforms/android-${_android_api_level}/arch-mips"
124 _android64_api_level = 21
125 x86_64_android_sysroot_subdir =
126 "platforms/android-${_android64_api_level}/arch-x86_64"
127 arm64_android_sysroot_subdir =
128 "platforms/android-${_android64_api_level}/arch-arm64"
129 mips64_android_sysroot_subdir =
130 "platforms/android-${_android64_api_level}/arch-mips64"
132 # Toolchain root directory for each build. The actual binaries are inside
133 # a "bin" directory inside of these.
134 _android_toolchain_version = "4.9"
135 x86_android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
136 arm_android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
137 mips_android_toolchain_root = "$android_ndk_root/toolchains/mipsel-linux-android-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
138 x86_64_android_toolchain_root = "$android_ndk_root/toolchains/x86_64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
139 arm64_android_toolchain_root = "$android_ndk_root/toolchains/aarch64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
140 mips64_android_toolchain_root = "$android_ndk_root/toolchains/mips64el-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
142 # Location of libgcc. This is only needed for the current GN toolchain, so we
143 # only need to define the current one, rather than one for every platform
144 # like the toolchain roots.
145 if (current_cpu == "x86") {
146 android_prebuilt_arch = "android-x86"
147 _binary_prefix = "i686-linux-android"
148 android_toolchain_root = "$x86_android_toolchain_root"
149 android_libgcc_file = "$android_toolchain_root/lib/gcc/i686-linux-android/${_android_toolchain_version}/libgcc.a"
150 } else if (current_cpu == "arm") {
151 android_prebuilt_arch = "android-arm"
152 _binary_prefix = "arm-linux-androideabi"
153 android_toolchain_root = "$arm_android_toolchain_root"
154 android_libgcc_file = "$android_toolchain_root/lib/gcc/arm-linux-androideabi/${_android_toolchain_version}/libgcc.a"
155 } else if (current_cpu == "mipsel") {
156 android_prebuilt_arch = "android-mips"
157 _binary_prefix = "mipsel-linux-android"
158 android_toolchain_root = "$mips_android_toolchain_root"
159 android_libgcc_file = "$android_toolchain_root/lib/gcc/mipsel-linux-android/${_android_toolchain_version}/libgcc.a"
160 } else if (current_cpu == "x64") {
161 android_prebuilt_arch = "android-x86_64"
162 _binary_prefix = "x86_64-linux-android"
163 android_toolchain_root = "$x86_64_android_toolchain_root"
164 android_libgcc_file = "$android_toolchain_root/lib/gcc/x86_64-linux-android/${_android_toolchain_version}/libgcc.a"
165 } else if (current_cpu == "arm64") {
166 android_prebuilt_arch = "android-arm64"
167 _binary_prefix = "aarch64-linux-android"
168 android_toolchain_root = "$arm64_android_toolchain_root"
169 android_libgcc_file = "$android_toolchain_root/lib/gcc/aarch64-linux-android/${_android_toolchain_version}/libgcc.a"
170 } else if (current_cpu == "mips64el") {
171 android_prebuilt_arch = "android-mips64"
172 _binary_prefix = "mips64el-linux-android"
173 android_toolchain_root = "$mips64_android_toolchain_root"
174 android_libgcc_file = "$android_toolchain_root/lib/gcc/mips64el-linux-android/${_android_toolchain_version}/libgcc.a"
176 assert(false, "Need android libgcc support for your target arch.")
179 android_tool_prefix = "$android_toolchain_root/bin/$_binary_prefix-"
180 android_readelf = "${android_tool_prefix}readelf"
181 android_objcopy = "${android_tool_prefix}objcopy"
183 "$android_ndk_root/prebuilt/$android_prebuilt_arch/gdbserver/gdbserver"
185 # Toolchain stuff ------------------------------------------------------------
187 android_libcpp_root = "$android_ndk_root/sources/cxx-stl/llvm-libc++"
188 if (is_component_build) {
189 android_libcpp_library = "c++_shared"
191 android_libcpp_library = "c++_static"
194 # ABI ------------------------------------------------------------------------
196 if (current_cpu == "x86") {
197 android_app_abi = "x86"
198 } else if (current_cpu == "arm") {
199 import("//build/config/arm.gni")
200 if (arm_version < 7) {
201 android_app_abi = "armeabi"
203 android_app_abi = "armeabi-v7a"
205 } else if (current_cpu == "mipsel") {
206 android_app_abi = "mips"
207 } else if (current_cpu == "x64") {
208 android_app_abi = "x86_64"
209 } else if (current_cpu == "arm64") {
210 android_app_abi = "arm64-v8a"
211 } else if (current_cpu == "mips64el") {
212 android_app_abi = "mips64"
214 assert(false, "Unknown Android ABI: " + current_cpu)