Index: build/toolchain/mac/BUILD.gn |
diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn |
index 009c701de31e524d3b3c76b420e03572b780ab3d..3f6ffc2400bd0dfb6f8e427a5c8e25aa00d0ecf9 100644 |
--- a/build/toolchain/mac/BUILD.gn |
+++ b/build/toolchain/mac/BUILD.gn |
@@ -118,9 +118,9 @@ template("mac_toolchain") { |
rspfile = dylib + ".rsp" |
# These variables are not built into GN but are helpers that implement |
- # (1) linking to produce a .so, (2) extracting the symbols from that file |
- # to a temporary file, (3) if the temporary file has differences from the |
- # existing .TOC file, overwrite it, otherwise, don't change it. |
+ # (1) linking to produce a .dylib, (2) extracting the symbols from that |
+ # file to a temporary file, (3) if the temporary file has differences from |
+ # the existing .TOC file, overwrite it, otherwise, don't change it. |
# |
# As a special case, if the library reexports symbols from other dynamic |
# libraries, we always update the .TOC and skip the temporary file and |
@@ -167,6 +167,33 @@ template("mac_toolchain") { |
depend_output = tocname |
} |
+ tool("solink_module") { |
+ sofile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" # eg "./libfoo.so" |
+ rspfile = sofile + ".rsp" |
+ |
+ link_command = "$ld -bundle {{ldflags}} -o $sofile -Wl,-filelist,$rspfile" |
+ if (is_component_build) { |
+ link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{output_extension}}" |
+ } |
+ link_command += " {{solibs}} {{libs}}" |
+ command = link_command |
+ |
+ rspfile_content = "{{inputs_newline}}" |
+ |
+ description = "SOLINK_MODULE {{output}}" |
+ |
+ # Use this for {{output_extension}} expansions unless a target manually |
+ # overrides it (in which case {{output_extension}} will be what the target |
+ # specifies). |
+ default_output_extension = ".so" |
+ |
+ output_prefix = "lib" |
+ |
+ outputs = [ |
+ sofile, |
+ ] |
+ } |
+ |
tool("link") { |
outfile = "{{root_out_dir}}/{{target_output_name}}{{output_extension}}" |
rspfile = "$outfile.rsp" |