| OLD | NEW |
| 1 # Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2013 The Chromium 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 # This value will be inherited in the toolchain below. | 5 # This value will be inherited in the toolchain below. |
| 6 concurrent_links = exec_script("get_concurrent_links.py", [], "value") | 6 concurrent_links = exec_script("get_concurrent_links.py", [], "value") |
| 7 | 7 |
| 8 # This template defines a toolchain for something that works like gcc | 8 # This template defines a toolchain for something that works like gcc |
| 9 # (including clang). | 9 # (including clang). |
| 10 # | 10 # |
| 11 # It requires the following variables specifying the executables to run: | 11 # It requires the following variables specifying the executables to run: |
| 12 # - cc | 12 # - cc |
| 13 # - cxx | 13 # - cxx |
| 14 # - ar | 14 # - ar |
| 15 # - ld | 15 # - ld |
| 16 # and the following which is used in the toolchain_args | 16 # and the following which is used in the toolchain_args |
| 17 # - toolchain_cpu (What "current_cpu" should be set to when invoking a | 17 # - toolchain_cpu_arch (What "cpu_arch" should be set to when invoking a |
| 18 # build using this toolchain.) | 18 # build using this toolchain.) |
| 19 # - toolchain_os (What "current_os" should be set to when invoking a | 19 # - toolchain_os (What "os" should be set to when invoking a build using this |
| 20 # build using this toolchain.) | 20 # toolchain.) |
| 21 # | 21 # |
| 22 # Optional parameters: | 22 # Optional parameters: |
| 23 # - libs_section_prefix | 23 # - libs_section_prefix |
| 24 # - libs_section_postfix | 24 # - libs_section_postfix |
| 25 # The contents of these strings, if specified, will be placed around | 25 # The contents of these strings, if specified, will be placed around |
| 26 # the libs section of the linker line. It allows one to inject libraries | 26 # the libs section of the linker line. It allows one to inject libraries |
| 27 # at the beginning and end for all targets in a toolchain. | 27 # at the beginning and end for all targets in a toolchain. |
| 28 # - solink_libs_section_prefix | 28 # - solink_libs_section_prefix |
| 29 # - solink_libs_section_postfix | 29 # - solink_libs_section_postfix |
| 30 # Same as libs_section_{pre,post}fix except used for solink instead of link
. | 30 # Same as libs_section_{pre,post}fix except used for solink instead of link
. |
| 31 # - post_solink | 31 # - post_solink |
| 32 # The content of this string, if specified, will be appended to the solink | 32 # The content of this string, if specified, will be appended to the solink |
| 33 # command. | 33 # command. |
| 34 # - deps | 34 # - deps |
| 35 # Just forwarded to the toolchain definition. | 35 # Just forwarded to the toolchain definition. |
| 36 # - is_clang | 36 # - is_clang |
| 37 template("gcc_toolchain") { | 37 template("gcc_toolchain") { |
| 38 toolchain(target_name) { | 38 toolchain(target_name) { |
| 39 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") | 39 assert(defined(invoker.cc), "gcc_toolchain() must specify a \"cc\" value") |
| 40 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") | 40 assert(defined(invoker.cxx), "gcc_toolchain() must specify a \"cxx\" value") |
| 41 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") | 41 assert(defined(invoker.ar), "gcc_toolchain() must specify a \"ar\" value") |
| 42 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") | 42 assert(defined(invoker.ld), "gcc_toolchain() must specify a \"ld\" value") |
| 43 assert(defined(invoker.toolchain_cpu), | 43 assert(defined(invoker.toolchain_cpu_arch), |
| 44 "gcc_toolchain() must specify a \"toolchain_cpu\"") | 44 "gcc_toolchain() must specify a \"toolchain_cpu_arch\"") |
| 45 assert(defined(invoker.toolchain_os), | 45 assert(defined(invoker.toolchain_os), |
| 46 "gcc_toolchain() must specify a \"toolchain_os\"") | 46 "gcc_toolchain() must specify a \"toolchain_os\"") |
| 47 | 47 |
| 48 # We can't do string interpolation ($ in strings) on things with dots in | 48 # We can't do string interpolation ($ in strings) on things with dots in |
| 49 # them. To allow us to use $cc below, for example, we create copies of | 49 # them. To allow us to use $cc below, for example, we create copies of |
| 50 # these values in our scope. | 50 # these values in our scope. |
| 51 cc = invoker.cc | 51 cc = invoker.cc |
| 52 cxx = invoker.cxx | 52 cxx = invoker.cxx |
| 53 ar = invoker.ar | 53 ar = invoker.ar |
| 54 ld = invoker.ld | 54 ld = invoker.ld |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 | 198 |
| 199 tool("copy") { | 199 tool("copy") { |
| 200 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &
& cp -af {{source}} {{output}})" | 200 command = "ln -f {{source}} {{output}} 2>/dev/null || (rm -rf {{output}} &
& cp -af {{source}} {{output}})" |
| 201 description = "COPY {{source}} {{output}}" | 201 description = "COPY {{source}} {{output}}" |
| 202 } | 202 } |
| 203 | 203 |
| 204 # When invoking this toolchain not as the default one, these args will be | 204 # When invoking this toolchain not as the default one, these args will be |
| 205 # passed to the build. They are ignored when this is the default toolchain. | 205 # passed to the build. They are ignored when this is the default toolchain. |
| 206 toolchain_args() { | 206 toolchain_args() { |
| 207 current_cpu = invoker.toolchain_cpu | 207 cpu_arch = invoker.toolchain_cpu_arch |
| 208 current_os = invoker.toolchain_os | 208 os = invoker.toolchain_os |
| 209 | |
| 210 # These values need to be passed through unchanged. | |
| 211 target_os = target_os | |
| 212 target_cpu = target_cpu | |
| 213 | |
| 214 # TODO(dpranke): These values are here for backwards compatibility and | |
| 215 # should be deleted when all of the builders and configs have been | |
| 216 # updated. | |
| 217 cpu_arch = current_cpu | |
| 218 os = current_os | |
| 219 | |
| 220 if (defined(invoker.is_clang)) { | 209 if (defined(invoker.is_clang)) { |
| 221 is_clang = invoker.is_clang | 210 is_clang = invoker.is_clang |
| 222 } | 211 } |
| 223 } | 212 } |
| 224 | 213 |
| 225 if (defined(invoker.deps)) { | 214 if (defined(invoker.deps)) { |
| 226 deps = invoker.deps | 215 deps = invoker.deps |
| 227 } | 216 } |
| 228 } | 217 } |
| 229 } | 218 } |
| OLD | NEW |