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
|
|
|
#!/bin/bash
|
|
|
|
|
# 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 they call xcrun without a full-path. Cross your fingers!
|
|
|
|
|
|
2012-09-01 21:43:46 -04:00
|
|
|
[ "$#" -eq 0 ] && exec /usr/bin/xcrun
|
|
|
|
|
|
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
|
|
|
if [ $HOMEBREW_SDKROOT ]; then
|
2012-08-31 10:21:06 -04:00
|
|
|
arg0="$1"
|
|
|
|
|
shift
|
|
|
|
|
|
2012-09-01 21:43:46 -04:00
|
|
|
case $arg0 in
|
|
|
|
|
-*)
|
|
|
|
|
exec /usr/bin/xcrun "$arg0" "$@";;
|
|
|
|
|
esac
|
|
|
|
|
|
2012-09-13 16:59:16 -04:00
|
|
|
path="$(/usr/bin/xcrun -find $arg0)"
|
2012-08-31 10:21:06 -04:00
|
|
|
[ -x "$path" ] && exec "$path" "$@"
|
|
|
|
|
|
|
|
|
|
# Nuts, Xcode is not setup properly or something.
|
|
|
|
|
# Try to find the tools anyway!
|
|
|
|
|
path="/Applications/Xcode.app/Contents/Developer/usr/bin/$arg0"
|
|
|
|
|
[ -x "$path" ] && exec "$path" "$@"
|
|
|
|
|
path="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/$arg0"
|
|
|
|
|
[ -x "$path" ] && exec "$path" "$@"
|
2012-09-13 16:59:16 -04:00
|
|
|
path="/usr/bin/$arg0"
|
|
|
|
|
[ -x "$path" ] && exec "$path" "$@"
|
2012-08-31 10:21:06 -04:00
|
|
|
|
|
|
|
|
echo "Your Xcode setup is not ready. You need to either:"
|
|
|
|
|
echo " sudo xcode-select -switch /path/to/Xcode.app"
|
|
|
|
|
echo "or:"
|
|
|
|
|
echo " xcodebuild -license"
|
|
|
|
|
exit 1
|
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
|
|
|
else
|
|
|
|
|
cmd="$1"
|
|
|
|
|
shift
|
|
|
|
|
exec "/usr/bin/$cmd" "$@"
|
|
|
|
|
fi
|