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(google_play_services_library)) {
24 google_play_services_library =
25 "//third_party/android_tools:google_play_services_default_java"
28 if (!defined(google_play_services_resources)) {
29 google_play_services_resources =
30 "//third_party/android_tools:google_play_services_default_resources"
34 android_sdk_root = default_android_sdk_root
35 android_sdk_version = default_android_sdk_version
36 android_sdk_build_tools_version = default_android_sdk_build_tools_version
38 android_default_keystore_path =
39 "//build/android/ant/chromium-debug.keystore"
40 android_default_keystore_name = "chromiumdebugkey"
41 android_default_keystore_password = "chromium"
43 # This is a unique identifier for a given build. It's used for
44 # identifying various build artifacts corresponding to a particular build of
45 # chrome (e.g. where to find archived symbols).
46 android_chrome_build_id = "\"\""
48 # Set to true to run findbugs on JAR targets.
51 # Set to true to enable the Errorprone compiler
52 use_errorprone_java_compiler = false
55 # Host stuff -----------------------------------------------------------------
57 # Defines the name the Android build gives to the current host CPU
58 # architecture, which is different than the names GN uses.
59 if (host_cpu == "x64") {
60 android_host_arch = "x86_64"
61 } else if (host_cpu == "x86") {
62 android_host_arch = "x86"
64 assert(false, "Need Android toolchain support for your build CPU arch.")
67 # Defines the name the Android build gives to the current host CPU
68 # architecture, which is different than the names GN uses.
69 if (host_os == "linux") {
70 android_host_os = "linux"
71 } else if (host_os == "mac") {
72 android_host_os = "darwin"
74 assert(false, "Need Android toolchain support for your build OS.")
77 # Directories and files ------------------------------------------------------
79 # We define may of the dirs strings here for each output architecture (rather
80 # than just the current one) since these are needed by the Android toolchain
81 # file to define toolchains for all possible targets in one pass.
83 android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
85 # Path to the Android NDK and SDK.
86 android_ndk_root = "//third_party/android_tools/ndk"
87 android_ndk_include_dir = "$android_ndk_root/usr/include"
89 android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
91 android_sdk_tools = "${android_sdk_root}/tools"
92 android_sdk_build_tools =
93 "${android_sdk_root}/build-tools/$android_sdk_build_tools_version"
95 # Path to the SDK's android.jar
96 android_sdk_jar = "$android_sdk/android.jar"
98 zipalign_path = "$android_sdk_build_tools/zipalign"
100 # Subdirectories inside android_ndk_root that contain the sysroot for the
101 # associated platform.
102 _android_api_level = 16
103 x86_android_sysroot_subdir =
104 "platforms/android-${_android_api_level}/arch-x86"
105 arm_android_sysroot_subdir =
106 "platforms/android-${_android_api_level}/arch-arm"
107 mips_android_sysroot_subdir =
108 "platforms/android-${_android_api_level}/arch-mips"
109 _android64_api_level = 21
110 x86_64_android_sysroot_subdir =
111 "platforms/android-${_android64_api_level}/arch-x86_64"
112 arm64_android_sysroot_subdir =
113 "platforms/android-${_android64_api_level}/arch-arm64"
114 mips64_android_sysroot_subdir =
115 "platforms/android-${_android64_api_level}/arch-mips64"
117 # Toolchain root directory for each build. The actual binaries are inside
118 # a "bin" directory inside of these.
119 _android_toolchain_version = "4.9"
120 x86_android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
121 arm_android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
122 mips_android_toolchain_root = "$android_ndk_root/toolchains/mipsel-linux-android-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
123 x86_64_android_toolchain_root = "$android_ndk_root/toolchains/x86_64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
124 arm64_android_toolchain_root = "$android_ndk_root/toolchains/aarch64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
125 mips64_android_toolchain_root = "$android_ndk_root/toolchains/mips64el-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
127 # Location of libgcc. This is only needed for the current GN toolchain, so we
128 # only need to define the current one, rather than one for every platform
129 # like the toolchain roots.
130 if (current_cpu == "x86") {
131 android_prebuilt_arch = "android-x86"
132 _binary_prefix = "i686-linux-android"
133 android_toolchain_root = "$x86_android_toolchain_root"
134 android_libgcc_file = "$android_toolchain_root/lib/gcc/i686-linux-android/${_android_toolchain_version}/libgcc.a"
135 } else if (current_cpu == "arm") {
136 android_prebuilt_arch = "android-arm"
137 _binary_prefix = "arm-linux-androideabi"
138 android_toolchain_root = "$arm_android_toolchain_root"
139 android_libgcc_file = "$android_toolchain_root/lib/gcc/arm-linux-androideabi/${_android_toolchain_version}/libgcc.a"
140 } else if (current_cpu == "mipsel") {
141 android_prebuilt_arch = "android-mips"
142 _binary_prefix = "mipsel-linux-android"
143 android_toolchain_root = "$mips_android_toolchain_root"
144 android_libgcc_file = "$android_toolchain_root/lib/gcc/mipsel-linux-android/${_android_toolchain_version}/libgcc.a"
145 } else if (current_cpu == "x64") {
146 android_prebuilt_arch = "android-x86_64"
147 _binary_prefix = "x86_64-linux-android"
148 android_toolchain_root = "$x86_64_android_toolchain_root"
149 android_libgcc_file = "$android_toolchain_root/lib/gcc/x86_64-linux-android/${_android_toolchain_version}/libgcc.a"
150 } else if (current_cpu == "arm64") {
151 android_prebuilt_arch = "android-arm64"
152 _binary_prefix = "aarch64-linux-android"
153 android_toolchain_root = "$arm64_android_toolchain_root"
154 android_libgcc_file = "$android_toolchain_root/lib/gcc/aarch64-linux-android/${_android_toolchain_version}/libgcc.a"
155 } else if (current_cpu == "mips64el") {
156 android_prebuilt_arch = "android-mips64"
157 _binary_prefix = "mips64el-linux-android"
158 android_toolchain_root = "$mips64_android_toolchain_root"
159 android_libgcc_file = "$android_toolchain_root/lib/gcc/mips64el-linux-android/${_android_toolchain_version}/libgcc.a"
161 assert(false, "Need android libgcc support for your target arch.")
164 android_tool_prefix = "$android_toolchain_root/bin/$_binary_prefix-"
165 android_readelf = "${android_tool_prefix}readelf"
166 android_objcopy = "${android_tool_prefix}objcopy"
168 "$android_ndk_root/prebuilt/$android_prebuilt_arch/gdbserver/gdbserver"
170 # Toolchain stuff ------------------------------------------------------------
172 android_libcpp_root = "$android_ndk_root/sources/cxx-stl/llvm-libc++"
173 if (is_component_build) {
174 android_libcpp_library = "c++_shared"
176 android_libcpp_library = "c++_static"
179 # ABI ------------------------------------------------------------------------
181 if (current_cpu == "x86") {
182 android_app_abi = "x86"
183 } else if (current_cpu == "arm") {
184 import("//build/config/arm.gni")
185 if (arm_version < 7) {
186 android_app_abi = "armeabi"
188 android_app_abi = "armeabi-v7a"
190 } else if (current_cpu == "mipsel") {
191 android_app_abi = "mips"
192 } else if (current_cpu == "x64") {
193 android_app_abi = "x86_64"
194 } else if (current_cpu == "arm64") {
195 android_app_abi = "arm64-v8a"
196 } else if (current_cpu == "mips64el") {
197 android_app_abi = "mips64"
199 assert(false, "Unknown Android ABI: " + current_cpu)