Upstream version 9.37.195.0
[platform/framework/web/crosswalk.git] / src / build / config / android / config.gni
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.
4
5 # This file contains common system config stuff for the Android build.
6
7 if (is_android) {
8   declare_args() {
9     # Absolute directory containing the Android source code.
10     android_src = ""
11
12     android_sdk_root = "//third_party/android_tools/sdk"
13     android_sdk_version = "20"
14
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
19   }
20
21   if (is_android_webview_build) {
22     assert(android_src != "",
23            "You must specify android_src for an Android WebView build.")
24   }
25
26   # Host stuff -----------------------------------------------------------------
27
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"
34   } else {
35     assert(false, "Need Android toolchain support for your build CPU arch.")
36   }
37
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"
42   } else {
43     assert(false, "Need Android toolchain support for your build OS.")
44   }
45
46   # Directories and files ------------------------------------------------------
47   #
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.
51
52   android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
53
54   # Path to the Android NDK and SDK.
55   android_ndk_root = "//third_party/android_tools/ndk"
56
57   android_sdk = "${android_sdk_root}/platforms/android-${android_sdk_version}"
58
59   android_sdk_tools = "${android_sdk_root}/tools"
60   android_sdk_build_tools = "${android_sdk_root}/build-tools/20.0.0"
61
62   # Path to the SDK's android.jar
63   android_sdk_jar = "$android_sdk/android.jar"
64
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"
71
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}"
78
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") {
83     android_libgcc_file =
84       "$x86_android_toolchain_root/lib/gcc/i686-linux-android/${_android_toolchain_version}/libgcc.a"
85   } else if (cpu_arch == "arm") {
86     android_libgcc_file =
87       "$arm_android_toolchain_root/lib/gcc/arm-linux-androideabi/${_android_toolchain_version}/libgcc.a"
88   } else if (cpu_arch == "mipsel") {
89     android_libgcc_file =
90       "$mips_android_toolchain_root/lib/gcc/mipsel-linux-android/${_android_toolchain_version}/libgcc.a"
91   } else {
92     assert(false, "Need android libgcc support for your target arch.")
93   }
94
95   # stlport stuff --------------------------------------------------------------
96
97   use_system_stlport = is_android_webview_build
98
99   if (use_system_stlport) {
100     android_stlport_library = "stlport"
101   } else if (component_mode == "shared_library") {
102     android_stlport_library = "stlport_shared"
103   } else {
104     android_stlport_library = "stlport_static"
105   }
106
107   # ABI ------------------------------------------------------------------------
108
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"
115     } else {
116       android_app_abi = "armeabi-v7a"
117     }
118   } else if (cpu_arch == "mipsel") {
119     android_app_abi = "mips"
120   } else {
121     assert(false, "Unknown Android ABI: " + cpu_arch)
122   }
123 } else {
124   if (!defined(is_android_webview_build)) {
125     is_android_webview_build = false
126   }
127   use_system_stlport = false
128 }