Skip to content

Commit

Permalink
Added support for the iPhone 5s in the iOS build script.
Browse files Browse the repository at this point in the history
  • Loading branch information
bluechill committed Sep 19, 2013
1 parent d7eaef6 commit ed5d8b6
Showing 1 changed file with 25 additions and 32 deletions.
57 changes: 25 additions & 32 deletions build_ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,56 @@

for var in $@
do
if [ "$var" == "--simulator" ]; then
PLATFORM="Simulator"
ARCH="i386"
elif [ "$var" == "--armv6" ]; then
PLATFORM="OS"
ARCH="armv6"
elif [ "$var" == "--armv7" ]; then
PLATFORM="OS"
ARCH="armv7"
fi
if [ "$var" == "--phone" ]; then
PLATFORM="OS"
elif [ "$var" == "--simulator" ]; then
PLATFORM="Simulator"
fi
done

if [ -z "$PLATFORM" ]; then
PLATFORM="Simulator"
ARCH="i386"
echo "WARNING: Using Simulator for the platform since it was unspecified"
PLATFORM="Simulator"
echo "WARNING: Using Simulator for the platform since it was unspecified"
fi

if [ -z "$DEVELOPER_HOME" ]; then
DEVELOPER_HOME="/Applications/Xcode.app/Contents/Developer"
echo "WARNING: Using Xcode home of /Applications/Xcode.app/Contents/Developer"
DEVELOPER_HOME="/Applications/Xcode.app/Contents/Developer"
echo "WARNING: Using Xcode home of /Applications/Xcode.app/Contents/Developer"
fi

if [ -z "$SDKVER" ]; then
SDKVER="5.1"
echo "WARNING: Using default SDK version 5.1"
SDKVER="7.0"
echo "WARNING: Using default SDK version 7.0"
fi

if [ -z "$SDKMIN" ]; then
SDKMIN="4.2"
echo "WARNING: Using default SDK min version of 4.2"
SDKMIN="7.0"
echo "WARNING: Using default SDK min version of 7.0"
fi

PLATFORMPATH="$DEVELOPER_HOME/Platforms/iPhone$PLATFORM.platform"
SDK="$PLATFORMPATH/Developer/SDKs/iPhone$PLATFORM$SDKVER.sdk"

CPPFLAGS="-arch $ARCH -isysroot $SDK -miphoneos-version-min=$SDKMIN"
LINKFLAGS="$CPPFLAGS"

if [ "$PLATFORM" != "Simulator" ]; then
CPPFLAGS="$CPPFLAGS -DIPHONE_SDK -D__LLP64__"
else
CPPFLAGS="$CPPFLAGS -m32"
if [ "$PLATFORM" == "Simulator" ]; then
CPPFLAGS="-arch i386 -arch x86_64 -isysroot $SDK -miphoneos-version-min=$SDKMIN"
elif [ "$PLATFORM" == "OS" ]; then
CPPFLAGS="-arch arm64 -arch armv7 -arch armv7s -isysroot $SDK -miphoneos-version-min=$SDKMIN -D__LLP64__ -DIPHONE_SDK"
fi

LINKFLAGS="$CPPFLAGS"

command -v ccache >/dev/null

if [ $? -eq 0 ]; then
CC="ccache"
CXX="ccache"
CC="ccache"
CXX="ccache"
fi

CC="$CC clang -Qunused-arguments"
CXX="$CXX clang++ -Qunused-arguments"

if [ "$ARCH" != "i386" ]; then
scons --cc="$CC" --cxx="$CXX" --lnflags="$LINKFLAGS" --cflags="$CPPFLAGS" --out="out-$ARCH" --build="build-$ARCH" --static --opt kernel
else
scons --cc="$CC" --cxx="$CXX" --lnflags="$LINKFLAGS" --cflags="$CPPFLAGS" --out="out-$ARCH" --build="build-$ARCH" --static kernel
if [ "$PLATFORM" == "Simulator" ]; then
scons --cc="$CC" --cxx="$CXX" --lnflags="$LINKFLAGS" --cflags="$CPPFLAGS" --out="out-simulator" --build="build-simulator" --static kernel
elif [ "$PLATFORM" == "OS" ]; then
scons --cc="$CC" --cxx="$CXX" --lnflags="$LINKFLAGS" --cflags="$CPPFLAGS" --out="out-iphone" --build="build-iphone" --static kernel
fi

0 comments on commit ed5d8b6

Please sign in to comment.