aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-15 10:37:50 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2017-07-15 10:39:44 -0700
commit5656509f6169342b8bab3663a0a5da3a042ee8cb (patch)
tree8e774293b3cbe0f297594483e71a9ab4e81594b5 /scripts
parent7f49ba745c195cc7d60bdd0aa5284d9ef7ba0ead (diff)
downloadsubsurface-5656509f6169342b8bab3663a0a5da3a042ee8cb.tar.gz
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 <dirk@hohndel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build.sh14
1 files changed, 12 insertions, 2 deletions
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 ""