Fix MacOS build & update INSTALL.md

Fix build for Apple silicon Mac.
Update INSTALL.md with relevant
instructions.

Signed-off-by: rmultan <multan.rafal.k@gmail.com>
This commit is contained in:
rmultan 2024-07-24 22:10:18 +02:00 committed by Michael Keller
parent 6d43b8e334
commit ae734603b9
4 changed files with 24 additions and 6 deletions

View file

@ -367,7 +367,8 @@ preferred over Qt6.
If you plan to deploy your build to an Apple Silicon Mac, you may have better results with If you plan to deploy your build to an Apple Silicon Mac, you may have better results with
Bluetooth connections if you install Qt5.15.13. If Qt5.15.13 is not available via the Bluetooth connections if you install Qt5.15.13. If Qt5.15.13 is not available via the
installer, you can download from https://download.qt.io/official_releases/qt/5.15/5.15.13 installer, you can download from https://download.qt.io/official_releases/qt/5.15/5.15.13
and build using the usual configure, make, and make install. and build using the usual configure, make, and make install. Qt is also available as Homebrew package
3. now build Subsurface 3. now build Subsurface
@ -381,6 +382,11 @@ if you are building against Qt6 (still experimental) you can create a universal
cd ~/src; bash subsurface/scripts/build.sh -build-with-qt6 -build-deps -fat-build cd ~/src; bash subsurface/scripts/build.sh -build-with-qt6 -build-deps -fat-build
``` ```
4. Sign the package
```
codesign --options runtime --keychain $HOME/Library/Keychains/login.keychain --sign - --deep --force --entitlements subsurface/build/entitlements-mac-dev.plist subsurface/build/Subsurface.app
```
After the above is done, Subsurface.app will be available in the After the above is done, Subsurface.app will be available in the
subsurface/build directory. You can run Subsurface with the command subsurface/build directory. You can run Subsurface with the command

View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.disable-library-validation</key>
<true/>
</dict>
</plist>

View file

@ -197,9 +197,9 @@ if [ "$PLATFORM" = Darwin ] ; then
MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/ -DCMAKE_OSX_ARCHITECTURES='x86_64;arm64'" MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/ -DCMAKE_OSX_ARCHITECTURES='x86_64;arm64'"
MAC_OPTS="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk -arch arm64 -arch x86_64" MAC_OPTS="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk -arch arm64 -arch x86_64"
else else
MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/"
MAC_OPTS="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk"
ARCHS=$(uname -m) # crazy, I know, but $(arch) results in the incorrect 'i386' on an x86_64 Mac ARCHS=$(uname -m) # crazy, I know, but $(arch) results in the incorrect 'i386' on an x86_64 Mac
MAC_CMAKE="-DCMAKE_OSX_DEPLOYMENT_TARGET=${BASESDK} -DCMAKE_OSX_SYSROOT=${SDKROOT}/MacOSX${BASESDK}.sdk/ -DCMAKE_OSX_ARCHITECTURES=$ARCHS"
MAC_OPTS="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk"
fi fi
# OpenSSL can't deal with multi arch build # OpenSSL can't deal with multi arch build
MAC_OPTS_OPENSSL="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk" MAC_OPTS_OPENSSL="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk"
@ -381,7 +381,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
bash ./buildconf bash ./buildconf
mkdir -p build mkdir -p build
cd build cd build
CFLAGS="$MAC_OPTS" ../configure --prefix="$INSTALL_ROOT" --with-darwinssl \ CFLAGS="$MAC_OPTS" ../configure --prefix="$INSTALL_ROOT" --with-openssl \
--disable-tftp --disable-ftp --disable-ldap --disable-ldaps --disable-imap --disable-pop3 --disable-smtp --disable-gopher --disable-smb --disable-rtsp --disable-tftp --disable-ftp --disable-ldap --disable-ldaps --disable-imap --disable-pop3 --disable-smtp --disable-gopher --disable-smb --disable-rtsp
make -j4 make -j4
make install make install
@ -648,6 +648,10 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
if [ "$PLATFORM" = Darwin ] ; then if [ "$PLATFORM" = Darwin ] ; then
rm -rf Subsurface.app rm -rf Subsurface.app
rm -rf Subsurface-mobile.app rm -rf Subsurface-mobile.app
if [ "$DEBUGRELEASE" = Debug ] ; then
cp "$SRC"/${SRC_DIR}/entitlements-mac-dev.plist .
fi
fi fi
if [ ! "$PREP_ONLY" = "1" ] ; then if [ ! "$PREP_ONLY" = "1" ] ; then

View file

@ -4,8 +4,8 @@
# set version of 3rd party libraries # set version of 3rd party libraries
CURRENT_LIBZ="v1.2.11" CURRENT_LIBZ="v1.2.11"
CURRENT_LIBZIP="rel-1-5-1" CURRENT_LIBZIP="rel-1-5-1"
CURRENT_LIBGIT2="v1.0.1" CURRENT_LIBGIT2="v1.8.1"
CURRENT_LIBCURL="curl-7_54_1" CURRENT_LIBCURL="curl-7_88_1"
CURRENT_LIBUSB="v1.0.25" CURRENT_LIBUSB="v1.0.25"
CURRENT_OPENSSL="OpenSSL_1_1_1m" CURRENT_OPENSSL="OpenSSL_1_1_1m"
CURRENT_LIBSSH2="libssh2-1.8.0" CURRENT_LIBSSH2="libssh2-1.8.0"