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-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
|
2012-08-31 10:21:06 -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
|
|
|
|
2012-09-24 08:54:06 -04:00
|
|
|
exec "/usr/bin/xcrun", *ARGV if ARGV.empty? or ARGV[0][0..0] == '-'
|
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
|
|
|
|
2012-09-24 08:54:06 -04:00
|
|
|
def try path
|
2013-11-21 14:50:35 -06:00
|
|
|
exec path, *ARGV if File.executable?(path) and File.dirname(path.cleanpath) != 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
|
|
|
|
ENV['PATH'].split(':').each do |p|
|
|
|
|
try "#{p}/#{arg0}"
|
|
|
|
end
|
2012-08-31 10:21:06 -04:00
|
|
|
|
2012-09-24 08:54:06 -04:00
|
|
|
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
|