xref: /aosp_15_r20/external/cronet/build/toolchain/cros_toolchain.gni (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright 2016 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5# CrOS builds must cross-compile on a Linux host for the actual CrOS
6# device target. There are many different CrOS devices so the build
7# system provides configuration variables that permit a CrOS build to
8# control the cross-compilation tool chain. However, requiring such
9# fine-grain specification is tedious for build-bots and developers.
10# Consequently, the CrOS build system defaults to a convenience
11# compilation mode where the compilation host is also the build target.
12#
13# Chrome can be compiled in this way with the gn variable:
14#
15# target_os = "chromeos"
16#
17# To perform a board-specific build, first obtain the correct system
18# root (http://goo.gl/aFB4XH) for the board. Then configure GN to use it
19# by setting appropriate cross-compilation variables.
20#
21# For example, to compile a Chrome source tree in /g/src for an
22# auron_paine CrOS device with the system root cached in /g/.cros_cache,
23# the following GN arguments must be provided to configure
24# cross-compilation with Goma acceleration. (NB: additional variables
25# will be necessary to successfully compile a working CrOS Chrome. See
26# the definition of GYP_DEFINES inside a sysroot shell.)
27#
28# goma_dir = "/g/.cros_cache/common/goma+2"
29# target_sysroot= /g/.cros_cache/chrome-sdk/tarballs/auron_paine+7644.0.0+sysroot_chromeos-base_chromeos-chrome.tar.xz"
30# cros_target_cc = "x86_64-cros-linux-gnu-gcc -B/g/.cros_cache/chrome-sdk/tarballs/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51-gold"
31# cros_target_cxx = "x86_64-cros-linux-gnu-g++ -B/g/.cros_cache/chrome-sdk/tarballs/auron_paine+7657.0.0+target_toolchain/usr/x86_64-pc-linux-gnu/x86_64-cros-linux-gnu/binutils-bin/2.25.51-gold"
32# cros_target_ar = "x86_64-cros-linux-gnu-gcc-ar"
33# target_cpu = "x64"
34
35import("//build/config/clang/clang.gni")
36import("//build/config/compiler/compiler.gni")
37
38declare_args() {
39  # These must be specified for a board-specific build.
40  cros_target_ar = "ar"
41  cros_target_cc = "gcc"
42  cros_target_cxx = "g++"
43  cros_target_nm = ""
44  cros_target_readelf = ""
45
46  # These can be optionally set. The "_cppflags"  will be applied to *both*
47  # C and C++ files; use "_cxxflags" for C++-only flags.
48  cros_target_extra_cflags = ""
49  cros_target_extra_cppflags = ""
50  cros_target_extra_cxxflags = ""
51  cros_target_extra_ldflags = ""
52
53  cros_host_ar = "${clang_base_path}/bin/llvm-ar"
54  cros_host_cc = "${clang_base_path}/bin/clang"
55  cros_host_cxx = "${clang_base_path}/bin/clang++"
56  cros_host_nm = ""
57  cros_host_readelf = ""
58  cros_host_extra_cflags = ""
59  cros_host_extra_cppflags = ""
60  cros_host_extra_cxxflags = ""
61  cros_host_extra_ldflags = ""
62  cros_host_sysroot = ""
63
64  cros_v8_snapshot_ar = "${clang_base_path}/bin/llvm-ar"
65  cros_v8_snapshot_cc = "${clang_base_path}/bin/clang"
66  cros_v8_snapshot_cxx = "${clang_base_path}/bin/clang++"
67  cros_v8_snapshot_nm = ""
68  cros_v8_snapshot_readelf = ""
69  cros_v8_snapshot_extra_cflags = ""
70  cros_v8_snapshot_extra_cppflags = ""
71  cros_v8_snapshot_extra_cxxflags = ""
72  cros_v8_snapshot_extra_ldflags = ""
73  cros_v8_snapshot_sysroot = ""
74
75  cros_nacl_bootstrap_extra_cflags = ""
76  cros_nacl_bootstrap_extra_cppflags = ""
77  cros_nacl_bootstrap_extra_cxxflags = ""
78  cros_nacl_bootstrap_extra_ldflags = ""
79
80  cros_nacl_helper_arm32_ar = "ar"
81  cros_nacl_helper_arm32_cc = "gcc"
82  cros_nacl_helper_arm32_cxx = "g++"
83  cros_nacl_helper_arm32_readelf = ""
84  cros_nacl_helper_arm32_sysroot = ""
85}
86
87declare_args() {
88  cros_target_ld = cros_target_cxx
89  cros_host_ld = cros_host_cxx
90  cros_v8_snapshot_ld = cros_v8_snapshot_cxx
91  cros_nacl_helper_arm32_ld = cros_nacl_helper_arm32_cxx
92}
93