| 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/toolchain/gcc_toolchain.gni") | 5 import("//build/toolchain/gcc_toolchain.gni") |
| 6 | 6 |
| 7 # This template defines a NaCl toolchain. | 7 # This template defines a NaCl toolchain. |
| 8 # | 8 # |
| 9 # It requires the following variables specifying the executables to run: | 9 # It requires the following variables specifying the executables to run: |
| 10 # - cc | 10 # - cc |
| 11 # - cxx | 11 # - cxx |
| 12 # - ar | 12 # - ar |
| 13 # - ld | 13 # - ld |
| 14 # and the following which is used in the toolchain_args | 14 # and the following which is used in the toolchain_args |
| 15 # - toolchain_cpu (What "current_cpu" should be set to when invoking a | 15 # - toolchain_cpu (What "current_cpu" should be set to when invoking a |
| 16 # build using this toolchain.) | 16 # build using this toolchain.) |
| 17 | 17 |
| 18 template("nacl_toolchain") { | 18 template("nacl_toolchain") { |
| 19 assert(defined(invoker.cc), "nacl_toolchain() must specify a \"cc\" value") | 19 assert(defined(invoker.cc), "nacl_toolchain() must specify a \"cc\" value") |
| 20 assert(defined(invoker.cxx), "nacl_toolchain() must specify a \"cxx\" value") | 20 assert(defined(invoker.cxx), "nacl_toolchain() must specify a \"cxx\" value") |
| 21 assert(defined(invoker.ar), "nacl_toolchain() must specify a \"ar\" value") | 21 assert(defined(invoker.ar), "nacl_toolchain() must specify a \"ar\" value") |
| 22 assert(defined(invoker.ld), "nacl_toolchain() must specify a \"ld\" value") | 22 assert(defined(invoker.ld), "nacl_toolchain() must specify a \"ld\" value") |
| 23 assert(defined(invoker.toolchain_cpu), | 23 assert(defined(invoker.toolchain_cpu), |
| 24 "nacl_toolchain() must specify a \"toolchain_cpu\"") | 24 "nacl_toolchain() must specify a \"toolchain_cpu\"") |
| 25 gcc_toolchain(target_name) { |
| 26 toolchain_os = "nacl" |
| 25 | 27 |
| 26 toolchain_os = "nacl" | 28 if (defined(invoker.executable_extension)) { |
| 27 if (defined(invoker.is_clang)) { | 29 executable_extension = invoker.executable_extension |
| 28 is_clang = invoker.is_clang | 30 } else { |
| 29 } | 31 executable_extension = ".nexe" |
| 30 if (defined(invoker.executable_extension)) { | 32 } |
| 31 executable_extension = invoker.executable_extension | |
| 32 } else { | |
| 33 executable_extension = ".nexe" | |
| 34 } | |
| 35 toolchain_cpu = invoker.toolchain_cpu | |
| 36 | 33 |
| 37 cc = invoker.cc | 34 forward_variables_from(invoker, |
| 38 cxx = invoker.cxx | 35 [ |
| 39 ar = invoker.ar | 36 "ar", |
| 40 ld = invoker.ld | 37 "cc", |
| 41 if (defined(invoker.postlink)) { | 38 "cxx", |
| 42 postlink = invoker.postlink | 39 "deps", |
| 43 } | 40 "is_clang", |
| 44 if (defined(invoker.link_outputs)) { | 41 "ld", |
| 45 link_outputs = invoker.link_outputs | 42 "link_outputs", |
| 46 } | 43 "postlink", |
| 44 "toolchain_cpu", |
| 45 ]) |
| 47 | 46 |
| 48 # We do not wish to suport shared builds with the NaCl toolchains. | 47 # We do not suport component builds or sanitizers with the NaCl toolchains. |
| 49 is_component_build = false | 48 is_component_build = false |
| 49 clear_sanitizers = true |
| 50 | 50 |
| 51 gcc_toolchain(target_name) { | |
| 52 rebuild_define = "NACL_TC_REV=" + invoker.toolchain_revision | 51 rebuild_define = "NACL_TC_REV=" + invoker.toolchain_revision |
| 53 if (defined(invoker.deps)) { | |
| 54 deps = invoker.deps | |
| 55 } | |
| 56 } | 52 } |
| 57 } | 53 } |
| OLD | NEW |