2012-09-24 08:54:06 -04:00
|
|
|
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0
|
|
|
|
|
superenv: build-environments that just work
1. A minimal build environment, we don't set CFLAGS, CPPFLAGS, LDFLAGS, etc. the rationale being, the less that is set, the less variables we are introducing that can break builds.
2. A set of scripts that replace cc, ld, etc. and inject the -I, -L, etc. flags we need into the args passed to the build-tools.
Because we now have complete control over compiler instantiations we do a variety of clean-up tasks, like removing bad flags, enforcing universal builds and ensuring makefiles don't try to change the order of library and include paths from ones that work to ones that don't.
The previous ENV-system is still available when --env=std is specified.
superenv applies to Xcode >= 4.3 only currently.
2012-08-11 12:30:51 -04:00
|
|
|
# This wrapper because 4.3 xcrun doesn't work with CLT-only configurations
|
|
|
|
# But many build-systems expect it to work. This fixes that.
|
2012-09-24 08:54:06 -04:00
|
|
|
# NOTE only works if the build-tool calls xcrun without a path prefixed!
|
superenv: build-environments that just work
1. A minimal build environment, we don't set CFLAGS, CPPFLAGS, LDFLAGS, etc. the rationale being, the less that is set, the less variables we are introducing that can break builds.
2. A set of scripts that replace cc, ld, etc. and inject the -I, -L, etc. flags we need into the args passed to the build-tools.
Because we now have complete control over compiler instantiations we do a variety of clean-up tasks, like removing bad flags, enforcing universal builds and ensuring makefiles don't try to change the order of library and include paths from ones that work to ones that don't.
The previous ENV-system is still available when --env=std is specified.
superenv applies to Xcode >= 4.3 only currently.
2012-08-11 12:30:51 -04:00
|
|
|
|
2013-05-31 12:30:25 +02:00
|
|
|
# Some build tools are stupid and still set DEVELOPER_DIR to old /Developer
|
2014-04-20 16:33:41 -05:00
|
|
|
ENV.delete "DEVELOPER_DIR"
|
2013-05-31 12:30:25 +02:00
|
|
|
|
2014-04-20 16:51:45 -05:00
|
|
|
if ARGV.empty? || ARGV[0][0..0] == "-"
|
|
|
|
exec "/usr/bin/xcrun", *ARGV
|
|
|
|
end
|
|
|
|
|
2013-01-21 23:14:33 -06:00
|
|
|
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
|
2013-01-21 23:14:33 -06:00
|
|
|
end
|
2012-09-01 21:43:46 -04:00
|
|
|
|
2014-04-20 17:00:44 -05:00
|
|
|
$:.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__)
|
|
|
|
|
2012-09-24 08:54:06 -04:00
|
|
|
def try path
|
2014-04-20 16:48:55 -05:00
|
|
|
exec path, *ARGV if File.executable?(path) && canonical_dirname(path) != SUPERBIN
|
2012-09-24 08:54:06 -04:00
|
|
|
end
|
2012-08-31 10:21:06 -04:00
|
|
|
|
2012-09-24 08:54:06 -04:00
|
|
|
arg0 = ARGV.shift
|
2013-09-25 08:35:06 -07:00
|
|
|
try `/usr/bin/xcrun --find #{arg0} 2>/dev/null`.chomp
|
2014-04-20 16:33:41 -05:00
|
|
|
|
2013-05-27 15:17:49 -05:00
|
|
|
# xcrun won't always be able to find Homebrew's apple-gcc42,
|
|
|
|
# even when it's in the PATH
|
2014-04-21 11:03:42 -05:00
|
|
|
ENV["PATH"].split(File::PATH_SEPARATOR).each { |p| try File.join(p, arg0) }
|
2012-08-31 10:21:06 -04:00
|
|
|
|
2012-09-24 08:54:06 -04:00
|
|
|
abort <<-EOS
|
2014-04-21 11:03:42 -05:00
|
|
|
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
|
2012-09-24 08:54:06 -04:00
|
|
|
EOS
|