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 = exec_script("//build/dir_exists.py",
9 [ rebase_path("//clank", root_build_dir) ],
12 if (has_chrome_android_internal) {
13 import("//clank/config.gni")
15 default_android_sdk_root = "//third_party/android_tools/sdk"
16 default_android_sdk_version = "21"
17 default_android_sdk_build_tools_version = "21.0.1"
21 android_sdk_root = default_android_sdk_root
22 android_sdk_version = default_android_sdk_version
23 android_sdk_build_tools_version = default_android_sdk_build_tools_version
25 # This is set when building the Android WebView inside the Android build
26 # system, using the 'android' gyp backend. The WebView code is still built
27 # when this is unset, but builds using the normal chromium build system.
28 is_android_webview_build = false
30 android_default_keystore_path = "//build/android/ant/chromium-debug.keystore"
31 android_default_keystore_name = "chromiumdebugkey"
32 android_default_keystore_password = "chromium"
34 # This is a unique identifier for a given build. It's used for
35 # identifying various build artifacts corresponding to a particular build of
36 # chrome (e.g. where to find archived symbols).
37 android_chrome_build_id = "\"\""
40 # ABI ------------------------------------------------------------------------
42 if (cpu_arch == "x86") {
43 android_app_abi = "x86"
44 } else if (cpu_arch == "arm") {
45 import("//build/config/arm.gni")
46 if (arm_version < 7) {
47 android_app_abi = "armeabi"
49 android_app_abi = "armeabi-v7a"
51 } else if (cpu_arch == "mipsel") {
52 android_app_abi = "mips"
54 assert(false, "Unknown Android ABI: " + cpu_arch)
57 # Host stuff -----------------------------------------------------------------
59 # Defines the name the Android build gives to the current host CPU
60 # architecture, which is different than the names GN uses.
61 if (build_cpu_arch == "x64") {
62 android_host_arch = "x86_64"
63 } else if (build_cpu_arch == "x86") {
64 android_host_arch = "x86"
66 assert(false, "Need Android toolchain support for your build CPU arch.")
69 # Defines the name the Android build gives to the current host CPU
70 # architecture, which is different than the names GN uses.
71 if (build_os == "linux") {
72 android_host_os = "linux"
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 = "${android_sdk_root}/build-tools/$android_sdk_build_tools_version"
94 # Path to the SDK's android.jar
95 android_sdk_jar = "$android_sdk/android.jar"
97 zipalign_path = "$android_sdk_build_tools/zipalign"
99 # Subdirectories inside android_ndk_root that contain the sysroot for the
100 # associated platform.
101 _android_api_level = 14
102 x86_android_sysroot_subdir = "platforms/android-${_android_api_level}/arch-x86"
103 arm_android_sysroot_subdir = "platforms/android-${_android_api_level}/arch-arm"
104 mips_android_sysroot_subdir = "platforms/android-${_android_api_level}/arch-mips"
106 # Toolchain root directory for each build. The actual binaries are inside
107 # a "bin" directory inside of these.
108 _android_toolchain_version = "4.9"
109 x86_android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
110 arm_android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
111 mips_android_toolchain_root = "$android_ndk_root/toolchains/mipsel-linux-android-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
113 # Location of libgcc. This is only needed for the current GN toolchain, so we
114 # only need to define the current one, rather than one for every platform
115 # like the toolchain roots.
116 if (cpu_arch == "x86") {
117 android_prebuilt_arch = "android-x86"
118 _binary_prefix = "i686-linux-android"
119 android_toolchain_root = "$x86_android_toolchain_root"
120 android_libgcc_file =
121 "$android_toolchain_root/lib/gcc/i686-linux-android/${_android_toolchain_version}/libgcc.a"
122 } else if (cpu_arch == "arm") {
123 android_prebuilt_arch = "android-arm"
124 _binary_prefix = "arm-linux-androideabi"
125 android_toolchain_root = "$arm_android_toolchain_root"
127 android_libgcc_file =
128 "$android_toolchain_root/lib/gcc/arm-linux-androideabi/${_android_toolchain_version}/thumb/libgcc.a"
130 android_libgcc_file =
131 "$android_toolchain_root/lib/gcc/arm-linux-androideabi/${_android_toolchain_version}/libgcc.a"
133 } else if (cpu_arch == "mipsel") {
134 android_prebuilt_arch = "android-mips"
135 _binary_prefix = "mipsel-linux-android"
136 android_toolchain_root = "$mips_android_toolchain_root"
137 android_libgcc_file =
138 "$android_toolchain_root/lib/gcc/mipsel-linux-android/${_android_toolchain_version}/libgcc.a"
140 assert(false, "Need android libgcc support for your target arch.")
143 android_tool_prefix = "$android_toolchain_root/bin/$_binary_prefix-"
144 android_readelf = "${android_tool_prefix}readelf"
145 android_objcopy = "${android_tool_prefix}objcopy"
146 android_gdbserver = "$android_ndk_root/prebuilt/$android_prebuilt_arch/gdbserver/gdbserver"
148 # stlport stuff --------------------------------------------------------------
150 if (component_mode == "shared_library") {
151 android_stlport_library = "stlport_shared"
153 android_stlport_library = "stlport_static"
156 if (!defined(is_android_webview_build)) {
157 is_android_webview_build = false