From 53ea3b496473d11f2f41897a23d08cb5d10b24d3 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sat, 12 Sep 2020 17:35:37 -0700 Subject: [PATCH] build-system/macOS: use consistent code to pick SDK Hardcoding versions was kinda silly. This now matches what's in build.sh. Signed-off-by: Dirk Hohndel --- packaging/macosx/make-package.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/packaging/macosx/make-package.sh b/packaging/macosx/make-package.sh index 264f71d8e..c1cafe177 100755 --- a/packaging/macosx/make-package.sh +++ b/packaging/macosx/make-package.sh @@ -18,7 +18,19 @@ VERSION=$(cd ${DIR}/subsurface; ./scripts/get-version linux) # first build and install Subsurface and then clean up the staging area # make sure we didn't lose the minimum OS version rm -rf ./Subsurface.app -cmake -DCMAKE_OSX_DEPLOYMENT_TARGET=10.11 -DCMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.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_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/" +export PKG_CONFIG_PATH=${DIR}/install-root/lib/pkgconfig:$PKG_CONFIG_PATH +cmake $OLDER_MAC_CMAKE . LIBRARY_PATH=${DIR}/install-root/lib make -j8 LIBRARY_PATH=${DIR}/install-root/lib make install