Skip to content

Commit

Permalink
BUILD: macos - use matrix for builds, export proper cpu/arch when doi…
Browse files Browse the repository at this point in the history
…ng builds
  • Loading branch information
ciscon committed Oct 23, 2023
1 parent 143094d commit 8473c0c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 30 deletions.
35 changes: 8 additions & 27 deletions .github/workflows/build-targets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,48 +46,29 @@ jobs:
name: ${{ matrix.target }}
path: .vs\${{ matrix.platform }}\${{ matrix.config }}\Output\ezQuake.exe

macos-arm-build:
runs-on: macos-12
steps:
- name: Check out code
uses: actions/checkout@v3
with:
submodules: true

- name: Install dependencies
run: .github/workflows/scripts/homebrew.sh install-arm64

- name: Build
run: .github/workflows/scripts/homebrew.sh build-arm64

- name: Create Bundle
run: .github/workflows/scripts/homebrew.sh create-bundle

- uses: actions/upload-artifact@v3
with:
name: macos-arm64
path: ezQuake.zip

macos-intel-build:
macos-build:
runs-on: macos-12
strategy:
matrix:
ARCH: ["arm64","intel"]
steps:
- name: Check out code
uses: actions/checkout@v3
with:
submodules: true

- name: Install dependencies
run: .github/workflows/scripts/homebrew.sh install-intel
run: .github/workflows/scripts/homebrew.sh install-${{matrix.ARCH}}

- name: Build
run: .github/workflows/scripts/homebrew.sh build-intel
run: .github/workflows/scripts/homebrew.sh build-${{matrix.ARCH}}

- name: Create Bundle
run: .github/workflows/scripts/homebrew.sh create-bundle
run: .github/workflows/scripts/homebrew.sh create-bundle ${{matrix.ARCH}}

- uses: actions/upload-artifact@v3
with:
name: macos-intel
name: macos-${{matrix.ARCH}}
path: ezQuake.zip

linux-build:
Expand Down
12 changes: 10 additions & 2 deletions .github/workflows/scripts/homebrew.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ dependencies=(


function install_arm64() {
export CPU="arm64"
# Ignore pre-installed Intel packages, always install what we say.
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK="true"
export HOMEBREW_NO_INSTALL_CLEANUP="true"
Expand All @@ -50,13 +51,18 @@ function install_arm64() {
}

function install_intel() {
export CPU="x86_64"
export HOMEBREW_NO_INSTALL_CLEANUP="true"
brew reinstall --quiet pkg-config
brew install --quiet "${dependencies[@]}"
}

function create_bundle() {
sh misc/install/create_osx_bundle.sh
ARCH=$1
if [ "$ARCH" == "intel" ];then
ARCH="x86_64"
fi
sh misc/install/create_osx_bundle.sh $ARCH

echo
echo "Bundled content types:"
Expand All @@ -66,10 +72,12 @@ function create_bundle() {
}

function build_intel() {
export CPU="x86_64"
make strip
}

function build_arm64() {
export CPU="arm64"
make strip DARWIN_TARGET=arm64-apple-macos12
}

Expand All @@ -87,7 +95,7 @@ case $1 in
build_arm64
;;
"create-bundle")
create_bundle
create_bundle $2
;;
*)
echo "Unknown arg $1"
Expand Down
2 changes: 1 addition & 1 deletion misc/install/create_osx_bundle.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# there will also be an ezquake.zip which basically just zips up the .app.
#

ARCH=$(uname -m | sed -e s/i.86/i386/ -e s/amd64/x86_64/ -e s/sun4u/sparc64/ -e s/arm.*/arm/ -e s/sa110/arm/ -e s/alpha/axp/)
ARCH=${1:-x86_64}

BUNDLE_NAME=ezQuake.app
BINARY=ezquake-darwin-${ARCH}
Expand Down

0 comments on commit 8473c0c

Please sign in to comment.