Skip to content

Commit

Permalink
split macos build
Browse files Browse the repository at this point in the history
  • Loading branch information
B0ney committed Jan 30, 2024
1 parent 777a029 commit 4fb4a2d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
8 changes: 8 additions & 0 deletions .github/workflows/build_gui_artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ jobs:
os: macos-latest
make: bash dist/build-macos.sh
artifact_path: "target/release/artifact/*"

- target: macos-silicon
os: macos-latest
make: |
rustup target add aarch64-apple-darwin
rustup default stable aarch64-apple-darwin
bash dist/build-macos.sh silicon
artifact_path: "target/release/artifact/*"

runs-on: ${{ matrix.target.os }}

Expand Down
18 changes: 9 additions & 9 deletions dist/build-macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ ARCHIVE_DIR="$RELEASE_DIR/archive"
ARTIFACT_DIR="$RELEASE_DIR/artifact"
BINARY="$ARCHIVE_DIR/$TARGET"

case "$1" in
"silicon") BINARY_TYPE="apple-silicon";;
*) BINARY_TYPE="intel"
esac

# create directories
mkdir -p $ARCHIVE_DIR
Expand All @@ -22,24 +26,20 @@ rm -rf $ARCHIVE_DIR/*
mkdir -p $ARTIFACT_DIR
rm -rf $ARTIFACT_DIR/*


# Build universal binary and store it to the archive directory
export MACOSX_DEPLOYMENT_TARGET="11.0"
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
cargo build -p xmodits-gui --release --target=x86_64-apple-darwin --features=$FEATURES
cargo build -p xmodits-gui --release --target=aarch64-apple-darwin --features=$FEATURES

lipo "target/x86_64-apple-darwin/release/$TARGET_OLD" "target/aarch64-apple-darwin/release/$TARGET_OLD" -create -output "$BINARY"
echo "Created universal binary"
cargo build -p xmodits-gui --release --features=$FEATURES

mv "target/release/$TARGET_OLD" "$BINARY"
echo "Created MacOS binary"

# copy extra files
cp ./assets/manual.txt $ARCHIVE_DIR
cp LICENSE $ARCHIVE_DIR

chmod +x $BINARY

ARCHIVE_NAME="xmodits-gui-v$($BINARY --version)-$PLATFORM-universal.zip"
ARCHIVE_NAME="xmodits-gui-v$($BINARY --version)-$PLATFORM-$BINARY_TYPE.zip"
ARCHIVE_PATH="$ARTIFACT_DIR/$ARCHIVE_NAME"

zip -j $ARCHIVE_PATH $ARCHIVE_DIR/*

0 comments on commit 4fb4a2d

Please sign in to comment.