Skip to content

Commit

Permalink
fix: install arm brew on MacOS Arm to install libsodium
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Dec 4, 2022
1 parent e450c46 commit 4957f4e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
10 changes: 9 additions & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,18 @@ jobs:
cache: "pnpm"

- name: Install Mac-OS Dependencies
if: contains(matrix.os, 'macos')
if: ${{ contains(matrix.os, 'macos') && matrix.ARCH == 'x86_64' }}
run: |
brew install libsodium gnutls
- name: Install Mac-OS Arm Dependencies
if: ${{ contains(matrix.os, 'macos') && matrix.ARCH == 'arm64' }}
run: |
brew uninstall libsodium --force --ignore-dependencies
chmod +x ./script/install-arm-brew.sh
./script/install-arm-brew.sh
arm-brew install libsodium gnutls
- name: Install Dependencies and Build
if: ${{ !matrix.docker }}
run: pnpm install
Expand Down
31 changes: 31 additions & 0 deletions script/install-arm-brew.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
set -e

#! Install arm-brew on x86 MacOS Arm
#! Based on https://github.com/Homebrew/discussions/discussions/2843#discussioncomment-2243610

mkdir -p ~/arm-target/bin
mkdir -p ~/arm-target/brew-cache
export PATH="$HOME/arm-target/bin:$PATH"

PREV_PWD="$PWD"
cd ~/arm-target

mkdir arm-homebrew
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C arm-homebrew
ln -s ~/arm-target/arm-homebrew/bin/brew ~/arm-target/bin/arm-brew

export HOMEBREW_CACHE=~/arm-target/brew-cache
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1

arm-brew fetch --deps --bottle-tag=arm64_big_sur sox opusfile |
grep -E "(Downloaded to:|Already downloaded:)" |
grep -v pkg-config |
awk '{ print $3 }' |
xargs -n 1 arm-brew install --ignore-dependencies --force-bottle

# Install host version of pkg-config so we can call it in the build system
arm-brew install pkg-config
ln -s ~/arm-target/arm-homebrew/bin/pkg-config ~/arm-target/bin/arm-pkg-config

cd "$PREV_PWD"

0 comments on commit 4957f4e

Please sign in to comment.