xref: /aosp_15_r20/external/cronet/build/toolchain/nacl_toolchain.gni (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1# Copyright (c) 2014 The Native Client 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
5import("//build/config/nacl/config.gni")
6import("//build/toolchain/gcc_toolchain.gni")
7
8# This template defines a NaCl toolchain.
9#
10# It requires the following variables specifying the executables to run:
11#  - cc
12#  - cxx
13#  - ar
14#  - ld
15
16template("nacl_toolchain") {
17  assert(defined(invoker.cc), "nacl_toolchain() must specify a \"cc\" value")
18  assert(defined(invoker.cxx), "nacl_toolchain() must specify a \"cxx\" value")
19  assert(defined(invoker.ar), "nacl_toolchain() must specify a \"ar\" value")
20  assert(defined(invoker.ld), "nacl_toolchain() must specify a \"ld\" value")
21  gcc_toolchain(target_name) {
22    if (defined(invoker.executable_extension)) {
23      executable_extension = invoker.executable_extension
24    } else {
25      executable_extension = ".nexe"
26    }
27    rebuild_define = "NACL_TC_REV=" + invoker.toolchain_revision
28
29    forward_variables_from(invoker,
30                           [
31                             "ar",
32                             "cc",
33                             "cxx",
34                             "deps",
35                             "ld",
36                             "link_outputs",
37                             "nm",
38                             "readelf",
39                             "strip",
40                             "extra_cppflags",
41                           ])
42
43    toolchain_args = {
44      # Use all values set on the invoker's toolchain_args.
45      forward_variables_from(invoker.toolchain_args, "*")
46
47      current_os = "nacl"
48
49      # We do not support component builds with the NaCl toolchains.
50      is_component_build = false
51
52      # We do not support clang profiling in the NaCl toolchains.
53      use_clang_profiling = false
54      use_clang_coverage = false
55      coverage_instrumentation_input_file = ""
56
57      if (use_remoteexec) {
58        if (is_win) {
59          rbe_cc_cfg_file = rebase_path(rbe_cfg_dir, root_build_dir) +
60                            "/nacl/rewrapper_windows.cfg"
61        } else if (is_mac) {
62          rbe_cc_cfg_file = rebase_path(rbe_cfg_dir, root_build_dir) +
63                            "/nacl/rewrapper_mac.cfg"
64        } else {
65          # TODO(ukai): non linux?
66          rbe_cc_cfg_file = rebase_path(rbe_cfg_dir, root_build_dir) +
67                            "/nacl/rewrapper_linux.cfg"
68        }
69      }
70
71      if (use_remoteexec_links) {
72        rbe_link_cfg_file = rebase_path(rbe_cfg_dir, root_build_dir) +
73                            "/nacl/rewrapper_linux_link.cfg"
74      }
75
76      # TODO(b/282032209): Re-enable remote nacl links once mismatches due to
77      # linking with absolute paths has been fixed.
78      use_remoteexec_links = false
79    }
80  }
81}
82