Skip to content

Commit

Permalink
Fix MacOS build & update INSTALL.md
Browse files Browse the repository at this point in the history
Fix build for Apple silicon Mac.
Update INSTALL.md with relevant
instructions.

Signed-off-by: rmultan <[email protected]>
  • Loading branch information
rmultan authored and mikeller committed Jul 29, 2024
1 parent 6d43b8e commit ae73460
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
8 changes: 7 additions & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
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
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

Expand All @@ -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
```

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
subsurface/build directory. You can run Subsurface with the command

Expand Down
8 changes: 8 additions & 0 deletions entitlements-mac-dev.plist
Original file line number Diff line number Diff line change
@@ -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>
10 changes: 7 additions & 3 deletions scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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_OPTS="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk -arch arm64 -arch x86_64"
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
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
# OpenSSL can't deal with multi arch build
MAC_OPTS_OPENSSL="-mmacosx-version-min=${BASESDK} -isysroot${SDKROOT}/MacOSX${BASESDK}.sdk"
Expand Down Expand Up @@ -381,7 +381,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
bash ./buildconf
mkdir -p 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
make -j4
make install
Expand Down Expand Up @@ -648,6 +648,10 @@ for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do
if [ "$PLATFORM" = Darwin ] ; then
rm -rf Subsurface.app
rm -rf Subsurface-mobile.app

if [ "$DEBUGRELEASE" = Debug ] ; then
cp "$SRC"/${SRC_DIR}/entitlements-mac-dev.plist .
fi
fi

if [ ! "$PREP_ONLY" = "1" ] ; then
Expand Down
4 changes: 2 additions & 2 deletions scripts/get-dep-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
# set version of 3rd party libraries
CURRENT_LIBZ="v1.2.11"
CURRENT_LIBZIP="rel-1-5-1"
CURRENT_LIBGIT2="v1.0.1"
CURRENT_LIBCURL="curl-7_54_1"
CURRENT_LIBGIT2="v1.8.1"
CURRENT_LIBCURL="curl-7_88_1"
CURRENT_LIBUSB="v1.0.25"
CURRENT_OPENSSL="OpenSSL_1_1_1m"
CURRENT_LIBSSH2="libssh2-1.8.0"
Expand Down

0 comments on commit ae73460

Please sign in to comment.