Skip to content

Commit

Permalink
refactor: Modularize macOS build steps for x86_64 and ARM64 dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
silviot committed Dec 7, 2024
1 parent e7b7a52 commit 21802ee
Showing 1 changed file with 55 additions and 29 deletions.
84 changes: 55 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,36 +64,62 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.arch }}-brew-
- name: Install dependencies
- name: Setup x86_64 Homebrew
if: matrix.arch == 'x86_64'
run: |
if [ "${{ matrix.arch }}" = "x86_64" ]; then
# Install x86_64 versions for Intel builds
HOMEBREW_PREFIX="/usr/local"
# Create /usr/local if it doesn't exist
sudo mkdir -p /usr/local
sudo chown -R $(whoami) /usr/local
# Install Homebrew for x86_64
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add Homebrew to PATH
eval "$(/usr/local/bin/brew shellenv)"
# Install dependencies
arch -x86_64 /usr/local/bin/brew install pkg-config gtk4 pango cairo gdk-pixbuf at-spi2-core graphene
arch -x86_64 /usr/local/bin/brew install -v libadwaita
# Set pkg-config path for x86_64
echo "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/opt/pango/lib/pkgconfig:/usr/local/opt/cairo/lib/pkgconfig:/usr/local/opt/gdk-pixbuf/lib/pkgconfig:/usr/local/opt/graphene/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/gtk4/lib/pkgconfig:/usr/local/opt/libadwaita/lib/pkgconfig" >> $GITHUB_ENV
# Ensure brew links are correct
arch -x86_64 brew link --force pango cairo gdk-pixbuf gtk4 libadwaita
else
# Install ARM64 versions for Apple Silicon builds
brew install pkg-config gtk4 pango cairo gdk-pixbuf at-spi2-core graphene libadwaita || true
brew upgrade pkg-config gtk4 pango cairo gdk-pixbuf at-spi2-core graphene libadwaita || true
echo "PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig" >> $GITHUB_ENV
fi
HOMEBREW_PREFIX="/usr/local"
sudo mkdir -p /usr/local
sudo chown -R $(whoami) /usr/local
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
eval "$(/usr/local/bin/brew shellenv)"
echo "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/opt/pango/lib/pkgconfig:/usr/local/opt/cairo/lib/pkgconfig:/usr/local/opt/gdk-pixbuf/lib/pkgconfig:/usr/local/opt/graphene/lib/pkgconfig:/usr/local/opt/libffi/lib/pkgconfig:/usr/local/opt/gtk4/lib/pkgconfig:/usr/local/opt/libadwaita/lib/pkgconfig" >> $GITHUB_ENV
- name: Install pkg-config (x86_64)
if: matrix.arch == 'x86_64'
run: arch -x86_64 /usr/local/bin/brew install pkg-config

- name: Install GTK4 (x86_64)
if: matrix.arch == 'x86_64'
run: arch -x86_64 /usr/local/bin/brew install gtk4

- name: Install Pango (x86_64)
if: matrix.arch == 'x86_64'
run: arch -x86_64 /usr/local/bin/brew install pango

- name: Install Cairo (x86_64)
if: matrix.arch == 'x86_64'
run: arch -x86_64 /usr/local/bin/brew install cairo

- name: Install GDK-Pixbuf (x86_64)
if: matrix.arch == 'x86_64'
run: arch -x86_64 /usr/local/bin/brew install gdk-pixbuf

- name: Install AT-SPI2-Core (x86_64)
if: matrix.arch == 'x86_64'
run: arch -x86_64 /usr/local/bin/brew install at-spi2-core

- name: Install Graphene (x86_64)
if: matrix.arch == 'x86_64'
run: arch -x86_64 /usr/local/bin/brew install graphene

- name: Install Libadwaita (x86_64)
if: matrix.arch == 'x86_64'
run: arch -x86_64 /usr/local/bin/brew install -v libadwaita

- name: Finalize x86_64 setup
if: matrix.arch == 'x86_64'
run: arch -x86_64 brew link --force pango cairo gdk-pixbuf gtk4 libadwaita

- name: Install ARM64 dependencies
if: matrix.arch == 'arm64'
run: |
brew install pkg-config gtk4 pango cairo gdk-pixbuf at-spi2-core graphene libadwaita || true
brew upgrade pkg-config gtk4 pango cairo gdk-pixbuf at-spi2-core graphene libadwaita || true
- name: Finalize ARM64 setup
if: matrix.arch == 'arm64'
run: |
echo "PKG_CONFIG_PATH=/opt/homebrew/lib/pkgconfig" >> $GITHUB_ENV
echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
- name: Add target ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
Expand Down

0 comments on commit 21802ee

Please sign in to comment.