summaryrefslogtreecommitdiffstats
path: root/chromium/build/toolchain/android/BUILD.gn
blob: dc3bfeddab776e9bdfe9da5358d7e68599319f4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/sysroot.gni")  # Imports android/config.gni.
import("//build/toolchain/clang.gni")
import("//build/toolchain/goma.gni")
import("//build/toolchain/gcc_toolchain.gni")

# The Android GCC toolchains share most of the same parameters, so we have this
# wrapper around gcc_toolchain to avoid duplication of logic.
#
# Parameters:
#  - android_ndk_sysroot
#      Sysroot for this architecture.
#  - android_ndk_lib_dir
#      Subdirectory inside of android_ndk_sysroot where libs go.
#  - tool_prefix
#      Prefix to be added to the tool names.
#  - toolchain_cpu_arch
#      Same as gcc_toolchain
template("android_gcc_toolchain") {
  gcc_toolchain(target_name) {
    # Make our manually injected libs relative to the build dir.
    android_ndk_lib = rebase_path(
      invoker.android_ndk_sysroot + "/" + invoker.android_ndk_lib_dir,
      root_build_dir)

    libs_section_prefix = "$android_ndk_lib/crtbegin_dynamic.o"
    libs_section_postfix = "$android_ndk_lib/crtend_android.o"

    # The tools should be run relative to the build dir.
    tool_prefix = rebase_path(invoker.tool_prefix, root_build_dir)

    cc = tool_prefix + "gcc"
    cxx = tool_prefix + "g++"
    ar = tool_prefix + "ar"
    ld = cxx

    toolchain_os = "android"
    toolchain_cpu_arch = invoker.toolchain_cpu_arch
  }
}

android_gcc_toolchain("x86") {
  android_ndk_sysroot = "$android_ndk_root/$x86_android_sysroot_subdir"
  android_ndk_lib_dir = "usr/lib"

  tool_prefix = "$x86_android_toolchain_root/bin/i686-linux-android-"
  toolchain_cpu_arch = "x86"
}

android_gcc_toolchain("arm") {
  android_ndk_sysroot = "$android_ndk_root/$arm_android_sysroot_subdir"
  android_ndk_lib_dir = "usr/lib"

  tool_prefix = "$arm_android_toolchain_root/bin/arm-linux-androideabi-"
  toolchain_cpu_arch = "arm"
}

android_gcc_toolchain("mipsel") {
  android_ndk_sysroot = "$android_ndk_root/$mips_android_sysroot_subdir"
  android_ndk_lib_dir = "usr/lib"

  tool_prefix = "$mips_android_toolchain_root/bin/mipsel-linux-android-"
  toolchain_cpu_arch = "mipsel"
}