Chromium Code Reviews| 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 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires | 5 # TODO(brettw) Use "gcc_toolchain.gni" like the Linux toolchains. This requires |
| 6 # some enhancements since the commands on Mac are slightly different than on | 6 # some enhancements since the commands on Mac are slightly different than on |
| 7 # Linux. | 7 # Linux. |
| 8 | 8 |
| 9 import("../goma.gni") | 9 import("../goma.gni") |
| 10 import("//build/config/ios/ios_sdk.gni") | 10 import("//build/config/ios/ios_sdk.gni") |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 | 52 |
| 53 # concurrent_links is picked up from the declare_arg(). | 53 # concurrent_links is picked up from the declare_arg(). |
| 54 | 54 |
| 55 # We can't do string interpolation ($ in strings) on things with dots in | 55 # We can't do string interpolation ($ in strings) on things with dots in |
| 56 # them. To allow us to use $cc below, for example, we create copies of | 56 # them. To allow us to use $cc below, for example, we create copies of |
| 57 # these values in our scope. | 57 # these values in our scope. |
| 58 cc = invoker.cc | 58 cc = invoker.cc |
| 59 cxx = invoker.cxx | 59 cxx = invoker.cxx |
| 60 ld = invoker.ld | 60 ld = invoker.ld |
| 61 | 61 |
| 62 # When implementing tools using Python scripts, a TOOL_VERSION=N env | |
| 63 # variable is placed in front of the command. The N should be incremented | |
| 64 # whenever the script is changed, so that the build system rebuilds all | |
| 65 # edges that utilize the script. Ideally this should be changed to use | |
| 66 # proper input-dirty checking, but that could be expensive. Instead, use a | |
| 67 # script to get the tool scripts' modification time to use as the version. | |
| 68 # This won't cause a re-generation of GN files when the tool script changes | |
| 69 # but it will cause edges to be marked as dirty if the ninja files are | |
| 70 # regenerated. See https://crbug.com/619083 for details. A proper fix | |
| 71 # would be to have inputs to tools (https://crbug.com/621119). | |
| 72 tool_versions = | |
| 73 exec_script("get_tool_mtime.py", | |
|
brettw
2016/06/17 20:43:30
Can you move this up above the template() definiti
Robert Sesek
2016/06/17 20:53:32
Done.
| |
| 74 rebase_path([ | |
| 75 "//build/toolchain/mac/compile_xcassets.py", | |
| 76 "//build/toolchain/mac/copy_bundle_data.py", | |
| 77 "//build/toolchain/mac/filter_libtool.py", | |
| 78 "//build/toolchain/mac/linker_driver.py", | |
| 79 ], | |
| 80 root_build_dir), | |
| 81 "trim scope") | |
| 82 | |
| 62 linker_driver = | 83 linker_driver = |
| 84 "TOOL_VERSION=${tool_versions.linker_driver} " + | |
| 63 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) | 85 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) |
| 64 | 86 |
| 65 # Make these apply to all tools below. | 87 # Make these apply to all tools below. |
| 66 lib_switch = "-l" | 88 lib_switch = "-l" |
| 67 lib_dir_switch = "-L" | 89 lib_dir_switch = "-L" |
| 68 | 90 |
| 69 # Object files go in this directory. Use label_name instead of | 91 # Object files go in this directory. Use label_name instead of |
| 70 # target_output_name since labels will generally have no spaces and will be | 92 # target_output_name since labels will generally have no spaces and will be |
| 71 # unique in the directory. | 93 # unique in the directory. |
| 72 object_subdir = "{{target_out_dir}}/{{label_name}}" | 94 object_subdir = "{{target_out_dir}}/{{label_name}}" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 depsformat = "gcc" | 151 depsformat = "gcc" |
| 130 description = "OBJCXX {{output}}" | 152 description = "OBJCXX {{output}}" |
| 131 outputs = [ | 153 outputs = [ |
| 132 "$object_subdir/{{source_name_part}}.o", | 154 "$object_subdir/{{source_name_part}}.o", |
| 133 ] | 155 ] |
| 134 } | 156 } |
| 135 | 157 |
| 136 tool("alink") { | 158 tool("alink") { |
| 137 script = | 159 script = |
| 138 rebase_path("//build/toolchain/mac/filter_libtool.py", root_build_dir) | 160 rebase_path("//build/toolchain/mac/filter_libtool.py", root_build_dir) |
| 139 command = "rm -f {{output}} && python $script libtool -static {{arflags}} -o {{output}} {{inputs}}" | 161 command = "rm -f {{output}} && TOOL_VERSION=${tool_versions.filter_libtool } python $script libtool -static {{arflags}} -o {{output}} {{inputs}}" |
| 140 description = "LIBTOOL-STATIC {{output}}" | 162 description = "LIBTOOL-STATIC {{output}}" |
| 141 outputs = [ | 163 outputs = [ |
| 142 "{{output_dir}}/{{target_output_name}}{{output_extension}}", | 164 "{{output_dir}}/{{target_output_name}}{{output_extension}}", |
| 143 ] | 165 ] |
| 144 default_output_dir = "{{target_out_dir}}" | 166 default_output_dir = "{{target_out_dir}}" |
| 145 default_output_extension = ".a" | 167 default_output_extension = ".a" |
| 146 output_prefix = "lib" | 168 output_prefix = "lib" |
| 147 } | 169 } |
| 148 | 170 |
| 149 tool("solink") { | 171 tool("solink") { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 276 } | 298 } |
| 277 | 299 |
| 278 tool("copy_bundle_data") { | 300 tool("copy_bundle_data") { |
| 279 if (is_ios) { | 301 if (is_ios) { |
| 280 _extra_args = "--strings-format=binary1" | 302 _extra_args = "--strings-format=binary1" |
| 281 } else { | 303 } else { |
| 282 _extra_args = "" | 304 _extra_args = "" |
| 283 } | 305 } |
| 284 _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py", | 306 _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py", |
| 285 root_build_dir) | 307 root_build_dir) |
| 286 command = "python $_tool ${_extra_args} {{source}} {{output}}" | 308 command = "TOOL_VERSION=${tool_versions.copy_bundle_data} python $_tool ${ _extra_args} {{source}} {{output}}" |
| 287 description = "COPY_BUNDLE_DATA {{source}} {{output}}" | 309 description = "COPY_BUNDLE_DATA {{source}} {{output}}" |
| 288 pool = ":bundle_pool($default_toolchain)" | 310 pool = ":bundle_pool($default_toolchain)" |
| 289 } | 311 } |
| 290 tool("compile_xcassets") { | 312 tool("compile_xcassets") { |
| 291 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py", | 313 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py", |
| 292 root_build_dir) | 314 root_build_dir) |
| 293 if (is_ios) { | 315 if (is_ios) { |
| 294 _sdk_name = ios_sdk_name | 316 _sdk_name = ios_sdk_name |
| 295 _min_deployment_target = ios_deployment_target | 317 _min_deployment_target = ios_deployment_target |
| 296 } else { | 318 } else { |
| 297 _sdk_name = mac_sdk_name | 319 _sdk_name = mac_sdk_name |
| 298 _min_deployment_target = mac_deployment_target | 320 _min_deployment_target = mac_deployment_target |
| 299 } | 321 } |
| 300 command = "rm -f {{output}} && " + | 322 command = "rm -f {{output}} && " + |
| 323 "TOOL_VERSION=${tool_versions.compile_xcassets} " + | |
| 301 "python $_tool -p $_sdk_name -t $_min_deployment_target " + | 324 "python $_tool -p $_sdk_name -t $_min_deployment_target " + |
| 302 "-o {{output}} {{inputs}}" | 325 "-o {{output}} {{inputs}}" |
| 303 | 326 |
| 304 description = "COMPILE_XCASSETS {{output}}" | 327 description = "COMPILE_XCASSETS {{output}}" |
| 305 pool = ":bundle_pool($default_toolchain)" | 328 pool = ":bundle_pool($default_toolchain)" |
| 306 } | 329 } |
| 307 | 330 |
| 308 toolchain_args() { | 331 toolchain_args() { |
| 309 current_cpu = invoker.toolchain_cpu | 332 current_cpu = invoker.toolchain_cpu |
| 310 current_os = invoker.toolchain_os | 333 current_os = invoker.toolchain_os |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 } | 418 } |
| 396 | 419 |
| 397 mac_toolchain("x64") { | 420 mac_toolchain("x64") { |
| 398 toolchain_cpu = "x64" | 421 toolchain_cpu = "x64" |
| 399 toolchain_os = "mac" | 422 toolchain_os = "mac" |
| 400 cc = "${goma_prefix}/gcc" | 423 cc = "${goma_prefix}/gcc" |
| 401 cxx = "${goma_prefix}/g++" | 424 cxx = "${goma_prefix}/g++" |
| 402 ld = cxx | 425 ld = cxx |
| 403 is_clang = false | 426 is_clang = false |
| 404 } | 427 } |
| OLD | NEW |