Skip to content

Commit 94499e6

Browse files
committed
fix: install arm brew on MacOS Arm to install libsodium
1 parent e450c46 commit 94499e6

File tree

2 files changed

+43
-2
lines changed

2 files changed

+43
-2
lines changed

.github/workflows/CI.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,18 @@ jobs:
106106
architecture: ${{ matrix.node_arch }}
107107
cache: "pnpm"
108108

109-
- name: Install Mac-OS Dependencies
110-
if: contains(matrix.os, 'macos')
109+
- name: Install Mac-OS ${{ matrix.ARCH }} Dependencies
110+
if: ${{ contains(matrix.os, 'macos') && matrix.ARCH == 'x86_64' }}
111111
run: |
112112
brew install libsodium gnutls
113113
114+
- name: Install Mac-OS ${{ matrix.ARCH }} Dependencies
115+
if: ${{ contains(matrix.os, 'macos') && matrix.ARCH == 'arm64' }}
116+
run: |
117+
brew uninstall libsodium --force --ignore-dependencies
118+
chmod +x ./script/macos-arm-deps.sh
119+
./script/macos-arm-deps.sh
120+
114121
- name: Install Dependencies and Build
115122
if: ${{ !matrix.docker }}
116123
run: pnpm install

script/macos-arm-deps.sh

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/bin/sh
2+
set -e
3+
4+
#! Install arm-brew on x86 MacOS Arm
5+
#! Based on https://github.com/Homebrew/discussions/discussions/2843#discussioncomment-2243610
6+
7+
bottle_tag="arm64_big_sur" # Macos 11 is big sure
8+
dependencies="libsodium gnutls"
9+
10+
mkdir -p ~/arm-target/bin
11+
mkdir -p ~/arm-target/brew-cache
12+
export PATH="$HOME/arm-target/bin:$PATH"
13+
14+
PREV_PWD="$PWD"
15+
cd ~/arm-target
16+
17+
mkdir arm-homebrew
18+
curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C arm-homebrew
19+
ln -s ~/arm-target/arm-homebrew/bin/brew ~/arm-target/bin/arm-brew
20+
21+
export HOMEBREW_CACHE=~/arm-target/brew-cache
22+
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1
23+
24+
arm-brew fetch --deps --bottle-tag=$bottle_tag $dependencies |
25+
grep -E "(Downloaded to:|Already downloaded:)" |
26+
grep -v pkg-config |
27+
awk '{ print $3 }' |
28+
xargs -n 1 arm-brew install --ignore-dependencies --force-bottle
29+
30+
# Install host version of pkg-config so we can call it in the build system
31+
arm-brew install pkg-config
32+
ln -s ~/arm-target/arm-homebrew/bin/pkg-config ~/arm-target/bin/arm-pkg-config
33+
34+
cd "$PREV_PWD"

0 commit comments

Comments
 (0)