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.
9 # Absolute directory containing the Android source code.
12 android_sdk_root = "//third_party/android_tools/sdk"
13 android_sdk_version = "20"
15 # This is set when building the Android WebView inside the Android build
16 # system, using the 'android' gyp backend. The WebView code is still built
17 # when this is unset, but builds using the normal chromium build system.
18 is_android_webview_build = false
21 if (is_android_webview_build) {
22 assert(android_src != "",
23 "You must specify android_src for an Android WebView build.")
26 # Host stuff -----------------------------------------------------------------
28 # Defines the name the Android build gives to the current host CPU
29 # architecture, which is different than the names GN uses.
30 if (build_cpu_arch == "x64") {
31 android_host_arch = "x86_64"
32 } else if (build_cpu_arch == "x86") {
33 android_host_arch = "x86"
35 assert(false, "Need Android toolchain support for your build CPU arch.")
38 # Defines the name the Android build gives to the current host CPU
39 # architecture, which is different than the names GN uses.
40 if (build_os == "linux") {
41 android_host_os = "linux"
43 assert(false, "Need Android toolchain support for your build OS.")
46 # Directories and files ------------------------------------------------------
48 # We define may of the dirs strings here for each output architecture (rather
49 # than just the current one) since these are needed by the Android toolchain
50 # file to define toolchains for all possible targets in one pass.
52 android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
54 # Path to the Android NDK and SDK.
55 android_ndk_root = "//third_party/android_tools/ndk"
57 android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
59 android_sdk_tools = "${android_sdk_root}/tools"
60 android_sdk_build_tools = "${android_sdk_root}/build-tools/20.0.0"
62 # Path to the SDK's android.jar
63 android_sdk_jar = "$android_sdk/android.jar"
65 # Subdirectories inside android_ndk_root that contain the sysroot for the
66 # associated platform.
67 _android_api_level = 14
68 x86_android_sysroot_subdir = "platforms/android-${_android_api_level}/arch-x86"
69 arm_android_sysroot_subdir = "platforms/android-${_android_api_level}/arch-arm"
70 mips_android_sysroot_subdir = "platforms/android-${_android_api_level}/arch-mips"
72 # Toolchain root directory for each build. The actual binaries are inside
73 # a "bin" directory inside of these.
74 _android_toolchain_version = "4.8"
75 x86_android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
76 arm_android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
77 mips_android_toolchain_root = "$android_ndk_root/toolchains/mipsel-linux-android-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
79 # Location of libgcc. This is only needed for the current GN toolchain, so we
80 # only need to define the current one, rather than one for every platform
81 # like the toolchain roots.
82 if (cpu_arch == "x86") {
84 "$x86_android_toolchain_root/lib/gcc/i686-linux-android/${_android_toolchain_version}/libgcc.a"
85 } else if (cpu_arch == "arm") {
87 "$arm_android_toolchain_root/lib/gcc/arm-linux-androideabi/${_android_toolchain_version}/libgcc.a"
88 } else if (cpu_arch == "mipsel") {
90 "$mips_android_toolchain_root/lib/gcc/mipsel-linux-android/${_android_toolchain_version}/libgcc.a"
92 assert(false, "Need android libgcc support for your target arch.")
95 # stlport stuff --------------------------------------------------------------
97 use_system_stlport = is_android_webview_build
99 if (use_system_stlport) {
100 android_stlport_library = "stlport"
101 } else if (component_mode == "shared_library") {
102 android_stlport_library = "stlport_shared"
104 android_stlport_library = "stlport_static"
107 # ABI ------------------------------------------------------------------------
109 if (cpu_arch == "x86") {
110 android_app_abi = "x86"
111 } else if (cpu_arch == "arm") {
112 import("//build/config/arm.gni")
113 if (arm_version < 7) {
114 android_app_abi = "armeabi"
116 android_app_abi = "armeabi-v7a"
118 } else if (cpu_arch == "mipsel") {
119 android_app_abi = "mips"
121 assert(false, "Unknown Android ABI: " + cpu_arch)
124 if (!defined(is_android_webview_build)) {
125 is_android_webview_build = false
127 use_system_stlport = false