From 5656509f6169342b8bab3663a0a5da3a042ee8cb Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 15 Jul 2017 10:37:50 -0700 Subject: Mac build: deal with SDK location and availability I really want to build against 10.10 so as many people as possible can use the binaries I create, but regular users might not have the older SDKs installed. Signed-off-by: Dirk Hohndel --- scripts/build.sh | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/build.sh b/scripts/build.sh index 1316b4778..c67004bb6 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -40,8 +40,18 @@ CURRENT_LIBGIT2="v0.26.0" # Verify that the Xcode Command Line Tools are installed if [ $PLATFORM = Darwin ] ; then - OLDER_MAC="-mmacosx-version-min=10.10 -isysroot/Developer/SDKs/MacOSX10.10.sdk" - OLDER_MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=10.10 -DCMAKE_OSX_SYSROOT=/Developer/SDKs/MacOSX10.10.sdk/" + if [ -d /Developer/SDKs ] ; then + SDKROOT=/Developer/SDKs + elif [ -d /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs ] ; then + SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs + else + echo "Cannot find SDK sysroot (usually /Developer/SDKs or" + echo "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs)" + exit 1; + fi + BASESDK=$(ls $SDKROOT | grep "MacOSX10\.1.\.sdk" | head -1 | sed -e "s/MacOSX//;s/\.sdk//") + OLDER_MAC="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk" + OLDER_MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/" if [ ! -d /usr/include ] ; then echo "Error: Xcode Command Line Tools are not installed" echo "" -- cgit v1.2.3-70-g09d2