From e81240129921460b0a85871e30402d80ef589d4b Mon Sep 17 00:00:00 2001 From: Vikas Arora Date: Tue, 26 Nov 2013 15:13:03 -0800 Subject: [PATCH] Updated iosbuild.sh for XCode 5.x Change-Id: I4bf545c4f394c28842cbb85ac70214d2e5477ae0 --- iosbuild.sh | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/iosbuild.sh b/iosbuild.sh index b38be6fc..52cfeb57 100755 --- a/iosbuild.sh +++ b/iosbuild.sh @@ -15,6 +15,9 @@ set -e declare -r SDK=$(xcodebuild -showsdks \ | grep iphoneos | sort | tail -n 1 | awk '{print substr($NF, 9)}' ) +# Extract Xcode version. +declare -r XCODE=$(xcodebuild -version | grep Xcode | cut -d " " -f2) + declare -r OLDPATH=${PATH} # Add iPhoneOS-V6 to the list of platforms below if you need armv6 support. @@ -63,12 +66,24 @@ for PLATFORM in ${PLATFORMS}; do ROOTDIR="${BUILDDIR}/${PLATFORM}-${SDK}-${ARCH}" mkdir -p "${ROOTDIR}" - export DEVROOT="${PLATFORMSROOT}/${PLATFORM}.platform/Developer" - export SDKROOT="${DEVROOT}/SDKs/${PLATFORM}${SDK}.sdk" + SDKROOT="${PLATFORMSROOT}/${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDK}.sdk/" + CFLAGS="-arch ${ARCH} -pipe -isysroot ${SDKROOT}" + LDFLAGS="-arch ${ARCH} -pipe -isysroot ${SDKROOT}" - export CFLAGS="-arch ${ARCH} -pipe -isysroot ${SDKROOT}" + if [[ -z "${XCODE}" ]]; then + echo "XCODE not available" + exit 1 + elif [[ ${SDK} < 5.0.0 ]]; then + DEVROOT="${PLATFORMSROOT}/${PLATFORM}.platform/Developer/" + else + DEVROOT="${DEVELOPER}/Toolchains/XcodeDefault.xctoolchain" + CFLAGS+=" -miphoneos-version-min=5.0" + LDFLAGS+=" -miphoneos-version-min=5.0" + fi + + export CFLAGS + export LDFLAGS export CXXFLAGS=${CFLAGS} - export LDFLAGS="-arch ${ARCH} -pipe -isysroot ${SDKROOT}" export PATH="${DEVROOT}/usr/bin:${OLDPATH}" ${SRCDIR}/configure --host=${ARCH}-apple-darwin --prefix=${ROOTDIR} \