1# Copyright 2015 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
5declare_args() {
6  # Native Client supports multiple toolchains:
7  #   - nacl_glibc, based on gcc and glibc.
8  #   - pnacl_newlib, based on llvm 3.7 and newlib (default).
9  #   - saigo_newlib, based on llvm 12+ and newlib.
10
11  # True if nacl_glibc is used.
12  is_nacl_glibc = false
13
14  # True if saigo_newlib is used.
15  is_nacl_saigo = false
16}
17
18is_nacl_irt = false
19is_nacl_nonsfi = false
20
21nacl_toolchain_dir = "//native_client/toolchain/${host_os}_x86"
22
23if (is_nacl_glibc) {
24  if (current_cpu == "x86" || current_cpu == "x64") {
25    nacl_toolchain_package = "nacl_x86_glibc"
26  } else if (current_cpu == "arm") {
27    nacl_toolchain_package = "nacl_arm_glibc"
28  }
29} else {
30  nacl_toolchain_package = "pnacl_newlib"
31}
32
33if (current_cpu == "pnacl") {
34  _nacl_tuple = "pnacl"
35} else if (current_cpu == "x86" || current_cpu == "x64") {
36  _nacl_tuple = "x86_64-nacl"
37} else if (current_cpu == "arm") {
38  _nacl_tuple = "arm-nacl"
39} else if (current_cpu == "mipsel") {
40  _nacl_tuple = "mipsel-nacl"
41} else {
42  # In order to allow this file to be included unconditionally
43  # from build files that can't depend on //components/nacl/features.gni
44  # we provide a dummy value that should be harmless if nacl isn't needed.
45  # If nacl *is* needed this will result in a real error, indicating that
46  # people need to set the toolchain path correctly.
47  _nacl_tuple = "unknown"
48}
49
50nacl_toolchain_bindir = "${nacl_toolchain_dir}/${nacl_toolchain_package}/bin"
51nacl_toolchain_tooldir =
52    "${nacl_toolchain_dir}/${nacl_toolchain_package}/${_nacl_tuple}"
53nacl_toolprefix = "${nacl_toolchain_bindir}/${_nacl_tuple}-"
54
55nacl_irt_toolchain = "//build/toolchain/nacl:irt_" + target_cpu
56is_nacl_irt = current_toolchain == nacl_irt_toolchain
57
58# Non-SFI mode is a lightweight sandbox used by Chrome OS for running ARC
59# applications.
60nacl_nonsfi_toolchain = "//build/toolchain/nacl:newlib_pnacl_nonsfi"
61is_nacl_nonsfi = current_toolchain == nacl_nonsfi_toolchain
62