38 lines
1.2 KiB
Plaintext
Raw Normal View History

#!/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!
2013-11-21 14:50:35 -06:00
dirname = File.dirname(__FILE__)
2014-04-20 16:33:41 -05:00
require File.expand_path("../libsuperenv", dirname)
2013-11-21 14:50:35 -06:00
SUPERBIN = dirname.cleanpath.freeze
# Some build tools are stupid and still set DEVELOPER_DIR to old /Developer
ENV.delete "DEVELOPER_DIR"
exec "/usr/bin/xcrun", *ARGV if ARGV.empty? or ARGV[0][0..0] == '-'
if File.exist?("/usr/bin/#{ARGV.first}")
2013-11-21 14:50:35 -06:00
sdkroot = ENV['HOMEBREW_SDKROOT']
exec "/usr/bin/#{ARGV.shift}", *ARGV unless sdkroot and File.directory? sdkroot
end
def try path
2013-11-21 14:50:35 -06:00
exec path, *ARGV if File.executable?(path) and File.dirname(path.cleanpath) != SUPERBIN
end
arg0 = ARGV.shift
try `/usr/bin/xcrun --find #{arg0} 2>/dev/null`.chomp
# 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