| 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 # concurrent_links is picked up from the declare_arg(). | 85 # concurrent_links is picked up from the declare_arg(). |
| 86 | 86 |
| 87 cc = "${compiler_prefix}clang" | 87 cc = "${compiler_prefix}clang" |
| 88 cxx = "${compiler_prefix}clang++" | 88 cxx = "${compiler_prefix}clang++" |
| 89 ld = cxx | 89 ld = cxx |
| 90 | 90 |
| 91 linker_driver = | 91 linker_driver = |
| 92 "TOOL_VERSION=${tool_versions.linker_driver} " + | 92 "TOOL_VERSION=${tool_versions.linker_driver} " + |
| 93 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) | 93 rebase_path("//build/toolchain/mac/linker_driver.py", root_build_dir) |
| 94 | 94 |
| 95 if (is_ios && additional_toolchains != []) { |
| 96 # For a fat build, the generation of dSYM needs to be performed after the |
| 97 # generation of the fat binaries using "lipo". So disable the generation |
| 98 # of the dSYM for intermediate architecture specific binaries. |
| 99 _enable_dsyms = false |
| 100 _save_unstripped_output = false |
| 101 } else { |
| 102 _enable_dsyms = enable_dsyms |
| 103 _save_unstripped_output = save_unstripped_output |
| 104 } |
| 105 |
| 95 # Make these apply to all tools below. | 106 # Make these apply to all tools below. |
| 96 lib_switch = "-l" | 107 lib_switch = "-l" |
| 97 lib_dir_switch = "-L" | 108 lib_dir_switch = "-L" |
| 98 | 109 |
| 99 # Object files go in this directory. Use label_name instead of | 110 # Object files go in this directory. Use label_name instead of |
| 100 # target_output_name since labels will generally have no spaces and will be | 111 # target_output_name since labels will generally have no spaces and will be |
| 101 # unique in the directory. | 112 # unique in the directory. |
| 102 object_subdir = "{{target_out_dir}}/{{label_name}}" | 113 object_subdir = "{{target_out_dir}}/{{label_name}}" |
| 103 | 114 |
| 104 # If dSYMs are enabled, this flag will be added to the link tools. | 115 # If dSYMs are enabled, this flag will be added to the link tools. |
| 105 if (enable_dsyms) { | 116 if (_enable_dsyms) { |
| 106 dsym_switch = " -Wcrl,dsym," + rebase_path(root_out_dir) + " " | 117 dsym_switch = " -Wcrl,dsym," + rebase_path(root_out_dir) + " " |
| 107 _dsym_output = | 118 _dsym_output = |
| 108 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.dSYM/" | 119 "{{root_out_dir}}/{{target_output_name}}{{output_extension}}.dSYM/" |
| 109 } else { | 120 } else { |
| 110 dsym_switch = "" | 121 dsym_switch = "" |
| 111 } | 122 } |
| 112 | 123 |
| 113 if (save_unstripped_output) { | 124 if (_save_unstripped_output) { |
| 114 _unstripped_output = "{{root_out_dir}}/{{target_output_name}}{{output_exte
nsion}}.unstripped" | 125 _unstripped_output = "{{root_out_dir}}/{{target_output_name}}{{output_exte
nsion}}.unstripped" |
| 115 } | 126 } |
| 116 | 127 |
| 117 tool("cc") { | 128 tool("cc") { |
| 118 depfile = "{{output}}.d" | 129 depfile = "{{output}}.d" |
| 119 precompiled_header_type = "gcc" | 130 precompiled_header_type = "gcc" |
| 120 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {
{cflags_c}} -c {{source}} -o {{output}}" | 131 command = "$cc -MMD -MF $depfile {{defines}} {{include_dirs}} {{cflags}} {
{cflags_c}} -c {{source}} -o {{output}}" |
| 121 depsformat = "gcc" | 132 depsformat = "gcc" |
| 122 description = "CC {{output}}" | 133 description = "CC {{output}}" |
| 123 outputs = [ | 134 outputs = [ |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 241 |
| 231 # Tell GN about the output files. It will link to the dylib but use the | 242 # Tell GN about the output files. It will link to the dylib but use the |
| 232 # tocname for dependency management. | 243 # tocname for dependency management. |
| 233 outputs = [ | 244 outputs = [ |
| 234 dylib, | 245 dylib, |
| 235 tocname, | 246 tocname, |
| 236 ] | 247 ] |
| 237 link_output = dylib | 248 link_output = dylib |
| 238 depend_output = tocname | 249 depend_output = tocname |
| 239 | 250 |
| 240 if (enable_dsyms) { | 251 if (_enable_dsyms) { |
| 241 outputs += [ _dsym_output ] | 252 outputs += [ _dsym_output ] |
| 242 } | 253 } |
| 243 if (save_unstripped_output) { | 254 if (_save_unstripped_output) { |
| 244 outputs += [ _unstripped_output ] | 255 outputs += [ _unstripped_output ] |
| 245 } | 256 } |
| 246 } | 257 } |
| 247 | 258 |
| 248 tool("solink_module") { | 259 tool("solink_module") { |
| 249 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.so" | 260 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.so" |
| 250 rspfile = sofile + ".rsp" | 261 rspfile = sofile + ".rsp" |
| 251 | 262 |
| 252 link_command = "$linker_driver $ld -bundle {{ldflags}} -o \"$sofile\" -Wl,
-filelist,\"$rspfile\"" | 263 link_command = "$linker_driver $ld -bundle {{ldflags}} -o \"$sofile\" -Wl,
-filelist,\"$rspfile\"" |
| 253 if (is_component_build) { | 264 if (is_component_build) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 264 # Use this for {{output_extension}} expansions unless a target manually | 275 # Use this for {{output_extension}} expansions unless a target manually |
| 265 # overrides it (in which case {{output_extension}} will be what the target | 276 # overrides it (in which case {{output_extension}} will be what the target |
| 266 # specifies). | 277 # specifies). |
| 267 default_output_dir = "{{root_out_dir}}" | 278 default_output_dir = "{{root_out_dir}}" |
| 268 default_output_extension = ".so" | 279 default_output_extension = ".so" |
| 269 | 280 |
| 270 outputs = [ | 281 outputs = [ |
| 271 sofile, | 282 sofile, |
| 272 ] | 283 ] |
| 273 | 284 |
| 274 if (enable_dsyms) { | 285 if (_enable_dsyms) { |
| 275 outputs += [ _dsym_output ] | 286 outputs += [ _dsym_output ] |
| 276 } | 287 } |
| 277 if (save_unstripped_output) { | 288 if (_save_unstripped_output) { |
| 278 outputs += [ _unstripped_output ] | 289 outputs += [ _unstripped_output ] |
| 279 } | 290 } |
| 280 } | 291 } |
| 281 | 292 |
| 282 tool("link") { | 293 tool("link") { |
| 283 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" | 294 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
| 284 rspfile = "$outfile.rsp" | 295 rspfile = "$outfile.rsp" |
| 285 | 296 |
| 286 # Note about --filelist: Apple's linker reads the file list file and | 297 # Note about --filelist: Apple's linker reads the file list file and |
| 287 # interprets each newline-separated chunk of text as a file name. It | 298 # interprets each newline-separated chunk of text as a file name. It |
| 288 # doesn't do the things one would expect from the shell like unescaping | 299 # doesn't do the things one would expect from the shell like unescaping |
| 289 # or handling quotes. In contrast, when Ninja finds a file name with | 300 # or handling quotes. In contrast, when Ninja finds a file name with |
| 290 # spaces, it single-quotes them in $inputs_newline as it would normally | 301 # spaces, it single-quotes them in $inputs_newline as it would normally |
| 291 # do for command-line arguments. Thus any source names with spaces, or | 302 # do for command-line arguments. Thus any source names with spaces, or |
| 292 # label names with spaces (which GN bases the output paths on) will be | 303 # label names with spaces (which GN bases the output paths on) will be |
| 293 # corrupted by this process. Don't use spaces for source files or labels. | 304 # corrupted by this process. Don't use spaces for source files or labels. |
| 294 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl
,-filelist,\"$rspfile\" {{solibs}} {{libs}}" | 305 command = "$linker_driver $ld $dsym_switch {{ldflags}} -o \"$outfile\" -Wl
,-filelist,\"$rspfile\" {{solibs}} {{libs}}" |
| 295 description = "LINK $outfile" | 306 description = "LINK $outfile" |
| 296 rspfile_content = "{{inputs_newline}}" | 307 rspfile_content = "{{inputs_newline}}" |
| 297 outputs = [ | 308 outputs = [ |
| 298 outfile, | 309 outfile, |
| 299 ] | 310 ] |
| 300 | 311 |
| 301 if (enable_dsyms) { | 312 if (_enable_dsyms) { |
| 302 outputs += [ _dsym_output ] | 313 outputs += [ _dsym_output ] |
| 303 } | 314 } |
| 304 if (save_unstripped_output) { | 315 if (_save_unstripped_output) { |
| 305 outputs += [ _unstripped_output ] | 316 outputs += [ _unstripped_output ] |
| 306 } | 317 } |
| 307 | 318 |
| 308 default_output_dir = "{{root_out_dir}}" | 319 default_output_dir = "{{root_out_dir}}" |
| 309 } | 320 } |
| 310 | 321 |
| 311 # These two are really entirely generic, but have to be repeated in | 322 # These two are really entirely generic, but have to be repeated in |
| 312 # each toolchain because GN doesn't allow a template to be used here. | 323 # each toolchain because GN doesn't allow a template to be used here. |
| 313 # See //build/toolchain/toolchain.gni for details. | 324 # See //build/toolchain/toolchain.gni for details. |
| 314 tool("stamp") { | 325 tool("stamp") { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 | 412 |
| 402 mac_toolchain("ios_clang_x86") { | 413 mac_toolchain("ios_clang_x86") { |
| 403 toolchain_cpu = "x86" | 414 toolchain_cpu = "x86" |
| 404 toolchain_os = "ios" | 415 toolchain_os = "ios" |
| 405 } | 416 } |
| 406 | 417 |
| 407 mac_toolchain("ios_clang_x64") { | 418 mac_toolchain("ios_clang_x64") { |
| 408 toolchain_cpu = "x64" | 419 toolchain_cpu = "x64" |
| 409 toolchain_os = "ios" | 420 toolchain_os = "ios" |
| 410 } | 421 } |
| OLD | NEW |