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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 output_prefix = "lib" | 110 output_prefix = "lib" |
111 } | 111 } |
112 | 112 |
113 tool("solink") { | 113 tool("solink") { |
114 dylib = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e
g "./libfoo.dylib" | 114 dylib = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # e
g "./libfoo.dylib" |
115 rspfile = dylib + ".rsp" | 115 rspfile = dylib + ".rsp" |
116 | 116 |
117 # These variables are not built into GN but are helpers that implement | 117 # These variables are not built into GN but are helpers that implement |
118 # (1) linking to produce a .so, (2) extracting the symbols from that file | 118 # (1) linking to produce a .so, (2) extracting the symbols from that file |
119 # to a temporary file, (3) if the temporary file has differences from the | 119 # to a temporary file, (3) if the temporary file has differences from the |
120 # existing .TOC file, overwrite it, oterwise, don't change it. | 120 # existing .TOC file, overwrite it, otherwise, don't change it. |
121 # | 121 # |
122 # As a special case, if the library reexports symbols from other dynamic | 122 # As a special case, if the library reexports symbols from other dynamic |
123 # libraries, we always update the .TOC and skip the temporary file and | 123 # libraries, we always update the .TOC and skip the temporary file and |
124 # diffing steps, since that library always needs to be re-linked. | 124 # diffing steps, since that library always needs to be re-linked. |
125 tocname = dylib + ".TOC" | 125 tocname = dylib + ".TOC" |
126 temporary_tocname = dylib + ".tmp" | 126 temporary_tocname = dylib + ".tmp" |
127 | 127 |
128 does_reexport_command = "[ ! -e $dylib -o ! -e $tocname ] || otool -l $dyl
ib | grep -q LC_REEXPORT_DYLIB" | 128 does_reexport_command = "[ ! -e $dylib -o ! -e $tocname ] || otool -l $dyl
ib | grep -q LC_REEXPORT_DYLIB" |
129 link_command = "$ld -shared {{ldflags}} -o $dylib -Wl,-filelist,$rspfile {
{solibs}} {{libs}}" | 129 |
| 130 link_command = "$ld -shared {{ldflags}} -o $dylib -Wl,-filelist,$rspfile" |
| 131 if (is_component_build) { |
| 132 link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{outpu
t_extension}}" |
| 133 } |
| 134 link_command += " {{solibs}} {{libs}}" |
| 135 |
130 replace_command = "if ! cmp -s $temporary_tocname $tocname; then mv $tempo
rary_tocname $tocname" | 136 replace_command = "if ! cmp -s $temporary_tocname $tocname; then mv $tempo
rary_tocname $tocname" |
131 extract_toc_command = "{ otool -l $dylib | grep LC_ID_DYLIB -A 5; nm -gP $
dylib | cut -f1-2 -d' ' | grep -v U\$\$; true; }" | 137 extract_toc_command = "{ otool -l $dylib | grep LC_ID_DYLIB -A 5; nm -gP $
dylib | cut -f1-2 -d' ' | grep -v U\$\$; true; }" |
132 | 138 |
133 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" | 139 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" |
134 | 140 |
135 rspfile_content = "{{inputs_newline}}" | 141 rspfile_content = "{{inputs_newline}}" |
136 | 142 |
137 description = "SOLINK {{output}}" | 143 description = "SOLINK {{output}}" |
138 | 144 |
139 # Use this for {{output_extension}} expansions unless a target manually | 145 # Use this for {{output_extension}} expansions unless a target manually |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } | 247 } |
242 | 248 |
243 mac_toolchain("x64") { | 249 mac_toolchain("x64") { |
244 toolchain_cpu = "x64" | 250 toolchain_cpu = "x64" |
245 toolchain_os = "mac" | 251 toolchain_os = "mac" |
246 cc = "${goma_prefix}/gcc" | 252 cc = "${goma_prefix}/gcc" |
247 cxx = "${goma_prefix}/g++" | 253 cxx = "${goma_prefix}/g++" |
248 ld = cxx | 254 ld = cxx |
249 is_clang = false | 255 is_clang = false |
250 } | 256 } |
OLD | NEW |