Commit bcdbc4c8 authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

Add explicit path for otool and nm on macOS.

Both binaries show up in the default macOS search path, but as minimal wrappers
around xcrun. By specifying the paths explicitly, we avoid calls to xcrun.

Bug: 971452
Change-Id: Ia852f4b9991fd548f3c83bc04fdda7389e44a72a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1649223Reviewed-by: default avatarNico Weber <thakis@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#667153}
parent 666f4d0c
...@@ -298,7 +298,14 @@ template("mac_toolchain") { ...@@ -298,7 +298,14 @@ template("mac_toolchain") {
tocname = dylib + ".TOC" tocname = dylib + ".TOC"
temporary_tocname = dylib + ".tmp" temporary_tocname = dylib + ".tmp"
does_reexport_command = "[ ! -e \"$dylib\" -o ! -e \"$tocname\" ] || otool -l \"$dylib\" | grep -q LC_REEXPORT_DYLIB" # Use explicit paths to binaries. The binaries present on the default
# search path in /usr/bin are thin wrappers around xcrun, which requires a
# full CommandLineTools or Xcode install, and still may not choose the
# appropriate binary if there are multiple installs.
otool = "$mac_bin_path" + "otool"
nm = "$mac_bin_path" + "nm"
does_reexport_command = "[ ! -e \"$dylib\" -o ! -e \"$tocname\" ] || $otool -l \"$dylib\" | grep -q LC_REEXPORT_DYLIB"
link_command = "$linker_driver $ld -shared " link_command = "$linker_driver $ld -shared "
if (is_component_build) { if (is_component_build) {
...@@ -308,7 +315,7 @@ template("mac_toolchain") { ...@@ -308,7 +315,7 @@ template("mac_toolchain") {
link_command += "{{ldflags}} -o \"$dylib\" -Wl,-filelist,\"$rspfile\" {{libs}} {{solibs}}" link_command += "{{ldflags}} -o \"$dylib\" -Wl,-filelist,\"$rspfile\" {{libs}} {{solibs}}"
replace_command = "if ! cmp -s \"$temporary_tocname\" \"$tocname\"; then mv \"$temporary_tocname\" \"$tocname\"" 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; }" extract_toc_command = "{ $otool -l \"$dylib\" | grep LC_ID_DYLIB -A 5; $nm -gP \"$dylib\" | cut -f1-2 -d' ' | grep -v U\$\$; true; }"
command = "$env_wrapper if $does_reexport_command ; then $link_command && $extract_toc_command > \"$tocname\"; else $link_command && $extract_toc_command > \"$temporary_tocname\" && $replace_command ; fi; fi" command = "$env_wrapper if $does_reexport_command ; then $link_command && $extract_toc_command > \"$tocname\"; else $link_command && $extract_toc_command > \"$temporary_tocname\" && $replace_command ; fi; fi"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment