Skip to content

Commit 5d68623

Browse files
CopilotXmader
andauthored
Intel macOS: use Mozilla-bootstrapped clang instead of Homebrew llvm@19
Co-authored-by: Xmader <16057139+Xmader@users.noreply.github.com>
1 parent 8c2cf2b commit 5d68623

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

‎.github/workflows/test-and-publish.yaml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,10 @@ jobs:
260260
# to llvm@19: the unversioned `llvm` formula (currently 23.x)
261261
# has no bottle for Intel macOS or macOS 14, so it silently
262262
# falls back to a multi-hour from-source build here.
263-
brew install llvm@19
264-
echo "PATH=$(brew --prefix llvm@19)/bin:$PATH" >> $GITHUB_ENV
263+
if [[ "$(uname -m)" != "x86_64" ]]; then # no llvm@19 bottle for Intel macOS; use Xcode's clang there
264+
brew install llvm@19
265+
echo "PATH=$(brew --prefix llvm@19)/bin:$PATH" >> $GITHUB_ENV
266+
fi
265267
fi
266268
echo "Installing python deps"
267269
poetry self add "poetry-dynamic-versioning[plugin]"

‎setup.sh‎

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,15 @@ elif [[ "$OSTYPE" == "darwin"* ]]; then # macOS
2828
# `llvm`/`lld` have no bottles for Intel macOS or macOS 14 and build from
2929
# source for hours (and lld pulls in the unversioned llvm). Both kegs are
3030
# keg-only, so put them on PATH explicitly.
31-
brew install llvm@19 lld@19
32-
export PATH="$(brew --prefix llvm@19)/bin:$(brew --prefix lld@19)/bin:$PATH"
31+
if [[ "$(uname -m)" == "x86_64" ]]; then
32+
# Homebrew no longer ships llvm@19/lld@19 bottles for Intel macOS and would
33+
# build LLVM from source (which fails), so use the clang toolchain that
34+
# Mozilla's own bootstrap downloads once the source is extracted (below).
35+
echo "Intel macOS: will use Mozilla's bootstrapped clang"
36+
else
37+
brew install llvm@19 lld@19
38+
export PATH="$(brew --prefix llvm@19)/bin:$(brew --prefix lld@19)/bin:$PATH"
39+
fi
3340
elif [[ "$OSTYPE" == "msys"* || "$OSTYPE" == "cygwin"* ]]; then # Windows
3441
echo "Dependencies are not going to be installed automatically on Windows."
3542
else
@@ -87,6 +94,12 @@ echo "Done downloading spidermonkey source code"
8794
echo "Building spidermonkey"
8895
cd firefox-source
8996

97+
if [[ "$OSTYPE" == "darwin"* && "$(uname -m)" == "x86_64" ]]; then
98+
# Fetch Mozilla's prebuilt clang (>= 19) for Intel macOS, see above
99+
python3 ./mach --no-interactive bootstrap --application-choice=js --no-system-changes
100+
export PATH="$HOME/.mozbuild/clang/bin:$PATH"
101+
fi
102+
90103
# Apply patching
91104
# making it work for both GNU and BSD (macOS) versions of sed
92105
sed -i'' -e 's/os not in ("WINNT", "OSX", "Android")/os not in ("WINNT", "Android")/' ./build/moz.configure/pkg.configure # use pkg-config on macOS

0 commit comments

Comments
 (0)