This commit is contained in:
Thomas Pöchtrager 2015-09-19 23:04:53 +02:00
parent 54e13441a9
commit 4ea0c29d0c

View File

@ -3,30 +3,45 @@
export LC_ALL=C export LC_ALL=C
function set_xcode_dir()
{
local tmp=$(ls $1 2>/dev/null | grep "^Xcode.*.app" | grep -v "beta" | head -n1)
if [ -z "$tmp" ]; then
tmp=$(ls $1 2>/dev/null | grep "^Xcode.*.app" | head -n1)
fi
if [ -n "$tmp" ]; then
XCODEDIR="$1/$tmp"
fi
}
if [ $(uname -s) != "Darwin" ]; then if [ $(uname -s) != "Darwin" ]; then
if [ -z "$XCODEDIR" ]; then if [ -z "$XCODEDIR" ]; then
echo "This script must be run on OS X" echo "This script must be run on OS X" 1>&2
echo "... Or with XCODEDIR=... on Linux" echo "... Or with XCODEDIR=... on Linux" 1>&2
exit 1 exit 1
else else
case $XCODEDIR in case $XCODEDIR in
/*) ;; /*) ;;
*) XCODEDIR="$PWD/$XCODEDIR" ;; *) XCODEDIR="$PWD/$XCODEDIR" ;;
esac esac
XCODEDIR+="/$(ls "$XCODEDIR" | grep "^Xcode.*" | head -n1)" set_xcode_dir $XCODEDIR
fi fi
else else
XCODEDIR=$(ls /Volumes | grep "^Xcode.*" | head -n1) set_xcode_dir $(echo /Volumes/Xcode* | tr ' ' '\n' | grep -v "beta" | head -n1)
if [ -z "$XCODEDIR" ]; then if [ -z "$XCODEDIR" ]; then
if [ -d /Applications/Xcode*.app ]; then set_xcode_dir /Applications
XCODEDIR="/Applications/Xcode*.app"
else if [ -z "$XCODEDIR" ]; then
echo "please mount Xcode.dmg" set_xcode_dir $(echo /Volumes/Xcode* | tr ' ' '\n' | head -n1)
exit 1
if [ -z "$XCODEDIR" ]; then
echo "please mount Xcode.dmg" 1>&2
exit 1
fi
fi fi
else
XCODEDIR="/Volumes/$XCODEDIR/Xcode*.app"
fi fi
fi fi
@ -76,7 +91,7 @@ else
SDKDIR=$(find . -name SDKs -type d | grep MacOSX | head -n1) SDKDIR=$(find . -name SDKs -type d | grep MacOSX | head -n1)
if [ -z "$SDKDIR" ]; then if [ -z "$SDKDIR" ]; then
echo "cannot find SDKs!" echo "cannot find SDKs!" 1>&2
exit 1 exit 1
fi fi