39 lines
1.1 KiB
Plaintext
Raw Normal View History

#!/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!
[ "$#" -eq 0 ] && exec /usr/bin/xcrun
if [ $HOMEBREW_SDKROOT ]; then
arg0="$1"
shift
case $arg0 in
-*)
exec /usr/bin/xcrun "$arg0" "$@";;
esac
path="$(/usr/bin/xcrun -find $arg0)"
[ -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" "$@"
path="/usr/bin/$arg0"
[ -x "$path" ] && exec "$path" "$@"
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
else
cmd="$1"
shift
exec "/usr/bin/$cmd" "$@"
fi