From ebb7d9747498ebd0c7bc8c73ab5727bd91a54057 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 10 Apr 2022 18:46:53 -1000 Subject: [PATCH] macOS: update package build script The create-dmg script changed repo name - let's support either version. On newer Macs the SDKs are elsewhere - let's look there, too. Let's be far more flexible when finding SDK versions. Let's not assume that we are linking against QtWebKit (we're not with Qt6). Signed-off-by: Dirk Hohndel --- packaging/macosx/make-package.sh | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/packaging/macosx/make-package.sh b/packaging/macosx/make-package.sh index c29aa672e..aec1ad761 100755 --- a/packaging/macosx/make-package.sh +++ b/packaging/macosx/make-package.sh @@ -7,9 +7,17 @@ # find the directory above the sources - typically ~/src DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd ../../.. && pwd ) -# install location of yourway-create-dmg +# install location of create-dmg # by default we assume it's next to subsurface in ~/src/yoursway-create-dmg DMGCREATE=${DIR}/yoursway-create-dmg/create-dmg +if [ ! -x $DMGCREATE ] ; then + # well, this app changed its github name, so it may be in a different directory now + DMGCREATE=${DIR}/create-dmg/create-dmg + if [ ! -x $DMGCREATE ] ; then + echo "Can't find working create-dmg, aborting" + exit 1 + fi +fi # same git version magic as in the Makefile # for the naming of volume and dmg we want the 3 digits of the full version number @@ -18,7 +26,9 @@ 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 -if [ -d /Developer/SDKs ] ; then +if [ -d /Library/Developer/CommandLineTools/SDKs ] ; then + SDKROOT=/Library/Developer/CommandLineTools/SDKs +elif [ -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 @@ -27,9 +37,10 @@ else 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//") +BASESDK=$(ls $SDKROOT | grep "MacOSX1.*\.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 @@ -56,7 +67,8 @@ done # ensure libpng and libjpeg inside the bundle are referenced in QtWebKit libraries QTWEBKIT=Subsurface.app/Contents/Frameworks/QtWebKit.framework/QtWebKit -for i in libjpeg.8.dylib libpng16.16.dylib; do +if [ -f $QTWEBKIT ] ; then + for i in libjpeg.8.dylib libpng16.16.dylib; do OLD=$(otool -L ${QTWEBKIT} | grep $i | cut -d\ -f1 | tr -d "\t") if [[ ! -z ${OLD} ]] ; then # copy the library into the bundle and make sure its id and the reference to it are correct @@ -67,7 +79,8 @@ for i in libjpeg.8.dylib libpng16.16.dylib; do install_name_tool -change ${OLD} @executable_path/../Frameworks/${SONAME} ${QTWEBKIT} install_name_tool -id @executable_path/../Frameworks/${SONAME} Subsurface.app/Contents/Frameworks/${SONAME} fi -done + done +fi # next, copy libssh2.1 # cp ${DIR}/install-root/lib/libssh2.1.dylib Subsurface.app/Contents/Frameworks