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. | |
326 _copydir = "mkdir -p {{output}} && cd {{source}} && " + | |
Robert Sesek
2016/07/01 15:12:17
I assume this cd is safe because we're running in
sdefresne
2016/07/04 09:12:53
Yes, the "cd" is safe as this is only changing the
| |
327 "pax -rwl . \$OLDPWD/{{output}}" | |
Robert Sesek
2016/07/01 15:12:17
The substitution will handle shell escaping and qu
sdefresne
2016/07/04 09:12:53
Done.
| |
328 _command = "if [[ -d {{source}} ]]; then " + _copydir + "; else " + | |
329 copy_command + "; fi" | |
330 | |
331 _convert_strings = is_ios | |
332 if (_convert_strings) { | |
333 _convert = "plutil -convert binary1 -o {{output}} {{source}}" | |
334 _command = "case {{source}} in " + "*.strings) " + _convert + ";; " + | |
335 "*) " + _command + ";; esac" | |
314 } | 336 } |
315 _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py", | 337 |
316 root_build_dir) | 338 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}}" | 339 description = "COPY_BUNDLE_DATA {{source}} {{output}}" |
319 pool = ":bundle_pool($default_toolchain)" | 340 pool = ":bundle_pool($default_toolchain)" |
320 } | 341 } |
321 tool("compile_xcassets") { | 342 tool("compile_xcassets") { |
322 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py", | 343 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py", |
323 root_build_dir) | 344 root_build_dir) |
324 if (is_ios) { | 345 if (is_ios) { |
325 _sdk_name = ios_sdk_name | 346 _sdk_name = ios_sdk_name |
326 _min_deployment_target = ios_deployment_target | 347 _min_deployment_target = ios_deployment_target |
327 } else { | 348 } else { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
372 | 393 |
373 mac_toolchain("ios_clang_x86") { | 394 mac_toolchain("ios_clang_x86") { |
374 toolchain_cpu = "x86" | 395 toolchain_cpu = "x86" |
375 toolchain_os = "ios" | 396 toolchain_os = "ios" |
376 } | 397 } |
377 | 398 |
378 mac_toolchain("ios_clang_x64") { | 399 mac_toolchain("ios_clang_x64") { |
379 toolchain_cpu = "x64" | 400 toolchain_cpu = "x64" |
380 toolchain_os = "ios" | 401 toolchain_os = "ios" |
381 } | 402 } |
OLD | NEW |