| 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/clang/clang.gni") | 10 import("//build/config/clang/clang.gni") |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 # proper input-dirty checking, but that could be expensive. Instead, use a | 57 # proper input-dirty checking, but that could be expensive. Instead, use a |
| 58 # script to get the tool scripts' modification time to use as the version. | 58 # script to get the tool scripts' modification time to use as the version. |
| 59 # This won't cause a re-generation of GN files when the tool script changes | 59 # This won't cause a re-generation of GN files when the tool script changes |
| 60 # but it will cause edges to be marked as dirty if the ninja files are | 60 # but it will cause edges to be marked as dirty if the ninja files are |
| 61 # regenerated. See https://crbug.com/619083 for details. A proper fix | 61 # regenerated. See https://crbug.com/619083 for details. A proper fix |
| 62 # would be to have inputs to tools (https://crbug.com/621119). | 62 # would be to have inputs to tools (https://crbug.com/621119). |
| 63 tool_versions = | 63 tool_versions = |
| 64 exec_script("get_tool_mtime.py", | 64 exec_script("get_tool_mtime.py", |
| 65 rebase_path([ | 65 rebase_path([ |
| 66 "//build/toolchain/mac/compile_xcassets.py", | 66 "//build/toolchain/mac/compile_xcassets.py", |
| 67 "//build/toolchain/mac/copy_bundle_data.py", | |
| 68 "//build/toolchain/mac/filter_libtool.py", | 67 "//build/toolchain/mac/filter_libtool.py", |
| 69 "//build/toolchain/mac/linker_driver.py", | 68 "//build/toolchain/mac/linker_driver.py", |
| 70 ], | 69 ], |
| 71 root_build_dir), | 70 root_build_dir), |
| 72 "trim scope") | 71 "trim scope") |
| 73 | 72 |
| 74 # Work around for unused variable warning in template https://crbug.com/395883. | 73 # Work around for unused variable warning in template https://crbug.com/395883. |
| 75 assert(tool_versions != "") | 74 assert(tool_versions != "") |
| 76 | 75 |
| 77 # Shared toolchain definition. Invocations should set toolchain_os to set the | 76 # Shared toolchain definition. Invocations should set toolchain_os to set the |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 tool("stamp") { | 299 tool("stamp") { |
| 301 command = stamp_command | 300 command = stamp_command |
| 302 description = stamp_description | 301 description = stamp_description |
| 303 } | 302 } |
| 304 tool("copy") { | 303 tool("copy") { |
| 305 command = copy_command | 304 command = copy_command |
| 306 description = copy_description | 305 description = copy_description |
| 307 } | 306 } |
| 308 | 307 |
| 309 tool("copy_bundle_data") { | 308 tool("copy_bundle_data") { |
| 310 if (is_ios) { | 309 # copy_command use hardlink if possible but this does not work with |
| 311 _extra_args = "--strings-format=binary1" | 310 # directories. If source is a directory, instead use "pax" to create |
| 312 } else { | 311 # the same tree structure using hardlinks to individual files (this |
| 313 _extra_args = "" | 312 # preserve symbolic links too) as recommended in the replies to the |
| 313 # question at http://serverfault.com/q/209888/43689 ("cp -al" isn't |
| 314 # available on macOS). |
| 315 # |
| 316 # According to the man page for pax, the commands to use to clone |
| 317 # olddir to newdir using pax are the following: |
| 318 # |
| 319 # $ mkdir newdir |
| 320 # $ cd olddir |
| 321 # $ pax -rwl . ../newdir |
| 322 # |
| 323 # The _copydir command does exactly that but use an absolute path |
| 324 # constructed using shell variable $OLDPWD (automatically set when |
| 325 # cd is used) as computing the relative path is a bit complex and |
| 326 # using pwd would requires a sub-shell to be created. |
| 327 _copydir = "mkdir -p {{output}} && cd {{source}} && " + |
| 328 "pax -rwl . \"\$OLDPWD\"/{{output}}" |
| 329 _command = "if [[ -d {{source}} ]]; then " + _copydir + "; else " + |
| 330 copy_command + "; fi" |
| 331 |
| 332 # TODO(crbug.com/625578): Remove this conversion on iOS once all the |
| 333 # bundle_data target have been fixed to reference converted files. |
| 334 _convert_strings = is_ios |
| 335 if (_convert_strings) { |
| 336 _convert = "plutil -convert binary1 -o {{output}} {{source}}" |
| 337 _command = "case {{source}} in " + "*.strings) " + _convert + ";; " + |
| 338 "*) " + _command + ";; esac" |
| 314 } | 339 } |
| 315 _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py", | 340 |
| 316 root_build_dir) | 341 command = "rm -rf {{output}} && " + _command |
| 317 command = "TOOL_VERSION=${tool_versions.copy_bundle_data} python $_tool ${
_extra_args} {{source}} {{output}}" | |
| 318 description = "COPY_BUNDLE_DATA {{source}} {{output}}" | 342 description = "COPY_BUNDLE_DATA {{source}} {{output}}" |
| 319 pool = ":bundle_pool($default_toolchain)" | 343 pool = ":bundle_pool($default_toolchain)" |
| 320 } | 344 } |
| 321 tool("compile_xcassets") { | 345 tool("compile_xcassets") { |
| 322 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py", | 346 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py", |
| 323 root_build_dir) | 347 root_build_dir) |
| 324 if (is_ios) { | 348 if (is_ios) { |
| 325 _sdk_name = ios_sdk_name | 349 _sdk_name = ios_sdk_name |
| 326 _min_deployment_target = ios_deployment_target | 350 _min_deployment_target = ios_deployment_target |
| 327 } else { | 351 } else { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 372 | 396 |
| 373 mac_toolchain("ios_clang_x86") { | 397 mac_toolchain("ios_clang_x86") { |
| 374 toolchain_cpu = "x86" | 398 toolchain_cpu = "x86" |
| 375 toolchain_os = "ios" | 399 toolchain_os = "ios" |
| 376 } | 400 } |
| 377 | 401 |
| 378 mac_toolchain("ios_clang_x64") { | 402 mac_toolchain("ios_clang_x64") { |
| 379 toolchain_cpu = "x64" | 403 toolchain_cpu = "x64" |
| 380 toolchain_os = "ios" | 404 toolchain_os = "ios" |
| 381 } | 405 } |
| OLD | NEW |