tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit 61df43a027c59b54f75725c028433c0b245e5cef
parent 419c3b52b673aa20926552898b35ab9f5f8eff1d
Author: Nick Alexander <nalexander@mozilla.com>
Date:   Thu, 27 Nov 2025 18:48:38 +0000

Bug 1987757 - Part 2: Expose `embedded-uniffi-bindgen` to build. r=firefox-build-system-reviewers,ahochheiden,nalexander

Builds that have a compile environment produce
`embedded-uniffi-bindgen` as a `RUST_HOST_PROGRAM`.

Builds that do not have a compile environment, including artifact
builds, consume `embedded-uniffi-bindgen` from a host-specific
toolchain archive.  Since `embedded-uniffi-bindgen` and similar tools
are required early in the build process, and are host
architecture-specific, they are managed differently than test-time
host utilities.  (Said test-time utilities are accommodated directly
by the `mach artifact install ...` machinery.)

Differential Revision: https://phabricator.services.mozilla.com/D266037

Diffstat:
Mmobile/android/moz.configure | 43+++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+), 0 deletions(-)

diff --git a/mobile/android/moz.configure b/mobile/android/moz.configure @@ -186,3 +186,46 @@ set_config( "MOZ_ANDROID_FAT_AAR_ARCHITECTURES", depends("MOZ_ANDROID_FAT_AAR_ARCHITECTURES")(lambda x: x), ) + + +# Template to check for a build-time host/bin program that is either produced as +# part of the build or is fetched from a toolchain artifact. Also allows +# `--without-{prog}` to disable checking. +# +# Such compiled programs are "part of the build" but need special accommodations +# to distribute to artifact builds: they are distributed as toolchain builds +# rather than extracted from a package or a test package. In addition, these +# compiled programs may not be needed for very unusual jobs, in particular +# `android-gradle-dependencies` jobs, so they can be disabled entirely. +# +# - `var` is the name of the variable that will be set with `set_config` when +# the program is found, like "A_PROG". +# - `prog` is the name of the program, like "a-prog". +# - `toolchain` is the name of the toolchain (defaults to `prog`). +@template +def check_host_bin_prog(var, prog, toolchain=None): + option(f"--without-{prog}", help="Disable building with {prog}") + + with only_when(f"--with-{prog}"): + with only_when(compile_environment): + # Produced at build-time. Look in `$DIST/host/bin`. + set_config( + var, + depends(build_environment.dist, bin_suffix(host))( + lambda dist, bin_suffix: f"{dist}/host/bin/{prog}{bin_suffix}" + ), + ) + + with only_when(~compile_environment): + # Fetched at configure-time. Look in `~/.mozbuild` locally or + # `$MOZ_FETCH_DIR` in automation. + check_prog( + var, + [prog], + what=prog, + bootstrap=toolchain or prog, + ) + + +check_host_bin_prog("EMBEDDED_UNIFFI_BINDGEN", "embedded-uniffi-bindgen") +check_host_bin_prog("NIMBUS_FML", "nimbus-fml")