| OLD | NEW |
| 1 # Copyright (c) 2014 The Native Client Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import("//build/config/nacl/config.gni") | 5 import("//build/config/nacl/config.gni") |
| 6 import("//build/toolchain/gcc_toolchain.gni") | 6 import("//build/toolchain/gcc_toolchain.gni") |
| 7 | 7 |
| 8 # This template defines a NaCl toolchain. | 8 # This template defines a NaCl toolchain. |
| 9 # | 9 # |
| 10 # It requires the following variables specifying the executables to run: | 10 # It requires the following variables specifying the executables to run: |
| 11 # - cc | 11 # - cc |
| 12 # - cxx | 12 # - cxx |
| 13 # - ar | 13 # - ar |
| 14 # - ld | 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 | 15 |
| 19 template("nacl_toolchain") { | 16 template("nacl_toolchain") { |
| 20 assert(defined(invoker.cc), "nacl_toolchain() must specify a \"cc\" value") | 17 assert(defined(invoker.cc), "nacl_toolchain() must specify a \"cc\" value") |
| 21 assert(defined(invoker.cxx), "nacl_toolchain() must specify a \"cxx\" value") | 18 assert(defined(invoker.cxx), "nacl_toolchain() must specify a \"cxx\" value") |
| 22 assert(defined(invoker.ar), "nacl_toolchain() must specify a \"ar\" value") | 19 assert(defined(invoker.ar), "nacl_toolchain() must specify a \"ar\" value") |
| 23 assert(defined(invoker.ld), "nacl_toolchain() must specify a \"ld\" value") | 20 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) { | 21 gcc_toolchain(target_name) { |
| 27 toolchain_os = "nacl" | |
| 28 | |
| 29 if (defined(invoker.executable_extension)) { | 22 if (defined(invoker.executable_extension)) { |
| 30 executable_extension = invoker.executable_extension | 23 executable_extension = invoker.executable_extension |
| 31 } else { | 24 } else { |
| 32 executable_extension = ".nexe" | 25 executable_extension = ".nexe" |
| 33 } | 26 } |
| 27 rebuild_define = "NACL_TC_REV=" + invoker.toolchain_revision |
| 34 | 28 |
| 35 forward_variables_from(invoker, | 29 forward_variables_from(invoker, |
| 36 [ | 30 [ |
| 37 "ar", | 31 "ar", |
| 38 "cc", | 32 "cc", |
| 39 "cxx", | 33 "cxx", |
| 40 "deps", | 34 "deps", |
| 41 "ld", | 35 "ld", |
| 42 "link_outputs", | 36 "link_outputs", |
| 43 "nm", | 37 "nm", |
| 44 "readelf", | 38 "readelf", |
| 45 "strip", | 39 "strip", |
| 46 "toolchain_cpu", | |
| 47 ]) | 40 ]) |
| 48 | 41 |
| 49 if (defined(invoker.is_clang)) { | 42 toolchain_args = { |
| 50 is_clang = invoker.is_clang | 43 # Use all values set on the invoker's toolchain_args. |
| 44 forward_variables_from(invoker.toolchain_args, "*") |
| 45 |
| 46 current_os = "nacl" |
| 47 |
| 48 # We do not support component builds with the NaCl toolchains. |
| 49 is_component_build = false |
| 50 |
| 51 # We do not support tcmalloc in the NaCl toolchains. |
| 52 use_allocator = "none" |
| 51 } | 53 } |
| 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 with the NaCl toolchains. | |
| 60 is_component_build = false | |
| 61 | |
| 62 # We do not support tcmalloc in the NaCl toolchains. | |
| 63 use_allocator = "none" | |
| 64 | |
| 65 rebuild_define = "NACL_TC_REV=" + invoker.toolchain_revision | |
| 66 } | 54 } |
| 67 } | 55 } |
| OLD | NEW |