@@ -28,11 +28,25 @@ 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+ USE_MOZ_BOOTSTRAP_CLANG=0
3132 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"
33+ # Homebrew's current llvm@19/lld@19 formulae have no Intel bottles, so brew
34+ # would build LLVM from source (hours, then fails). Install the last
35+ # formula revisions that still listed the Intel (`sonoma`) bottles from a
36+ # local tap instead; those are `cellar: :any` so they run on newer macOS.
37+ HB_PIN=2a2d17bc2f926b69105a1ca221761d39e65bf737 # homebrew-core commit
38+ brew tap-new --no-git local/pythonmonkey > /dev/null
39+ HB_TAP=" $( brew --repository local/pythonmonkey) /Formula"
40+ mkdir -p " $HB_TAP "
41+ for f in ' llvm@19' ' lld@19' ; do
42+ curl -fsSL -o " $HB_TAP /$f .rb" " https://raw.githubusercontent.com/Homebrew/homebrew-core/$HB_PIN /Formula/${f: 0: 1} /$f .rb"
43+ done
44+ if HOMEBREW_DEVELOPER=1 brew install --force-bottle local/pythonmonkey/llvm@19 local/pythonmonkey/lld@19; then
45+ export PATH=" $( brew --prefix llvm@19) /bin:$( brew --prefix lld@19) /bin:$PATH "
46+ else
47+ echo " Pinned Intel bottles unavailable; falling back to Mozilla's bootstrapped clang"
48+ USE_MOZ_BOOTSTRAP_CLANG=1
49+ fi
3650 else
3751 brew install llvm@19 lld@19
3852 export PATH=" $( brew --prefix llvm@19) /bin:$( brew --prefix lld@19) /bin:$PATH "
@@ -94,7 +108,7 @@ echo "Done downloading spidermonkey source code"
94108echo " Building spidermonkey"
95109cd firefox-source
96110
97- if [[ " $OSTYPE " == " darwin " * && " $( uname -m ) " == " x86_64 " ]]; then
111+ if [[ " ${USE_MOZ_BOOTSTRAP_CLANG :- 0} " == 1 ]]; then
98112 # Fetch Mozilla's prebuilt clang (>= 19) for Intel macOS, see above
99113 python3 ./mach --no-interactive bootstrap --application-choice=js --no-system-changes
100114 export PATH=" $HOME /.mozbuild/clang/bin:$PATH "
0 commit comments