Ben Murdoch | 097c5b2 | 2016-05-18 11:27:45 +0100 | [diff] [blame] | 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 | |
| 5 | import("//build/config/nacl/config.gni") |
| 6 | import("//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 | # and the following which is used in the toolchain_args |
| 16 | # - toolchain_cpu (What "current_cpu" should be set to when invoking a |
| 17 | # build using this toolchain.) |
| 18 | |
| 19 | template("nacl_toolchain") { |
| 20 | assert(defined(invoker.cc), "nacl_toolchain() must specify a \"cc\" value") |
| 21 | assert(defined(invoker.cxx), "nacl_toolchain() must specify a \"cxx\" value") |
| 22 | assert(defined(invoker.ar), "nacl_toolchain() must specify a \"ar\" value") |
| 23 | assert(defined(invoker.ld), "nacl_toolchain() must specify a \"ld\" value") |
| 24 | assert(defined(invoker.toolchain_cpu), |
| 25 | "nacl_toolchain() must specify a \"toolchain_cpu\"") |
| 26 | gcc_toolchain(target_name) { |
| 27 | toolchain_os = "nacl" |
| 28 | |
| 29 | if (defined(invoker.executable_extension)) { |
| 30 | executable_extension = invoker.executable_extension |
| 31 | } else { |
| 32 | executable_extension = ".nexe" |
| 33 | } |
| 34 | |
| 35 | forward_variables_from(invoker, |
| 36 | [ |
| 37 | "ar", |
| 38 | "cc", |
| 39 | "cxx", |
| 40 | "deps", |
| 41 | "ld", |
| 42 | "link_outputs", |
| 43 | "nm", |
| 44 | "readelf", |
| 45 | "strip", |
| 46 | "toolchain_cpu", |
| 47 | ]) |
| 48 | |
| 49 | if (defined(invoker.is_clang)) { |
| 50 | is_clang = invoker.is_clang |
| 51 | } |
| 52 | if (defined(invoker.is_nacl_glibc)) { |
| 53 | is_nacl_glibc = invoker.is_nacl_glibc |
| 54 | } |
| 55 | if (defined(invoker.symbol_level)) { |
| 56 | symbol_level = invoker.symbol_level |
| 57 | } |
| 58 | |
| 59 | # We do not support component builds or sanitizers with the NaCl toolchains. |
| 60 | is_component_build = false |
| 61 | clear_sanitizers = true |
| 62 | |
| 63 | # We do not support tcmalloc in the NaCl toolchains. |
| 64 | use_allocator = "none" |
| 65 | |
| 66 | rebuild_define = "NACL_TC_REV=" + invoker.toolchain_revision |
| 67 | } |
| 68 | } |