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
69 # Disables process isolation when building _incremental targets.
70 # Required for Android M+ due to SELinux policies (stronger sandboxing).
71 disable_incremental_isolated_processes = false
74 # Host stuff -----------------------------------------------------------------
76 # Defines the name the Android build gives to the current host CPU
77 # architecture, which is different than the names GN uses.
78 if (host_cpu == "x64") {
79 android_host_arch = "x86_64"
80 } else if (host_cpu == "x86") {
81 android_host_arch = "x86"
83 assert(false, "Need Android toolchain support for your build CPU arch.")
86 # Defines the name the Android build gives to the current host CPU
87 # architecture, which is different than the names GN uses.
88 if (host_os == "linux") {
89 android_host_os = "linux"
90 } else if (host_os == "mac") {
91 android_host_os = "darwin"
93 assert(false, "Need Android toolchain support for your build OS.")
96 # Directories and files ------------------------------------------------------
98 # We define may of the dirs strings here for each output architecture (rather
99 # than just the current one) since these are needed by the Android toolchain
100 # file to define toolchains for all possible targets in one pass.
102 android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
104 # Path to the Android NDK and SDK.
105 android_ndk_root = "//third_party/android_tools/ndk"
106 android_ndk_include_dir = "$android_ndk_root/usr/include"
108 android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
110 android_sdk_tools = "${android_sdk_root}/tools"
111 android_sdk_build_tools =
112 "${android_sdk_root}/build-tools/$android_sdk_build_tools_version"
114 # Path to the SDK's android.jar
115 android_sdk_jar = "$android_sdk/android.jar"
117 zipalign_path = "$android_sdk_build_tools/zipalign"
119 # Subdirectories inside android_ndk_root that contain the sysroot for the
120 # associated platform.
121 _android_api_level = 16
122 x86_android_sysroot_subdir =
123 "platforms/android-${_android_api_level}/arch-x86"
124 arm_android_sysroot_subdir =
125 "platforms/android-${_android_api_level}/arch-arm"
126 mips_android_sysroot_subdir =
127 "platforms/android-${_android_api_level}/arch-mips"
128 _android64_api_level = 21
129 x86_64_android_sysroot_subdir =
130 "platforms/android-${_android64_api_level}/arch-x86_64"
131 arm64_android_sysroot_subdir =
132 "platforms/android-${_android64_api_level}/arch-arm64"
133 mips64_android_sysroot_subdir =
134 "platforms/android-${_android64_api_level}/arch-mips64"
136 # Toolchain root directory for each build. The actual binaries are inside
137 # a "bin" directory inside of these.
138 _android_toolchain_version = "4.9"
139 x86_android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
140 arm_android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
141 mips_android_toolchain_root = "$android_ndk_root/toolchains/mipsel-linux-android-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
142 x86_64_android_toolchain_root = "$android_ndk_root/toolchains/x86_64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
143 arm64_android_toolchain_root = "$android_ndk_root/toolchains/aarch64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
144 mips64_android_toolchain_root = "$android_ndk_root/toolchains/mips64el-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
146 # Location of libgcc. This is only needed for the current GN toolchain, so we
147 # only need to define the current one, rather than one for every platform
148 # like the toolchain roots.
149 if (current_cpu == "x86") {
150 android_prebuilt_arch = "android-x86"
151 _binary_prefix = "i686-linux-android"
152 android_toolchain_root = "$x86_android_toolchain_root"
153 android_libgcc_file = "$android_toolchain_root/lib/gcc/i686-linux-android/${_android_toolchain_version}/libgcc.a"
154 } else if (current_cpu == "arm") {
155 android_prebuilt_arch = "android-arm"
156 _binary_prefix = "arm-linux-androideabi"
157 android_toolchain_root = "$arm_android_toolchain_root"
158 android_libgcc_file = "$android_toolchain_root/lib/gcc/arm-linux-androideabi/${_android_toolchain_version}/libgcc.a"
159 } else if (current_cpu == "mipsel") {
160 android_prebuilt_arch = "android-mips"
161 _binary_prefix = "mipsel-linux-android"
162 android_toolchain_root = "$mips_android_toolchain_root"
163 android_libgcc_file = "$android_toolchain_root/lib/gcc/mipsel-linux-android/${_android_toolchain_version}/libgcc.a"
164 } else if (current_cpu == "x64") {
165 android_prebuilt_arch = "android-x86_64"
166 _binary_prefix = "x86_64-linux-android"
167 android_toolchain_root = "$x86_64_android_toolchain_root"
168 android_libgcc_file = "$android_toolchain_root/lib/gcc/x86_64-linux-android/${_android_toolchain_version}/libgcc.a"
169 } else if (current_cpu == "arm64") {
170 android_prebuilt_arch = "android-arm64"
171 _binary_prefix = "aarch64-linux-android"
172 android_toolchain_root = "$arm64_android_toolchain_root"
173 android_libgcc_file = "$android_toolchain_root/lib/gcc/aarch64-linux-android/${_android_toolchain_version}/libgcc.a"
174 } else if (current_cpu == "mips64el") {
175 android_prebuilt_arch = "android-mips64"
176 _binary_prefix = "mips64el-linux-android"
177 android_toolchain_root = "$mips64_android_toolchain_root"
178 android_libgcc_file = "$android_toolchain_root/lib/gcc/mips64el-linux-android/${_android_toolchain_version}/libgcc.a"
180 assert(false, "Need android libgcc support for your target arch.")
183 android_tool_prefix = "$android_toolchain_root/bin/$_binary_prefix-"
184 android_readelf = "${android_tool_prefix}readelf"
185 android_objcopy = "${android_tool_prefix}objcopy"
187 "$android_ndk_root/prebuilt/$android_prebuilt_arch/gdbserver/gdbserver"
189 # Toolchain stuff ------------------------------------------------------------
191 android_libcpp_root = "$android_ndk_root/sources/cxx-stl/llvm-libc++"
192 if (is_component_build) {
193 android_libcpp_library = "c++_shared"
195 android_libcpp_library = "c++_static"
198 # ABI ------------------------------------------------------------------------
200 if (current_cpu == "x86") {
201 android_app_abi = "x86"
202 } else if (current_cpu == "arm") {
203 import("//build/config/arm.gni")
204 if (arm_version < 7) {
205 android_app_abi = "armeabi"
207 android_app_abi = "armeabi-v7a"
209 } else if (current_cpu == "mipsel") {
210 android_app_abi = "mips"
211 } else if (current_cpu == "x64") {
212 android_app_abi = "x86_64"
213 } else if (current_cpu == "arm64") {
214 android_app_abi = "arm64-v8a"
215 } else if (current_cpu == "mips64el") {
216 android_app_abi = "mips64"
218 assert(false, "Unknown Android ABI: " + current_cpu)