mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2024-11-22 13:55:38 +00:00
CI: Build universal binaries for MacOS
This commit is contained in:
parent
20e2c39c0d
commit
40a485326a
8
.github/workflows/rolling-release.yml
vendored
8
.github/workflows/rolling-release.yml
vendored
|
@ -339,18 +339,14 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
export MACOSX_DEPLOYMENT_TARGET=10.14
|
../scripts/make-universal-macos-binary.sh ..
|
||||||
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DCMAKE_PREFIX_PATH=$HOME/deps -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja ..
|
|
||||||
cmake --build . --parallel
|
|
||||||
cd bin
|
|
||||||
codesign -s - --deep -f -v DuckStation.app
|
|
||||||
zip -r duckstation-mac-release.zip DuckStation.app/
|
zip -r duckstation-mac-release.zip DuckStation.app/
|
||||||
|
|
||||||
- name: Upload macOS .app
|
- name: Upload macOS .app
|
||||||
uses: actions/upload-artifact@v1
|
uses: actions/upload-artifact@v1
|
||||||
with:
|
with:
|
||||||
name: "macos"
|
name: "macos"
|
||||||
path: "build/bin/duckstation-mac-release.zip"
|
path: "build/duckstation-mac-release.zip"
|
||||||
|
|
||||||
|
|
||||||
create-release:
|
create-release:
|
||||||
|
|
|
@ -42,7 +42,51 @@ shasum -a 256 --check SHASUMS
|
||||||
echo "Installing SDL..."
|
echo "Installing SDL..."
|
||||||
tar xf "$SDL.tar.gz"
|
tar xf "$SDL.tar.gz"
|
||||||
cd "$SDL"
|
cd "$SDL"
|
||||||
./configure --prefix "$INSTALLDIR" --without-x
|
|
||||||
|
# Patch clang wrappers to require 10.14 for x64.
|
||||||
|
patch -u build-scripts/clang-fat.sh <<EOF
|
||||||
|
--- clang-fat.bak 2022-07-30 22:32:22.000000000 -0700
|
||||||
|
+++ clang-fat.sh 2022-07-30 22:34:57.000000000 -0700
|
||||||
|
@@ -6,12 +6,12 @@
|
||||||
|
|
||||||
|
DEVELOPER="\`xcode-select -print-path\`/Platforms/MacOSX.platform/Developer"
|
||||||
|
|
||||||
|
-# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
||||||
|
-CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.6 \\
|
||||||
|
--DMAC_OS_X_VERSION_MIN_REQUIRED=1060 \\
|
||||||
|
+# Intel 64-bit compiler flags (10.14 runtime compatibility)
|
||||||
|
+CLANG_COMPILE_X64="clang -arch x86_64 -mmacosx-version-min=10.14 \\
|
||||||
|
+-DMAC_OS_X_VERSION_MIN_REQUIRED=101400 \\
|
||||||
|
-I/usr/local/include"
|
||||||
|
|
||||||
|
-CLANG_LINK_X64="-mmacosx-version-min=10.6"
|
||||||
|
+CLANG_LINK_X64="-mmacosx-version-min=10.14"
|
||||||
|
|
||||||
|
# ARM 64-bit compiler flags (11.0 runtime compatibility)
|
||||||
|
CLANG_COMPILE_ARM64="clang -arch arm64 -mmacosx-version-min=11.0 \\
|
||||||
|
EOF
|
||||||
|
|
||||||
|
patch -u build-scripts/clang++-fat.sh << EOF
|
||||||
|
--- clang++-fat.bak 2022-07-30 22:55:02.000000000 -0700
|
||||||
|
+++ clang++-fat.sh 2022-07-30 22:55:19.000000000 -0700
|
||||||
|
@@ -6,11 +6,11 @@
|
||||||
|
|
||||||
|
DEVELOPER="\`xcode-select -print-path\`/Platforms/MacOSX.platform/Developer"
|
||||||
|
|
||||||
|
-# Intel 64-bit compiler flags (10.6 runtime compatibility)
|
||||||
|
-CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.6 \\
|
||||||
|
+# Intel 64-bit compiler flags (10.14 runtime compatibility)
|
||||||
|
+CLANG_COMPILE_X64="clang++ -arch x86_64 -mmacosx-version-min=10.14 \\
|
||||||
|
-I/usr/local/include"
|
||||||
|
|
||||||
|
-CLANG_LINK_X64="-mmacosx-version-min=10.6"
|
||||||
|
+CLANG_LINK_X64="-mmacosx-version-min=10.14"
|
||||||
|
|
||||||
|
# ARM 64-bit compiler flags (11.0 runtime compatibility)
|
||||||
|
CLANG_COMPILE_ARM64="clang++ -arch arm64 -mmacosx-version-min=11.0 \\
|
||||||
|
EOF
|
||||||
|
|
||||||
|
CC="${PWD}/build-scripts/clang-fat.sh" CXX="${PWD}/build-scripts/clang++-fat.sh" ./configure --prefix "$INSTALLDIR" --without-x
|
||||||
make "-j$NPROCS"
|
make "-j$NPROCS"
|
||||||
make install
|
make install
|
||||||
cd ..
|
cd ..
|
||||||
|
@ -50,11 +94,22 @@ cd ..
|
||||||
echo "Installing curl..."
|
echo "Installing curl..."
|
||||||
tar xf "curl-$CURL.tar.gz"
|
tar xf "curl-$CURL.tar.gz"
|
||||||
cd "curl-$CURL"
|
cd "curl-$CURL"
|
||||||
./configure --prefix "$INSTALLDIR" --with-secure-transport
|
mkdir build-x64
|
||||||
|
cd build-x64
|
||||||
|
../configure --prefix "$INSTALLDIR" --with-secure-transport
|
||||||
make "-j$NPROCS"
|
make "-j$NPROCS"
|
||||||
make install
|
make install
|
||||||
cd ..
|
cd ..
|
||||||
|
|
||||||
|
# Build arm64, but don't install it, instead just add the arm64 binary into the existing x64 dylib.
|
||||||
|
mkdir build-arm64
|
||||||
|
cd build-arm64
|
||||||
|
CFLAGS="-arch arm64" ../configure --host x86_64-apple-darwin --prefix "$INSTALLDIR" --with-secure-transport
|
||||||
|
make "-j$NPROCS"
|
||||||
|
lipo -create "$INSTALLDIR/lib/libcurl.4.dylib" "lib/.libs/libcurl.4.dylib" -o "$INSTALLDIR/lib/libcurl.4.dylib"
|
||||||
|
cd ../..
|
||||||
|
|
||||||
|
# MoltenVK already builds universal binaries, nothing special to do here.
|
||||||
echo "Installing MoltenVK..."
|
echo "Installing MoltenVK..."
|
||||||
tar xf "v$MOLTENVK.tar.gz"
|
tar xf "v$MOLTENVK.tar.gz"
|
||||||
cd "MoltenVK-${MOLTENVK}"
|
cd "MoltenVK-${MOLTENVK}"
|
||||||
|
@ -68,7 +123,7 @@ tar xf "qtbase-everywhere-src-$QT.tar.xz"
|
||||||
cd "qtbase-everywhere-src-$QT"
|
cd "qtbase-everywhere-src-$QT"
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release -DFEATURE_optimize_size=ON -DFEATURE_dbus=OFF -DFEATURE_framework=OFF -DFEATURE_icu=OFF -DFEATURE_opengl=OFF -DFEATURE_printsupport=OFF -DFEATURE_sql=OFF ..
|
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release -DFEATURE_optimize_size=ON -DFEATURE_dbus=OFF -DFEATURE_framework=OFF -DFEATURE_icu=OFF -DFEATURE_opengl=OFF -DFEATURE_printsupport=OFF -DFEATURE_sql=OFF ..
|
||||||
cmake --build . --parallel
|
cmake --build . --parallel
|
||||||
cmake --install .
|
cmake --install .
|
||||||
cd ../../
|
cd ../../
|
||||||
|
@ -78,7 +133,7 @@ tar xf "qtsvg-everywhere-src-$QT.tar.xz"
|
||||||
cd "qtsvg-everywhere-src-$QT"
|
cd "qtsvg-everywhere-src-$QT"
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=MinSizeRel ..
|
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=MinSizeRel ..
|
||||||
cmake --build . --parallel
|
cmake --build . --parallel
|
||||||
cmake --install .
|
cmake --install .
|
||||||
cd ../../
|
cd ../../
|
||||||
|
@ -102,7 +157,7 @@ patch -u src/linguist/CMakeLists.txt <<EOF
|
||||||
EOF
|
EOF
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release -DFEATURE_assistant=OFF -DFEATURE_clang=OFF -DFEATURE_designer=OFF -DFEATURE_kmap2qmap=OFF -DFEATURE_pixeltool=OFF -DFEATURE_pkg_config=OFF -DFEATURE_qev=OFF -DFEATURE_qtattributionsscanner=OFF -DFEATURE_qtdiag=OFF -DFEATURE_qtplugininfo=OFF ..
|
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release -DFEATURE_assistant=OFF -DFEATURE_clang=OFF -DFEATURE_designer=OFF -DFEATURE_kmap2qmap=OFF -DFEATURE_pixeltool=OFF -DFEATURE_pkg_config=OFF -DFEATURE_qev=OFF -DFEATURE_qtattributionsscanner=OFF -DFEATURE_qtdiag=OFF -DFEATURE_qtplugininfo=OFF ..
|
||||||
cmake --build . --parallel
|
cmake --build . --parallel
|
||||||
cmake --install .
|
cmake --install .
|
||||||
cd ../../
|
cd ../../
|
||||||
|
@ -112,7 +167,7 @@ tar xf "qttranslations-everywhere-src-$QT.tar.xz"
|
||||||
cd "qttranslations-everywhere-src-$QT"
|
cd "qttranslations-everywhere-src-$QT"
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -G Ninja -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release ..
|
cmake -G Ninja -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64" -DCMAKE_PREFIX_PATH="$INSTALLDIR" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DCMAKE_BUILD_TYPE=Release ..
|
||||||
cmake --build . --parallel
|
cmake --build . --parallel
|
||||||
cmake --install .
|
cmake --install .
|
||||||
cd ../../
|
cd ../../
|
||||||
|
|
41
scripts/make-universal-macos-binary.sh
Executable file
41
scripts/make-universal-macos-binary.sh
Executable file
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
DEPS=$HOME/deps
|
||||||
|
|
||||||
|
if [ "$#" -ne 1 ]; then
|
||||||
|
echo "Syntax: $0 <path to source directory>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# no realpath...
|
||||||
|
SOURCEDIR="$1"
|
||||||
|
|
||||||
|
echo "Build x64..."
|
||||||
|
mkdir build-x64
|
||||||
|
cd build-x64
|
||||||
|
export MACOSX_DEPLOYMENT_TARGET=10.14
|
||||||
|
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
|
||||||
|
cmake --build . --parallel
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo "Build arm64..."
|
||||||
|
mkdir build-arm64
|
||||||
|
cd build-arm64
|
||||||
|
export MACOSX_DEPLOYMENT_TARGET=11.00
|
||||||
|
cmake -DCMAKE_OSX_ARCHITECTURES=arm64 -DCMAKE_BUILD_TYPE=Release -DBUILD_NOGUI_FRONTEND=OFF -DBUILD_QT_FRONTEND=ON -DUSE_SDL2=ON -DENABLE_OPENGL=OFF -DCMAKE_PREFIX_PATH="$DEPS" -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON -G Ninja "../$SOURCEDIR"
|
||||||
|
cmake --build . --parallel
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
echo "Combine binary..."
|
||||||
|
unset MACOSX_DEPLOYMENT_TARGET
|
||||||
|
BINPATH=bin/DuckStation.app/Contents/MacOS/DuckStation
|
||||||
|
lipo -create "build-x64/$BINPATH" "build-arm64/$BINPATH" -o "build-x64/$BINPATH"
|
||||||
|
|
||||||
|
echo "Grab app..."
|
||||||
|
mv build-x64/bin/DuckStation.app .
|
||||||
|
rm -fr build-x64 build-arm64
|
||||||
|
|
||||||
|
echo "Sign binary with self-signed cert..."
|
||||||
|
codesign -s - --deep -f -v DuckStation.app
|
Loading…
Reference in a new issue