Files
tigerbrew/Library/ENV/4.3/xcrun
T
Misty De Meo 1bd8309ff2 Silence xcrun output in wrapper
Our wrapper always runs the real xcrun at least once, to try to find
the path of the tool being run, but this meant that we were generating
a huge number of error messages on every cc invocaton. Mostly this was
annoying but harmless, but notably it managed to break the compilation
of go.
2013-09-25 09:15:26 -07:00

38 lines
1.4 KiB
Ruby
Executable File

#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0
# This wrapper because 4.3 xcrun doesn't work with CLT-only configurations
# But many build-systems expect it to work. This fixes that.
# NOTE only works if the build-tool calls xcrun without a path prefixed!
require "#{File.dirname __FILE__}/../libsuperenv"
SUPERBIN = __FILE__.dirname.cleanpath.freeze
# Some build tools are stupid and still set DEVELOPER_DIR to old /Developer
ENV['DEVELOPER_DIR'] = ENV['HOMEBREW_DEVELOPER_DIR']
exec "/usr/bin/xcrun", *ARGV if ARGV.empty? or ARGV[0][0..0] == '-'
if File.exist?("/usr/bin/#{ARGV.first}")
exec "/usr/bin/#{ARGV.shift}", *ARGV unless ENV['HOMEBREW_SDKROOT'].directory?
end
def try path
exec path, *ARGV if File.executable?(path) and path.cleanpath.dirname != SUPERBIN
end
arg0 = ARGV.shift
try `/usr/bin/xcrun --find #{arg0} 2>/dev/null`.chomp
# Nuts, Xcode is not setup properly or something. Try to find the tools anyway!
try "#{ENV['HOMEBREW_DEVELOPER_DIR']}/usr/bin/#{arg0}"
try "#{ENV['HOMEBREW_DEVELOPER_DIR']}/Toolchains/XcodeDefault.xctoolchain/usr/bin/#{arg0}"
# xcrun won't always be able to find Homebrew's apple-gcc42,
# even when it's in the PATH
ENV['PATH'].split(':').each do |p|
try "#{p}/#{arg0}"
end
abort <<-EOS
Your Xcode and or CLT are mis-configured. Try some or all of the following:
xcodebuild -license
sudo xcode-select -switch /path/to/Xcode.app
EOS