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 = "22"
20 default_android_sdk_build_tools_version = "22.0.0"
23 if (!defined(google_play_services_library)) {
24 google_play_services_library =
25 "//third_party/android_tools:google_play_services_default_java"
29 android_sdk_root = default_android_sdk_root
30 android_sdk_version = default_android_sdk_version
31 android_sdk_build_tools_version = default_android_sdk_build_tools_version
33 # WebView now builds in a normal android build; don't use this.
34 # TODO(torne): remove this. http://crbug.com/440793
35 is_android_webview_build = false
37 android_default_keystore_path =
38 "//build/android/ant/chromium-debug.keystore"
39 android_default_keystore_name = "chromiumdebugkey"
40 android_default_keystore_password = "chromium"
42 # This is a unique identifier for a given build. It's used for
43 # identifying various build artifacts corresponding to a particular build of
44 # chrome (e.g. where to find archived symbols).
45 android_chrome_build_id = "\"\""
47 # Set to true to run findbugs on JAR targets.
51 # Host stuff -----------------------------------------------------------------
53 # Defines the name the Android build gives to the current host CPU
54 # architecture, which is different than the names GN uses.
55 if (host_cpu == "x64") {
56 android_host_arch = "x86_64"
57 } else if (host_cpu == "x86") {
58 android_host_arch = "x86"
60 assert(false, "Need Android toolchain support for your build CPU arch.")
63 # Defines the name the Android build gives to the current host CPU
64 # architecture, which is different than the names GN uses.
65 if (host_os == "linux") {
66 android_host_os = "linux"
68 assert(false, "Need Android toolchain support for your build OS.")
71 # Directories and files ------------------------------------------------------
73 # We define may of the dirs strings here for each output architecture (rather
74 # than just the current one) since these are needed by the Android toolchain
75 # file to define toolchains for all possible targets in one pass.
77 android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
79 # Path to the Android NDK and SDK.
80 android_ndk_root = "//third_party/android_tools/ndk"
81 android_ndk_include_dir = "$android_ndk_root/usr/include"
83 android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
85 android_sdk_tools = "${android_sdk_root}/tools"
86 android_sdk_build_tools =
87 "${android_sdk_root}/build-tools/$android_sdk_build_tools_version"
89 # Path to the SDK's android.jar
90 android_sdk_jar = "$android_sdk/android.jar"
92 zipalign_path = "$android_sdk_build_tools/zipalign"
94 # Subdirectories inside android_ndk_root that contain the sysroot for the
95 # associated platform.
96 _android_api_level = 14
97 x86_android_sysroot_subdir =
98 "platforms/android-${_android_api_level}/arch-x86"
99 arm_android_sysroot_subdir =
100 "platforms/android-${_android_api_level}/arch-arm"
101 mips_android_sysroot_subdir =
102 "platforms/android-${_android_api_level}/arch-mips"
103 _android64_api_level = 21
104 x86_64_android_sysroot_subdir =
105 "platforms/android-${_android64_api_level}/arch-x86_64"
106 arm64_android_sysroot_subdir =
107 "platforms/android-${_android64_api_level}/arch-arm64"
108 mips64_android_sysroot_subdir =
109 "platforms/android-${_android64_api_level}/arch-mips64"
111 # Toolchain root directory for each build. The actual binaries are inside
112 # a "bin" directory inside of these.
113 _android_toolchain_version = "4.9"
114 x86_android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
115 arm_android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
116 mips_android_toolchain_root = "$android_ndk_root/toolchains/mipsel-linux-android-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
117 x86_64_android_toolchain_root = "$android_ndk_root/toolchains/x86_64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
118 arm64_android_toolchain_root = "$android_ndk_root/toolchains/aarch64-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
119 mips64_android_toolchain_root = "$android_ndk_root/toolchains/mips64el-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
121 # Location of libgcc. This is only needed for the current GN toolchain, so we
122 # only need to define the current one, rather than one for every platform
123 # like the toolchain roots.
124 if (current_cpu == "x86") {
125 android_prebuilt_arch = "android-x86"
126 _binary_prefix = "i686-linux-android"
127 android_toolchain_root = "$x86_android_toolchain_root"
128 android_libgcc_file = "$android_toolchain_root/lib/gcc/i686-linux-android/${_android_toolchain_version}/libgcc.a"
129 } else if (current_cpu == "arm") {
130 android_prebuilt_arch = "android-arm"
131 _binary_prefix = "arm-linux-androideabi"
132 android_toolchain_root = "$arm_android_toolchain_root"
133 android_libgcc_file = "$android_toolchain_root/lib/gcc/arm-linux-androideabi/${_android_toolchain_version}/libgcc.a"
134 } else if (current_cpu == "mipsel") {
135 android_prebuilt_arch = "android-mips"
136 _binary_prefix = "mipsel-linux-android"
137 android_toolchain_root = "$mips_android_toolchain_root"
138 android_libgcc_file = "$android_toolchain_root/lib/gcc/mipsel-linux-android/${_android_toolchain_version}/libgcc.a"
139 } else if (current_cpu == "x64") {
140 android_prebuilt_arch = "android-x86_64"
141 _binary_prefix = "x86_64-linux-android"
142 android_toolchain_root = "$x86_64_android_toolchain_root"
143 android_libgcc_file = "$android_toolchain_root/lib/gcc/x86_64-linux-android/${_android_toolchain_version}/libgcc.a"
144 } else if (current_cpu == "arm64") {
145 android_prebuilt_arch = "android-arm64"
146 _binary_prefix = "aarch64-linux-android"
147 android_toolchain_root = "$arm64_android_toolchain_root"
148 android_libgcc_file = "$android_toolchain_root/lib/gcc/aarch64-linux-android/${_android_toolchain_version}/libgcc.a"
149 } else if (current_cpu == "mips64el") {
150 android_prebuilt_arch = "android-mips64"
151 _binary_prefix = "mips64el-linux-android"
152 android_toolchain_root = "$mips64_android_toolchain_root"
153 android_libgcc_file = "$android_toolchain_root/lib/gcc/mips64el-linux-android/${_android_toolchain_version}/libgcc.a"
155 assert(false, "Need android libgcc support for your target arch.")
158 android_tool_prefix = "$android_toolchain_root/bin/$_binary_prefix-"
159 android_readelf = "${android_tool_prefix}readelf"
160 android_objcopy = "${android_tool_prefix}objcopy"
162 "$android_ndk_root/prebuilt/$android_prebuilt_arch/gdbserver/gdbserver"
164 # stlport stuff --------------------------------------------------------------
166 if (component_mode == "shared_library") {
167 android_stlport_library = "stlport_shared"
169 android_stlport_library = "stlport_static"
172 # ABI ------------------------------------------------------------------------
174 if (current_cpu == "x86") {
175 android_app_abi = "x86"
176 } else if (current_cpu == "arm") {
177 import("//build/config/arm.gni")
178 if (arm_version < 7) {
179 android_app_abi = "armeabi"
181 android_app_abi = "armeabi-v7a"
183 } else if (current_cpu == "mipsel") {
184 android_app_abi = "mips"
185 } else if (current_cpu == "x64") {
186 android_app_abi = "x86_64"
187 } else if (current_cpu == "arm64") {
188 android_app_abi = "arm64-v8a"
189 } else if (current_cpu == "mips64el") {
190 android_app_abi = "mips64"
192 assert(false, "Unknown Android ABI: " + current_cpu)
195 if (!defined(is_android_webview_build)) {
196 is_android_webview_build = false