Skip to content

Commit

Permalink
Add macOS universal binary build
Browse files Browse the repository at this point in the history
Fixes #178
  • Loading branch information
quietvoid committed Dec 28, 2022
1 parent 1b6c6a5 commit 15ff51a
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ env:
RELEASE_BIN: dovi_tool
RELEASE_DIR: artifacts
WINDOWS_TARGET: x86_64-pc-windows-msvc
MACOS_TARGET: x86_64-apple-darwin
MACOS_X86_TARGET: x86_64-apple-darwin
MACOS_ARM_TARGET: aarch64-apple-darwin
LINUX_TARGET: x86_64-unknown-linux-musl

jobs:
Expand Down Expand Up @@ -51,7 +52,11 @@ jobs:
- name: Build (macOS)
if: matrix.build == 'macOS'
run: cargo build --release
run: |
rustup target add ${{ env.MACOS_ARM_TARGET }}
cargo build --release
cargo build --release --target ${{ env.MACOS_ARM_TARGET }}
- name: Build (Windows)
if: matrix.build == 'Windows'
Expand Down Expand Up @@ -91,12 +96,21 @@ jobs:
mv ./target/${{ env.WINDOWS_TARGET }}/release/dovi.dll .
7z a ./${{ env.RELEASE_DIR }}/libdovi-${{ env.LIBDOVI_PKG_VERSION }}-${{ env.WINDOWS_TARGET }}.zip ./dovi.dll
- name: Create zipfile (macOS)
- name: Create universal macOS binary
if: matrix.build == 'macOS'
run: |
strip ./target/release/${{ env.RELEASE_BIN }}
mv ./target/release/${{ env.RELEASE_BIN }} ./${{ env.RELEASE_BIN }}
zip -9 ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ env.RELEASE_PKG_VERSION }}-${{ env.MACOS_TARGET }}.zip ./${{ env.RELEASE_BIN }}
strip ./target/aarch64-apple-darwin/release/${{ env.RELEASE_BIN }}
lipo -create \
./target/aarch64-apple-darwin/release/${{ env.RELEASE_BIN }} \
./target/release/${{ env.RELEASE_BIN }} \
-output ./${{ env.RELEASE_BIN }}
- name: Create zipfile (macOS)
if: matrix.build == 'macOS'
run: |
zip -9 ./${{ env.RELEASE_DIR }}/${{ env.RELEASE_BIN }}-${{ env.RELEASE_PKG_VERSION }}-universal-macOS.zip ./${{ env.RELEASE_BIN }}
- name: Upload Zip
uses: actions/upload-artifact@v1
Expand Down

0 comments on commit 15ff51a

Please sign in to comment.