github: macos zig linker

This commit is contained in:
ardocrat 2024-10-27 00:40:58 +03:00
parent 4b454ab2f3
commit ed522c56ae

View file

@ -102,6 +102,12 @@ jobs:
fetch-depth: 0 fetch-depth: 0
- name: Install coreutils - name: Install coreutils
run: brew install coreutils run: brew install coreutils
- name: Zig Setup
uses: goto-bus-stop/setup-zig@v2
with:
version: 0.12.1
- name: Install cargo-zigbuild
run: cargo install cargo-zigbuild
- name: Download SDK - name: Download SDK
run: wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.15.sdk.tar.xz run: wget https://github.com/phracker/MacOSX-SDKs/releases/download/11.3/MacOSX10.15.sdk.tar.xz
- name: Setup SDK env - name: Setup SDK env
@ -111,7 +117,7 @@ jobs:
- name: Release x86 - name: Release x86
run: | run: |
rustup target add x86_64-apple-darwin rustup target add x86_64-apple-darwin
cargo build --release --target x86_64-apple-darwin cargo zigbuild --release --target x86_64-apple-darwin
yes | cp -rf target/x86_64-apple-darwin/release/grim macos/Grim.app/Contents/MacOS yes | cp -rf target/x86_64-apple-darwin/release/grim macos/Grim.app/Contents/MacOS
- name: Archive x86 - name: Archive x86
run: | run: |
@ -132,7 +138,7 @@ jobs:
- name: Release ARM - name: Release ARM
run: | run: |
rustup target add aarch64-apple-darwin rustup target add aarch64-apple-darwin
cargo build --release --target aarch64-apple-darwin cargo zigbuild --release --target aarch64-apple-darwin
yes | cp -rf target/aarch64-apple-darwin/release/grim macos/Grim.app/Contents/MacOS yes | cp -rf target/aarch64-apple-darwin/release/grim macos/Grim.app/Contents/MacOS
- name: Archive ARM - name: Archive ARM
run: | run: |
@ -144,14 +150,10 @@ jobs:
working-directory: target/aarch64-apple-darwin/release working-directory: target/aarch64-apple-darwin/release
shell: bash shell: bash
run: sha256sum grim-${{ github.ref_name }}-macos-arm.zip > grim-${{ github.ref_name }}-macos-arm-sha256sum.txt run: sha256sum grim-${{ github.ref_name }}-macos-arm.zip > grim-${{ github.ref_name }}-macos-arm-sha256sum.txt
- name: Setup platform env
run: echo "MACOSX_DEPLOYMENT_TARGET=10.15" >> $GITHUB_ENV
- name: Setup SDK env
run: echo "SDKROOT=${{ github.workspace }}/MacOSX10.15.sdk" >> $GITHUB_ENV
- name: Release Universal - name: Release Universal
run: | run: |
lipo -create -output target/grim target/aarch64-apple-darwin/release/grim target/x86_64-apple-darwin/release/grim cargo zigbuild --release --target universal2-apple-darwin
yes | cp -rf target/grim macos/Grim.app/Contents/MacOS yes | cp -rf target/universal2-apple-darwin/release/grim macos/Grim.app/Contents/MacOS
- name: Archive Universal - name: Archive Universal
run: | run: |
cd macos cd macos
@ -160,7 +162,7 @@ jobs:
cd .. cd ..
- name: Checksum Release Universal - name: Checksum Release Universal
working-directory: target/universal2-apple-darwin/release working-directory: target/universal2-apple-darwin/release
shell: bash shell: pwsh
run: sha256sum grim-${{ github.ref_name }}-macos-universal.zip > grim-${{ github.ref_name }}-macos-universal-sha256sum.txt run: sha256sum grim-${{ github.ref_name }}-macos-universal.zip > grim-${{ github.ref_name }}-macos-universal-sha256sum.txt
- name: Release - name: Release
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1