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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 # the existing .TOC file, overwrite it, otherwise, don't change it. | 123 # the existing .TOC file, overwrite it, otherwise, don't change it. |
124 # | 124 # |
125 # As a special case, if the library reexports symbols from other dynamic | 125 # As a special case, if the library reexports symbols from other dynamic |
126 # libraries, we always update the .TOC and skip the temporary file and | 126 # libraries, we always update the .TOC and skip the temporary file and |
127 # diffing steps, since that library always needs to be re-linked. | 127 # diffing steps, since that library always needs to be re-linked. |
128 tocname = dylib + ".TOC" | 128 tocname = dylib + ".TOC" |
129 temporary_tocname = dylib + ".tmp" | 129 temporary_tocname = dylib + ".tmp" |
130 | 130 |
131 does_reexport_command = "[ ! -e $dylib -o ! -e $tocname ] || otool -l $dyl
ib | grep -q LC_REEXPORT_DYLIB" | 131 does_reexport_command = "[ ! -e $dylib -o ! -e $tocname ] || otool -l $dyl
ib | grep -q LC_REEXPORT_DYLIB" |
132 | 132 |
133 link_command = "$ld -shared {{ldflags}} -o $dylib -Wl,-filelist,$rspfile" | 133 link_command = |
| 134 "$ld -shared {{ldflags}} -o \"$dylib\" -Wl,-filelist,\"$rspfile\"" |
134 if (is_component_build) { | 135 if (is_component_build) { |
135 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu
t_extension}}" | 136 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu
t_extension}}" |
136 } | 137 } |
137 link_command += " {{solibs}} {{libs}}" | 138 link_command += " {{solibs}} {{libs}}" |
138 | 139 |
139 replace_command = "if ! cmp -s $temporary_tocname $tocname; then mv $tempo
rary_tocname $tocname" | 140 replace_command = "if ! cmp -s $temporary_tocname $tocname; then mv $tempo
rary_tocname $tocname" |
140 extract_toc_command = "{ otool -l $dylib | grep LC_ID_DYLIB -A 5; nm -gP $
dylib | cut -f1-2 -d' ' | grep -v U\$\$; true; }" | 141 extract_toc_command = "{ otool -l $dylib | grep LC_ID_DYLIB -A 5; nm -gP $
dylib | cut -f1-2 -d' ' | grep -v U\$\$; true; }" |
141 | 142 |
142 command = "if $does_reexport_command ; then $link_command && $extract_toc_
command > $tocname; else $link_command && $extract_toc_command > $temporary_tocn
ame && $replace_command ; fi; fi" | 143 command = "if $does_reexport_command ; then $link_command && $extract_toc_
command > $tocname; else $link_command && $extract_toc_command > $temporary_tocn
ame && $replace_command ; fi; fi" |
143 | 144 |
(...skipping 20 matching lines...) Expand all Loading... |
164 tocname, | 165 tocname, |
165 ] | 166 ] |
166 link_output = dylib | 167 link_output = dylib |
167 depend_output = tocname | 168 depend_output = tocname |
168 } | 169 } |
169 | 170 |
170 tool("solink_module") { | 171 tool("solink_module") { |
171 sofile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" #
eg "./libfoo.so" | 172 sofile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" #
eg "./libfoo.so" |
172 rspfile = sofile + ".rsp" | 173 rspfile = sofile + ".rsp" |
173 | 174 |
174 link_command = "$ld -bundle {{ldflags}} -o $sofile -Wl,-filelist,$rspfile" | 175 link_command = |
| 176 "$ld -bundle {{ldflags}} -o \"$sofile\" -Wl,-filelist,\"$rspfile\"" |
175 if (is_component_build) { | 177 if (is_component_build) { |
176 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu
t_extension}}" | 178 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu
t_extension}}" |
177 } | 179 } |
178 link_command += " {{solibs}} {{libs}}" | 180 link_command += " {{solibs}} {{libs}}" |
179 command = link_command | 181 command = link_command |
180 | 182 |
181 rspfile_content = "{{inputs_newline}}" | 183 rspfile_content = "{{inputs_newline}}" |
182 | 184 |
183 description = "SOLINK_MODULE {{output}}" | 185 description = "SOLINK_MODULE {{output}}" |
184 | 186 |
185 # Use this for {{output_extension}} expansions unless a target manually | 187 # Use this for {{output_extension}} expansions unless a target manually |
186 # overrides it (in which case {{output_extension}} will be what the target | 188 # overrides it (in which case {{output_extension}} will be what the target |
187 # specifies). | 189 # specifies). |
188 default_output_extension = ".so" | 190 default_output_extension = ".so" |
189 | 191 |
190 outputs = [ | 192 outputs = [ |
191 sofile, | 193 sofile, |
192 ] | 194 ] |
193 } | 195 } |
194 | 196 |
195 tool("link") { | 197 tool("link") { |
196 outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" | 198 outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" |
197 rspfile = "$outfile.rsp" | 199 rspfile = "$outfile.rsp" |
198 command = "$ld {{ldflags}} -o $outfile -Wl,-filelist,$rspfile {{solibs}} {
{libs}}" | 200 command = "$ld {{ldflags}} -o \"$outfile\" -Wl,-filelist,\"$rspfile\" {{so
libs}} {{libs}}" |
199 description = "LINK $outfile" | 201 description = "LINK $outfile" |
200 rspfile_content = "{{inputs_newline}}" | 202 rspfile_content = "{{inputs_newline}}" |
201 outputs = [ | 203 outputs = [ |
202 outfile, | 204 outfile, |
203 ] | 205 ] |
204 } | 206 } |
205 | 207 |
206 tool("stamp") { | 208 tool("stamp") { |
207 command = "touch {{output}}" | 209 command = "touch {{output}}" |
208 description = "STAMP {{output}}" | 210 description = "STAMP {{output}}" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 } | 277 } |
276 | 278 |
277 mac_toolchain("x64") { | 279 mac_toolchain("x64") { |
278 toolchain_cpu = "x64" | 280 toolchain_cpu = "x64" |
279 toolchain_os = "mac" | 281 toolchain_os = "mac" |
280 cc = "${goma_prefix}/gcc" | 282 cc = "${goma_prefix}/gcc" |
281 cxx = "${goma_prefix}/g++" | 283 cxx = "${goma_prefix}/g++" |
282 ld = cxx | 284 ld = cxx |
283 is_clang = false | 285 is_clang = false |
284 } | 286 } |
OLD | NEW |