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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 63 |
64 # Shared toolchain definition. Invocations should set toolchain_os to set the | 64 # Shared toolchain definition. Invocations should set toolchain_os to set the |
65 # build args in this definition. | 65 # build args in this definition. |
66 template("mac_toolchain") { | 66 template("mac_toolchain") { |
67 toolchain(target_name) { | 67 toolchain(target_name) { |
68 assert(defined(invoker.toolchain_cpu), | 68 assert(defined(invoker.toolchain_cpu), |
69 "mac_toolchain() must specify a \"toolchain_cpu\"") | 69 "mac_toolchain() must specify a \"toolchain_cpu\"") |
70 assert(defined(invoker.toolchain_os), | 70 assert(defined(invoker.toolchain_os), |
71 "mac_toolchain() must specify a \"toolchain_os\"") | 71 "mac_toolchain() must specify a \"toolchain_os\"") |
72 | 72 |
73 # concurrent_links is picked up from the declare_arg(). | |
74 | |
75 if (use_goma) { | 73 if (use_goma) { |
76 assert(cc_wrapper == "", "Goma and cc_wrapper can't be used together.") | 74 assert(cc_wrapper == "", "Goma and cc_wrapper can't be used together.") |
77 _compiler_prefix = "$goma_dir/gomacc " | 75 _compiler_prefix = "$goma_dir/gomacc " |
78 } else if (cc_wrapper != "") { | 76 } else if (cc_wrapper != "") { |
79 _compiler_prefix = cc_wrapper + " " | 77 _compiler_prefix = cc_wrapper + " " |
80 } else { | 78 } else { |
81 _compiler_prefix = "" | 79 _compiler_prefix = "" |
82 } | 80 } |
83 | 81 |
84 if (invoker.toolchain_os != "ios" || !use_xcode_clang) { | 82 if (invoker.toolchain_os != "ios" || !use_xcode_clang) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 "{{output_dir}}/{{target_output_name}}{{output_extension}}", | 188 "{{output_dir}}/{{target_output_name}}{{output_extension}}", |
191 ] | 189 ] |
192 default_output_dir = "{{target_out_dir}}" | 190 default_output_dir = "{{target_out_dir}}" |
193 default_output_extension = ".a" | 191 default_output_extension = ".a" |
194 output_prefix = "lib" | 192 output_prefix = "lib" |
195 } | 193 } |
196 | 194 |
197 tool("solink") { | 195 tool("solink") { |
198 dylib = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.dylib" | 196 dylib = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.dylib" |
199 rspfile = dylib + ".rsp" | 197 rspfile = dylib + ".rsp" |
| 198 pool = "//build/toolchain:link_pool($default_toolchain)" |
200 | 199 |
201 # These variables are not built into GN but are helpers that implement | 200 # These variables are not built into GN but are helpers that implement |
202 # (1) linking to produce a .dylib, (2) extracting the symbols from that | 201 # (1) linking to produce a .dylib, (2) extracting the symbols from that |
203 # file to a temporary file, (3) if the temporary file has differences from | 202 # file to a temporary file, (3) if the temporary file has differences from |
204 # the existing .TOC file, overwrite it, otherwise, don't change it. | 203 # the existing .TOC file, overwrite it, otherwise, don't change it. |
205 # | 204 # |
206 # As a special case, if the library reexports symbols from other dynamic | 205 # As a special case, if the library reexports symbols from other dynamic |
207 # libraries, we always update the .TOC and skip the temporary file and | 206 # libraries, we always update the .TOC and skip the temporary file and |
208 # diffing steps, since that library always needs to be re-linked. | 207 # diffing steps, since that library always needs to be re-linked. |
209 tocname = dylib + ".TOC" | 208 tocname = dylib + ".TOC" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 outputs += [ _dsym_output ] | 252 outputs += [ _dsym_output ] |
254 } | 253 } |
255 if (_save_unstripped_output) { | 254 if (_save_unstripped_output) { |
256 outputs += [ _unstripped_output ] | 255 outputs += [ _unstripped_output ] |
257 } | 256 } |
258 } | 257 } |
259 | 258 |
260 tool("solink_module") { | 259 tool("solink_module") { |
261 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.so" | 260 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.so" |
262 rspfile = sofile + ".rsp" | 261 rspfile = sofile + ".rsp" |
| 262 pool = "//build/toolchain:link_pool($default_toolchain)" |
263 | 263 |
264 link_command = "$linker_driver $ld -bundle {{ldflags}} -o \"$sofile\" -Wl,
-filelist,\"$rspfile\"" | 264 link_command = "$linker_driver $ld -bundle {{ldflags}} -o \"$sofile\" -Wl,
-filelist,\"$rspfile\"" |
265 if (is_component_build) { | 265 if (is_component_build) { |
266 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu
t_extension}}" | 266 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu
t_extension}}" |
267 } | 267 } |
268 link_command += dsym_switch | 268 link_command += dsym_switch |
269 link_command += " {{solibs}} {{libs}}" | 269 link_command += " {{solibs}} {{libs}}" |
270 command = link_command | 270 command = link_command |
271 | 271 |
272 rspfile_content = "{{inputs_newline}}" | 272 rspfile_content = "{{inputs_newline}}" |
(...skipping 14 matching lines...) Expand all Loading... |
287 outputs += [ _dsym_output ] | 287 outputs += [ _dsym_output ] |
288 } | 288 } |
289 if (_save_unstripped_output) { | 289 if (_save_unstripped_output) { |
290 outputs += [ _unstripped_output ] | 290 outputs += [ _unstripped_output ] |
291 } | 291 } |
292 } | 292 } |
293 | 293 |
294 tool("link") { | 294 tool("link") { |
295 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" | 295 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
296 rspfile = "$outfile.rsp" | 296 rspfile = "$outfile.rsp" |
| 297 pool = "//build/toolchain:link_pool($default_toolchain)" |
297 | 298 |
298 # Note about --filelist: Apple's linker reads the file list file and | 299 # Note about --filelist: Apple's linker reads the file list file and |
299 # interprets each newline-separated chunk of text as a file name. It | 300 # interprets each newline-separated chunk of text as a file name. It |
300 # doesn't do the things one would expect from the shell like unescaping | 301 # doesn't do the things one would expect from the shell like unescaping |
301 # or handling quotes. In contrast, when Ninja finds a file name with | 302 # or handling quotes. In contrast, when Ninja finds a file name with |
302 # spaces, it single-quotes them in $inputs_newline as it would normally | 303 # spaces, it single-quotes them in $inputs_newline as it would normally |
303 # do for command-line arguments. Thus any source names with spaces, or | 304 # do for command-line arguments. Thus any source names with spaces, or |
304 # label names with spaces (which GN bases the output paths on) will be | 305 # label names with spaces (which GN bases the output paths on) will be |
305 # corrupted by this process. Don't use spaces for source files or labels. | 306 # corrupted by this process. Don't use spaces for source files or labels. |
306 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl
,-filelist,\"$rspfile\" {{solibs}} {{libs}}" | 307 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl
,-filelist,\"$rspfile\" {{solibs}} {{libs}}" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 mac_toolchain("ios_clang_x86") { | 416 mac_toolchain("ios_clang_x86") { |
416 toolchain_cpu = "x86" | 417 toolchain_cpu = "x86" |
417 toolchain_os = "ios" | 418 toolchain_os = "ios" |
418 } | 419 } |
419 | 420 |
420 mac_toolchain("ios_clang_x64") { | 421 mac_toolchain("ios_clang_x64") { |
421 toolchain_cpu = "x64" | 422 toolchain_cpu = "x64" |
422 toolchain_os = "ios" | 423 toolchain_os = "ios" |
423 } | 424 } |
424 } | 425 } |
OLD | NEW |