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/ios/ios_sdk.gni") | 10 import("//build/config/ios/ios_sdk.gni") |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 description = "OBJCXX {{output}}" | 107 description = "OBJCXX {{output}}" |
108 outputs = [ | 108 outputs = [ |
109 "$object_subdir/{{source_name_part}}.o", | 109 "$object_subdir/{{source_name_part}}.o", |
110 ] | 110 ] |
111 } | 111 } |
112 | 112 |
113 tool("alink") { | 113 tool("alink") { |
114 command = "rm -f {{output}} && ./gyp-mac-tool filter-libtool libtool -stat
ic -o {{output}} {{inputs}}" | 114 command = "rm -f {{output}} && ./gyp-mac-tool filter-libtool libtool -stat
ic -o {{output}} {{inputs}}" |
115 description = "LIBTOOL-STATIC {{output}}" | 115 description = "LIBTOOL-STATIC {{output}}" |
116 outputs = [ | 116 outputs = [ |
117 "{{target_out_dir}}/{{target_output_name}}{{output_extension}}", | 117 "{{output_dir}}/{{target_output_name}}{{output_extension}}", |
118 ] | 118 ] |
| 119 default_output_dir = "{{target_out_dir}}" |
119 default_output_extension = ".a" | 120 default_output_extension = ".a" |
120 output_prefix = "lib" | 121 output_prefix = "lib" |
121 } | 122 } |
122 | 123 |
123 tool("solink") { | 124 tool("solink") { |
124 dylib = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e
g "./libfoo.dylib" | 125 dylib = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.dylib" |
125 rspfile = dylib + ".rsp" | 126 rspfile = dylib + ".rsp" |
126 | 127 |
127 # These variables are not built into GN but are helpers that implement | 128 # These variables are not built into GN but are helpers that implement |
128 # (1) linking to produce a .dylib, (2) extracting the symbols from that | 129 # (1) linking to produce a .dylib, (2) extracting the symbols from that |
129 # file to a temporary file, (3) if the temporary file has differences from | 130 # file to a temporary file, (3) if the temporary file has differences from |
130 # the existing .TOC file, overwrite it, otherwise, don't change it. | 131 # the existing .TOC file, overwrite it, otherwise, don't change it. |
131 # | 132 # |
132 # As a special case, if the library reexports symbols from other dynamic | 133 # As a special case, if the library reexports symbols from other dynamic |
133 # libraries, we always update the .TOC and skip the temporary file and | 134 # libraries, we always update the .TOC and skip the temporary file and |
134 # diffing steps, since that library always needs to be re-linked. | 135 # diffing steps, since that library always needs to be re-linked. |
(...skipping 14 matching lines...) Expand all Loading... |
149 | 150 |
150 command = "if $does_reexport_command ; then $link_command && $extract_toc_
command > \"$tocname\"; else $link_command && $extract_toc_command > \"$temporar
y_tocname\" && $replace_command ; fi; fi" | 151 command = "if $does_reexport_command ; then $link_command && $extract_toc_
command > \"$tocname\"; else $link_command && $extract_toc_command > \"$temporar
y_tocname\" && $replace_command ; fi; fi" |
151 | 152 |
152 rspfile_content = "{{inputs_newline}}" | 153 rspfile_content = "{{inputs_newline}}" |
153 | 154 |
154 description = "SOLINK {{output}}" | 155 description = "SOLINK {{output}}" |
155 | 156 |
156 # Use this for {{output_extension}} expansions unless a target manually | 157 # Use this for {{output_extension}} expansions unless a target manually |
157 # overrides it (in which case {{output_extension}} will be what the target | 158 # overrides it (in which case {{output_extension}} will be what the target |
158 # specifies). | 159 # specifies). |
| 160 default_output_dir = "{{root_out_dir}}" |
159 default_output_extension = ".dylib" | 161 default_output_extension = ".dylib" |
160 | 162 |
161 output_prefix = "lib" | 163 output_prefix = "lib" |
162 | 164 |
163 # Since the above commands only updates the .TOC file when it changes, ask | 165 # Since the above commands only updates the .TOC file when it changes, ask |
164 # Ninja to check if the timestamp actually changed to know if downstream | 166 # Ninja to check if the timestamp actually changed to know if downstream |
165 # dependencies should be recompiled. | 167 # dependencies should be recompiled. |
166 restat = true | 168 restat = true |
167 | 169 |
168 # Tell GN about the output files. It will link to the dylib but use the | 170 # Tell GN about the output files. It will link to the dylib but use the |
169 # tocname for dependency management. | 171 # tocname for dependency management. |
170 outputs = [ | 172 outputs = [ |
171 dylib, | 173 dylib, |
172 tocname, | 174 tocname, |
173 ] | 175 ] |
174 link_output = dylib | 176 link_output = dylib |
175 depend_output = tocname | 177 depend_output = tocname |
176 } | 178 } |
177 | 179 |
178 tool("solink_module") { | 180 tool("solink_module") { |
179 sofile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" #
eg "./libfoo.so" | 181 sofile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" # eg
"./libfoo.so" |
180 rspfile = sofile + ".rsp" | 182 rspfile = sofile + ".rsp" |
181 | 183 |
182 link_command = | 184 link_command = |
183 "$ld -bundle {{ldflags}} -o \"$sofile\" -Wl,-filelist,\"$rspfile\"" | 185 "$ld -bundle {{ldflags}} -o \"$sofile\" -Wl,-filelist,\"$rspfile\"" |
184 if (is_component_build) { | 186 if (is_component_build) { |
185 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu
t_extension}}" | 187 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu
t_extension}}" |
186 } | 188 } |
187 link_command += " {{solibs}} {{libs}}" | 189 link_command += " {{solibs}} {{libs}}" |
188 command = link_command | 190 command = link_command |
189 | 191 |
190 rspfile_content = "{{inputs_newline}}" | 192 rspfile_content = "{{inputs_newline}}" |
191 | 193 |
192 description = "SOLINK_MODULE {{output}}" | 194 description = "SOLINK_MODULE {{output}}" |
193 | 195 |
194 # Use this for {{output_extension}} expansions unless a target manually | 196 # Use this for {{output_extension}} expansions unless a target manually |
195 # overrides it (in which case {{output_extension}} will be what the target | 197 # overrides it (in which case {{output_extension}} will be what the target |
196 # specifies). | 198 # specifies). |
| 199 default_output_dir = "{{root_out_dir}}" |
197 default_output_extension = ".so" | 200 default_output_extension = ".so" |
198 | 201 |
199 outputs = [ | 202 outputs = [ |
200 sofile, | 203 sofile, |
201 ] | 204 ] |
202 } | 205 } |
203 | 206 |
204 tool("link") { | 207 tool("link") { |
205 outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" | 208 outfile = "{{output_dir}}/{{target_output_name}}{{output_extension}}" |
206 rspfile = "$outfile.rsp" | 209 rspfile = "$outfile.rsp" |
207 | 210 |
208 # Note about --filelist: Apple's linker reads the file list file and | 211 # Note about --filelist: Apple's linker reads the file list file and |
209 # interprets each newline-separated chunk of text as a file name. It | 212 # interprets each newline-separated chunk of text as a file name. It |
210 # doesn't do the things one would expect from the shell like unescaping | 213 # doesn't do the things one would expect from the shell like unescaping |
211 # or handling quotes. In contrast, when Ninja finds a file name with | 214 # or handling quotes. In contrast, when Ninja finds a file name with |
212 # spaces, it single-quotes them in $inputs_newline as it would normally | 215 # spaces, it single-quotes them in $inputs_newline as it would normally |
213 # do for command-line arguments. Thus any source names with spaces, or | 216 # do for command-line arguments. Thus any source names with spaces, or |
214 # label names with spaces (which GN bases the output paths on) will be | 217 # label names with spaces (which GN bases the output paths on) will be |
215 # corrupted by this process. Don't use spaces for source files or labels. | 218 # corrupted by this process. Don't use spaces for source files or labels. |
216 command = "$ld {{ldflags}} -o \"$outfile\" -Wl,-filelist,\"$rspfile\" {{so
libs}} {{libs}}" | 219 command = "$ld {{ldflags}} -o \"$outfile\" -Wl,-filelist,\"$rspfile\" {{so
libs}} {{libs}}" |
217 description = "LINK $outfile" | 220 description = "LINK $outfile" |
218 rspfile_content = "{{inputs_newline}}" | 221 rspfile_content = "{{inputs_newline}}" |
219 outputs = [ | 222 outputs = [ |
220 outfile, | 223 outfile, |
221 ] | 224 ] |
| 225 |
| 226 default_output_dir = "{{root_out_dir}}" |
222 } | 227 } |
223 | 228 |
224 # These two are really entirely generic, but have to be repeated in | 229 # These two are really entirely generic, but have to be repeated in |
225 # each toolchain because GN doesn't allow a template to be used here. | 230 # each toolchain because GN doesn't allow a template to be used here. |
226 # See //build/toolchain/toolchain.gni for details. | 231 # See //build/toolchain/toolchain.gni for details. |
227 tool("stamp") { | 232 tool("stamp") { |
228 command = stamp_command | 233 command = stamp_command |
229 description = stamp_description | 234 description = stamp_description |
230 } | 235 } |
231 tool("copy") { | 236 tool("copy") { |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 } | 356 } |
352 | 357 |
353 mac_toolchain("x64") { | 358 mac_toolchain("x64") { |
354 toolchain_cpu = "x64" | 359 toolchain_cpu = "x64" |
355 toolchain_os = "mac" | 360 toolchain_os = "mac" |
356 cc = "${goma_prefix}/gcc" | 361 cc = "${goma_prefix}/gcc" |
357 cxx = "${goma_prefix}/g++" | 362 cxx = "${goma_prefix}/g++" |
358 ld = cxx | 363 ld = cxx |
359 is_clang = false | 364 is_clang = false |
360 } | 365 } |
OLD | NEW |