48 lines
1.4 KiB
Ruby
Executable File
48 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!
|
|
|
|
# Some build tools are stupid and still set DEVELOPER_DIR to old /Developer
|
|
ENV.delete "DEVELOPER_DIR"
|
|
|
|
if ARGV.empty? || ARGV[0][0..0] == "-"
|
|
exec "/usr/bin/xcrun", *ARGV
|
|
end
|
|
|
|
if File.exist?("/usr/bin/#{ARGV.first}")
|
|
sdkroot = ENV['HOMEBREW_SDKROOT']
|
|
exec "/usr/bin/#{ARGV.shift}", *ARGV unless sdkroot and File.directory? sdkroot
|
|
end
|
|
|
|
$:.unshift "/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8"
|
|
require "pathname"
|
|
|
|
def canonical_dirname path
|
|
Pathname.new(path).dirname.realpath.to_s
|
|
end
|
|
|
|
SUPERBIN = canonical_dirname(__FILE__)
|
|
|
|
arg0 = ARGV.shift
|
|
exe = `/usr/bin/xcrun --find #{arg0} 2>/dev/null`.chomp
|
|
if File.executable?(exe) && canonical_dirname(exe) != SUPERBIN
|
|
exec(exe, *ARGV)
|
|
end
|
|
|
|
paths = ENV["PATH"].split(File::PATH_SEPARATOR)
|
|
paths.delete(SUPERBIN)
|
|
paths.each do |path|
|
|
exe = File.join(path, arg0)
|
|
exec(exe, *ARGV) if File.executable?(exe)
|
|
end
|
|
|
|
abort <<-EOS
|
|
Failed to execute: #{arg0} #{ARGV.join(" ")}
|
|
|
|
Xcode and/or the CLT appear to be misconfigured. Try one or both of the following:
|
|
xcodebuild -license
|
|
sudo xcode-select -switch /path/to/Xcode.app
|
|
EOS
|