From 38422b1795c98d8d0e3bc8dc479d12f8d5bd7154 Mon Sep 17 00:00:00 2001 From: Jurek Date: Tue, 23 Jan 2024 02:58:48 +0100 Subject: [PATCH] Adding support for Universal Binary for MacOS on M1 (#450) * Adding universal binary support * Bundle into universal * Change name of macOS artifact --------- Co-authored-by: Jackson Goode --- .github/workflows/build.yml | 18 ++++++++++++++---- README.md | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5d34fe9e..68a69b19 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,19 +49,29 @@ jobs: - name: Build Release run: cargo build --release - + + - name: Build aarch64 for MacOS + if: ${{ runner.os == 'macOS' }} + run: | + rustup target add aarch64-apple-darwin + cargo build --release --target aarch64-apple-darwin + - name: Bundle macOS Release if: ${{ runner.os == 'macOS' }} run: | cargo install cargo-bundle cargo bundle --release working-directory: psst-gui + + - name: Create macOS universal binary + if: ${{ runner.os == 'macOS' }} + run: lipo target/release/psst-gui target/aarch64-apple-darwin/release/psst-gui -create -output target/release/bundle/osx/Psst.app/Contents/MacOS/psst-gui - name: Create macOS Disk Image if: ${{ runner.os == 'macOS' }} run: | hdiutil create Psst-uncompressed.dmg -volname "Psst" -srcfolder target/release/bundle/osx - hdiutil convert Psst-uncompressed.dmg -format UDZO -o Psst-x64.dmg + hdiutil convert Psst-uncompressed.dmg -format UDZO -o Psst.dmg - name: Make Linux Binary Executable if: ${{ runner.os == 'Linux' }} @@ -78,8 +88,8 @@ jobs: uses: actions/upload-artifact@v3 if: ${{ runner.os == 'macOS' }} with: - name: Psst-x64.dmg - path: ./Psst-x64.dmg + name: Psst.dmg + path: ./Psst.dmg - name: Upload Windows Executable uses: actions/upload-artifact@v3 diff --git a/README.md b/README.md index e42f12ea..c4480393 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ You can download the prebuilt binaries for x86_64 Windows, Linux (Ubuntu), and m | [Windows](https://nightly.link/jpochyla/psst/workflows/build/master/Psst.exe.zip) | | [Linux (Ubuntu)](https://nightly.link/jpochyla/psst/workflows/build/master/psst-gui.zip) | | [Debian Package](https://nightly.link/jpochyla/psst/workflows/build/master/psst-deb.zip) | -| [MacOS](https://nightly.link/jpochyla/psst/workflows/build/master/Psst-x64.dmg.zip) | +| [MacOS](https://nightly.link/jpochyla/psst/workflows/build/master/Psst.dmg.zip) | Unofficial builds of Psst are also available through the [AUR](https://aur.archlinux.org/packages/psst-git) and [Homebrew](https://formulae.brew.sh/cask/psst).