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 # This is set when building the Android WebView inside the Android build
13 # system, using the 'android' gyp backend. The WebView code is still built
14 # when this is unset, but builds using the normal chromium build system.
15 is_android_webview_build = false
18 if (is_android_webview_build) {
19 assert(android_src != "",
20 "You must specify android_src for an Android WebView build.")
23 # Host stuff -----------------------------------------------------------------
25 # Defines the name the Android build gives to the current host CPU
26 # architecture, which is different than the names GN uses.
27 if (build_cpu_arch == "x64") {
28 android_host_arch = "x86_64"
29 } else if (build_cpu_arch == "x86") {
30 android_host_arch = "x86"
32 assert(false, "Need Android toolchain support for your build CPU arch.")
35 # Defines the name the Android build gives to the current host CPU
36 # architecture, which is different than the names GN uses.
37 if (build_os == "linux") {
38 android_host_os = "linux"
40 assert(false, "Need Android toolchain support for your build OS.")
43 # Directories and files ------------------------------------------------------
45 # We define may of the dirs strings here for each output architecture (rather
46 # than just the current one) since these are needed by the Android toolchain
47 # file to define toolchains for all possible targets in one pass.
49 # Path to the Android NDK and SDK.
50 android_ndk_root = "//third_party/android_tools/ndk"
51 android_sdk_root = "//third_party/android_tools/sdk"
53 # Path to the SDK's android.jar
54 android_sdk_jar = "$android_sdk_root/platforms/android-19/android.jar"
56 # Subdirectories inside android_ndk_root that contain the sysroot for the
57 # associated platform.
58 _android_api_level = 14
59 x86_android_sysroot_subdir = "platforms/android-${_android_api_level}/arch-x86"
60 arm_android_sysroot_subdir = "platforms/android-${_android_api_level}/arch-arm"
61 mips_android_sysroot_subdir = "platforms/android-${_android_api_level}/arch-mips"
63 # Toolchain root directory for each build. The actual binaries are inside
64 # a "bin" directory inside of these.
65 _android_toolchain_version = "4.8"
66 x86_android_toolchain_root = "$android_ndk_root/toolchains/x86-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
67 arm_android_toolchain_root = "$android_ndk_root/toolchains/arm-linux-androideabi-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
68 mips_android_toolchain_root = "$android_ndk_root/toolchains/mipsel-linux-android-${_android_toolchain_version}/prebuilt/${android_host_os}-${android_host_arch}"
70 # Location of libgcc. This is only needed for the current GN toolchain, so we
71 # only need to define the current one, rather than one for every platform
72 # like the toolchain roots.
73 if (cpu_arch == "x86") {
75 "$x86_android_toolchain_root/lib/gcc/i686-linux-android/${_android_toolchain_version}/libgcc.a"
76 } else if (cpu_arch == "arm") {
78 "$arm_android_toolchain_root/lib/gcc/arm-linux-androideabi/${_android_toolchain_version}/libgcc.a"
79 } else if (cpu_arch == "mipsel") {
81 "$mips_android_toolchain_root/lib/gcc/mipsel-linux-android/${_android_toolchain_version}/libgcc.a"
83 assert(false, "Need android libgcc support for your target arch.")
86 # stlport stuff --------------------------------------------------------------
88 use_system_stlport = is_android_webview_build
90 if (use_system_stlport) {
91 android_stlport_library = "stlport"
92 } else if (component_mode == "shared_library") {
93 android_stlport_library = "stlport_shared"
95 android_stlport_library = "stlport_static"
98 # ABI ------------------------------------------------------------------------
100 if (cpu_arch == "x86") {
101 android_app_abi = "x86"
102 } else if (cpu_arch == "arm") {
103 import("//build/config/arm.gni")
104 if (arm_version < 7) {
105 android_app_abi = "armeabi"
107 android_app_abi = "armeabi-v7a"
109 } else if (cpu_arch == "mipsel") {
110 android_app_abi = "mips"
112 assert(false, "Unknown Android ABI: " + cpu_arch)
115 if (!defined(is_android_webview_build)) {
116 is_android_webview_build = false
118 use_system_stlport = false