diff options
-rw-r--r-- | build/toolchain/mac/BUILD.gn | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/build/toolchain/mac/BUILD.gn b/build/toolchain/mac/BUILD.gn index 2ef06d5..e8fe804 100644 --- a/build/toolchain/mac/BUILD.gn +++ b/build/toolchain/mac/BUILD.gn @@ -117,7 +117,7 @@ template("mac_toolchain") { # 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, oterwise, don't change it. + # 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 @@ -126,7 +126,13 @@ template("mac_toolchain") { temporary_tocname = dylib + ".tmp" does_reexport_command = "[ ! -e $dylib -o ! -e $tocname ] || otool -l $dylib | grep -q LC_REEXPORT_DYLIB" - link_command = "$ld -shared {{ldflags}} -o $dylib -Wl,-filelist,$rspfile {{solibs}} {{libs}}" + + link_command = "$ld -shared {{ldflags}} -o $dylib -Wl,-filelist,$rspfile" + if (is_component_build) { + link_command += " -Wl,-install_name,@rpath/{{target_output_name}}{{output_extension}}" + } + link_command += " {{solibs}} {{libs}}" + replace_command = "if ! cmp -s $temporary_tocname $tocname; then mv $temporary_tocname $tocname" extract_toc_command = "{ otool -l $dylib | grep LC_ID_DYLIB -A 5; nm -gP $dylib | cut -f1-2 -d' ' | grep -v U\$\$; true; }" |