Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(122)

Side by Side Diff: build/toolchain/mac/BUILD.gn

Issue 2075703002: [Mac/iOS/GN] Place a version in the command of toolchain tools implemented using scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move up Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/toolchain/mac/get_tool_mtime.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 20 matching lines...) Expand all
31 depth = concurrent_links 31 depth = concurrent_links
32 } 32 }
33 } 33 }
34 34
35 # This will copy the gyp-mac-tool to the build directory. We pass in the source 35 # This will copy the gyp-mac-tool to the build directory. We pass in the source
36 # file of the mac tool. 36 # file of the mac tool.
37 gyp_mac_tool_source = 37 gyp_mac_tool_source =
38 rebase_path("//tools/gyp/pylib/gyp/mac_tool.py", root_build_dir) 38 rebase_path("//tools/gyp/pylib/gyp/mac_tool.py", root_build_dir)
39 exec_script("setup_toolchain.py", [ gyp_mac_tool_source ]) 39 exec_script("setup_toolchain.py", [ gyp_mac_tool_source ])
40 40
41 # When implementing tools using Python scripts, a TOOL_VERSION=N env
42 # variable is placed in front of the command. The N should be incremented
43 # whenever the script is changed, so that the build system rebuilds all
44 # edges that utilize the script. Ideally this should be changed to use
45 # proper input-dirty checking, but that could be expensive. Instead, use a
46 # script to get the tool scripts' modification time to use as the version.
47 # This won't cause a re-generation of GN files when the tool script changes
48 # but it will cause edges to be marked as dirty if the ninja files are
49 # regenerated. See https://crbug.com/619083 for details. A proper fix
50 # would be to have inputs to tools (https://crbug.com/621119).
51 tool_versions =
52 exec_script("get_tool_mtime.py",
53 rebase_path([
54 "//build/toolchain/mac/compile_xcassets.py",
55 "//build/toolchain/mac/copy_bundle_data.py",
56 "//build/toolchain/mac/filter_libtool.py",
57 "//build/toolchain/mac/linker_driver.py",
58 ],
59 root_build_dir),
60 "trim scope")
61
62 # Work around for unused variable warning in template https://crbug.com/395883.
63 assert(tool_versions != "")
64
41 # Shared toolchain definition. Invocations should set toolchain_os to set the 65 # Shared toolchain definition. Invocations should set toolchain_os to set the
42 # build args in this definition. 66 # build args in this definition.
43 template("mac_toolchain") { 67 template("mac_toolchain") {
44 toolchain(target_name) { 68 toolchain(target_name) {
45 assert(defined(invoker.cc), "mac_toolchain() must specify a \"cc\" value") 69 assert(defined(invoker.cc), "mac_toolchain() must specify a \"cc\" value")
46 assert(defined(invoker.cxx), "mac_toolchain() must specify a \"cxx\" value") 70 assert(defined(invoker.cxx), "mac_toolchain() must specify a \"cxx\" value")
47 assert(defined(invoker.ld), "mac_toolchain() must specify a \"ld\" value") 71 assert(defined(invoker.ld), "mac_toolchain() must specify a \"ld\" value")
48 assert(defined(invoker.toolchain_cpu), 72 assert(defined(invoker.toolchain_cpu),
49 "mac_toolchain() must specify a \"toolchain_cpu\"") 73 "mac_toolchain() must specify a \"toolchain_cpu\"")
50 assert(defined(invoker.toolchain_os), 74 assert(defined(invoker.toolchain_os),
51 "mac_toolchain() must specify a \"toolchain_os\"") 75 "mac_toolchain() must specify a \"toolchain_os\"")
52 76
53 # concurrent_links is picked up from the declare_arg(). 77 # concurrent_links is picked up from the declare_arg().
54 78
55 # We can't do string interpolation ($ in strings) on things with dots in 79 # 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 80 # them. To allow us to use $cc below, for example, we create copies of
57 # these values in our scope. 81 # these values in our scope.
58 cc = invoker.cc 82 cc = invoker.cc
59 cxx = invoker.cxx 83 cxx = invoker.cxx
60 ld = invoker.ld 84 ld = invoker.ld
61 85
62 linker_driver = 86 linker_driver =
87 "TOOL_VERSION=${tool_versions.linker_driver} " +
63 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) 88 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir)
64 89
65 # Make these apply to all tools below. 90 # Make these apply to all tools below.
66 lib_switch = "-l" 91 lib_switch = "-l"
67 lib_dir_switch = "-L" 92 lib_dir_switch = "-L"
68 93
69 # Object files go in this directory. Use label_name instead of 94 # 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 95 # target_output_name since labels will generally have no spaces and will be
71 # unique in the directory. 96 # unique in the directory.
72 object_subdir = "{{target_out_dir}}/{{label_name}}" 97 object_subdir = "{{target_out_dir}}/{{label_name}}"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 depsformat = "gcc" 154 depsformat = "gcc"
130 description = "OBJCXX {{output}}" 155 description = "OBJCXX {{output}}"
131 outputs = [ 156 outputs = [
132 "$object_subdir/{{source_name_part}}.o", 157 "$object_subdir/{{source_name_part}}.o",
133 ] 158 ]
134 } 159 }
135 160
136 tool("alink") { 161 tool("alink") {
137 script = 162 script =
138 rebase_path("//build/toolchain/mac/filter_libtool.py", root_build_dir) 163 rebase_path("//build/toolchain/mac/filter_libtool.py", root_build_dir)
139 command = "rm -f {{output}} && python $script libtool -static {{arflags}} -o {{output}} {{inputs}}" 164 command = "rm -f {{output}} && TOOL_VERSION=${tool_versions.filter_libtool } python $script libtool -static {{arflags}} -o {{output}} {{inputs}}"
140 description = "LIBTOOL-STATIC {{output}}" 165 description = "LIBTOOL-STATIC {{output}}"
141 outputs = [ 166 outputs = [
142 "{{output_dir}}/{{target_output_name}}{{output_extension}}", 167 "{{output_dir}}/{{target_output_name}}{{output_extension}}",
143 ] 168 ]
144 default_output_dir = "{{target_out_dir}}" 169 default_output_dir = "{{target_out_dir}}"
145 default_output_extension = ".a" 170 default_output_extension = ".a"
146 output_prefix = "lib" 171 output_prefix = "lib"
147 } 172 }
148 173
149 tool("solink") { 174 tool("solink") {
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 } 301 }
277 302
278 tool("copy_bundle_data") { 303 tool("copy_bundle_data") {
279 if (is_ios) { 304 if (is_ios) {
280 _extra_args = "--strings-format=binary1" 305 _extra_args = "--strings-format=binary1"
281 } else { 306 } else {
282 _extra_args = "" 307 _extra_args = ""
283 } 308 }
284 _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py", 309 _tool = rebase_path("//build/toolchain/mac/copy_bundle_data.py",
285 root_build_dir) 310 root_build_dir)
286 command = "python $_tool ${_extra_args} {{source}} {{output}}" 311 command = "TOOL_VERSION=${tool_versions.copy_bundle_data} python $_tool ${ _extra_args} {{source}} {{output}}"
287 description = "COPY_BUNDLE_DATA {{source}} {{output}}" 312 description = "COPY_BUNDLE_DATA {{source}} {{output}}"
288 pool = ":bundle_pool($default_toolchain)" 313 pool = ":bundle_pool($default_toolchain)"
289 } 314 }
290 tool("compile_xcassets") { 315 tool("compile_xcassets") {
291 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py", 316 _tool = rebase_path("//build/toolchain/mac/compile_xcassets.py",
292 root_build_dir) 317 root_build_dir)
293 if (is_ios) { 318 if (is_ios) {
294 _sdk_name = ios_sdk_name 319 _sdk_name = ios_sdk_name
295 _min_deployment_target = ios_deployment_target 320 _min_deployment_target = ios_deployment_target
296 } else { 321 } else {
297 _sdk_name = mac_sdk_name 322 _sdk_name = mac_sdk_name
298 _min_deployment_target = mac_deployment_target 323 _min_deployment_target = mac_deployment_target
299 } 324 }
300 command = "rm -f {{output}} && " + 325 command = "rm -f {{output}} && " +
326 "TOOL_VERSION=${tool_versions.compile_xcassets} " +
301 "python $_tool -p $_sdk_name -t $_min_deployment_target " + 327 "python $_tool -p $_sdk_name -t $_min_deployment_target " +
302 "-o {{output}} {{inputs}}" 328 "-o {{output}} {{inputs}}"
303 329
304 description = "COMPILE_XCASSETS {{output}}" 330 description = "COMPILE_XCASSETS {{output}}"
305 pool = ":bundle_pool($default_toolchain)" 331 pool = ":bundle_pool($default_toolchain)"
306 } 332 }
307 333
308 toolchain_args() { 334 toolchain_args() {
309 current_cpu = invoker.toolchain_cpu 335 current_cpu = invoker.toolchain_cpu
310 current_os = invoker.toolchain_os 336 current_os = invoker.toolchain_os
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 421 }
396 422
397 mac_toolchain("x64") { 423 mac_toolchain("x64") {
398 toolchain_cpu = "x64" 424 toolchain_cpu = "x64"
399 toolchain_os = "mac" 425 toolchain_os = "mac"
400 cc = "${goma_prefix}/gcc" 426 cc = "${goma_prefix}/gcc"
401 cxx = "${goma_prefix}/g++" 427 cxx = "${goma_prefix}/g++"
402 ld = cxx 428 ld = cxx
403 is_clang = false 429 is_clang = false
404 } 430 }
OLDNEW
« no previous file with comments | « no previous file | build/toolchain/mac/get_tool_mtime.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698