MacOS: update locate_cctool

This becomes MacOS.{install_name_tool,otool}, only do check_xcode if
xcode is installed, otherwise emit a warning
This commit is contained in:
William Woodruff 2015-06-13 20:32:04 -04:00 committed by Misty De Meo
parent 8aad523063
commit 85187bf6d3
4 changed files with 26 additions and 5 deletions

View File

@ -157,7 +157,12 @@ module Homebrew
def perform_preinstall_checks
check_ppc
check_writable_install_location
check_xcode
if MacOS::Xcode.installed?
check_xcode
else
opoo "You have not installed Xcode."
puts "Bottles may install correctly, but builds will fail!"
end
check_cellar
end

View File

@ -98,8 +98,8 @@ class Keg
end
def install_name_tool(*args)
tool = MacOS.locate("install_name_tool")
system(tool, *args) || raise(ErrorDuringExecution.new(tool, args))
tool = MacOS.install_name_tool
system(tool, *args) || raise ErrorDuringExecution.new(tool, args)
end
# If file is a dylib or bundle itself, look for the dylib named by

View File

@ -154,9 +154,9 @@ module MachO
def parse_otool_L_output
ENV["HOMEBREW_MACH_O_FILE"] = path.expand_path.to_s
libs = `#{MacOS.locate("otool")} -L "$HOMEBREW_MACH_O_FILE"`.split("\n")
libs = `#{MacOS.otool} -L "$HOMEBREW_MACH_O_FILE"`.split("\n")
unless $?.success?
raise ErrorDuringExecution.new(MacOS.locate("otool"),
raise ErrorDuringExecution.new(MacOS.otool,
["-L", ENV["HOMEBREW_MACH_O_FILE"]])
end

View File

@ -36,6 +36,22 @@ module OS
end
end
def install_name_tool
if File.executable?(path = "#{HOMEBREW_PREFIX}/opt/cctools/bin/install_name_tool")
Pathname.new(path)
else
locate("install_name_tool")
end
end
def otool
if File.executable?(path = "#{HOMEBREW_PREFIX}/opt/cctools/bin/otool")
Pathname.new(path)
else
locate("otool")
end
end
def active_developer_dir
@active_developer_dir ||= Utils.popen_read("/usr/bin/xcode-select", "-print-path").strip
end