Building Waterfox on macOS

Had some issues compiling this for a while on a m4 pro macbook, mostly due to missing and outdated packages.
Mayhaps be useful to someone else :)

./mach bootstrap

If ensure_cargo_tools() fails compiling cargo-binstall with something like:

rustc 1.XX.Y is not supported by the following packages:
  kstring@2.0.4 requires rustc 1.96.0
  vergen@10.0.3 requires rustc 1.96.0

rustc is too old. Check for other installations: type -a rustc

and:

rustup update stable

the default linking detection tries lld first on macOS with fallback to ld64.
In my csae, the fallback failed: "Failed to find an adequate linker"

brew install lld
which ld64.lld

Add a mozconfig file at the repo root forcing it:

ac_add_options --enable-linker=lld

Then...
waterfox/build/mozconfig.common hardcodes
--with-wasi-sysroot="$HOME/.mozbuild/sysroot-wasm32-wasi" and disables
auto-bootstrap, so mach bootstrap does not find it.

you may see something like Argument to --with-wasi-sysroot must be a directory.

clang-22 fixes it:

sh scripts/fetch-clang-22.sh

And finally some git things:

waterfox/browser/locales is a submodule BrowserWorks/l10n.
mozconfig's -d waterfox/browser/locales/en-GB check sets --with-l10n-base, and the build fails:

FATAL ERROR PROCESSING MOZBUILD FILE
...waterfox/browser/moz.build
referenced a path that does not exist:
    .../waterfox/browser/locales/moz.build

run:

git submodule update --init waterfox/browser/locales
./mach build

and finally run:

./mach run

beep boop