303.1. firefox-esr-153.5.0
Firefox Extended Support Release web browser, on GTK 3 with Wayland and X11
| Version | 153.5.0, release 2 |
| Shelf | browsers — Web, Gemini and text-mode browsers |
| Phase | 44_apps (Applications), 12 of 422 in build order |
| Licence | MPL-2.0 |
| Homepage | https://www.firefox.com/ |
| Build time | 58.2 SBU |
| Installed size | 271.0 MiB in 45 files |
| Recipe | ports/core/browsers/firefox-esr/kpkgbuild |
About
Firefox ESR is Mozilla’s Extended Support Release of Firefox, and it is KDOS’s default web browser: web pages and the http and https schemes open in it through /usr/share/kdos/xdg/kde-mimeapps.list. It is built from Mozilla’s source tarball with clang, lld and Rust, on GTK 3 with both its Wayland and X11 backends; the session’s MOZ_ENABLE_WAYLAND=1 puts it on Wayland (see toolkits, Wayland and X11). librewolf is built from the same recipe shape.
Why it is in KDOS
The comment above it in script/phases/44_apps/packages.d/browsers.txt:
Ships a policies file that turns off its telemetry and update checks.
Sources
firefox-esr-153.5.0.tar.xz(764.7 MiB)
sha25628714a7d4f9b38c7aafbe38022de7775a3d9cb3c1ebf19a567c26eb761e3410b
upstream: https://archive.mozilla.org/pub/firefox/releases/153.5.0esr/source/firefox-153.5.0esr.source.tar.xz
archive copy: sources-1/browsers--firefox-esr-153.5.0.tar.xz
Dependencies
Depends on: clang, lld, llvm, rust, cbindgen, nodejs, python3, nasm, unzip, pkgconf, gtk3, glib, pango, fontconfig, freetype2, dbus, wayland, libxkbcommon, mesa, libdrm, libX11, libxcb, libXext, libXfixes, libXrandr, libXcomposite, libXcursor, libXdamage, libXi, libICE, libSM, at-spi2-core, nss, nspr, icu, libevent, libffi, libjpeg-turbo, libvpx, libwebp, zlib, pixman, pipewire, libpulse, alsa-lib, ffmpeg, pciutils, hunspell-en.
Required by: no port names it.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
--disable-jemalloc, line 67: jemalloc (explained with the switches below)
Patches
build.sh applies these; kpkg applies nothing by itself.
fix-rust-target.patch— Inbuild/moz.configure/rust.configure, takes the rustc target from theRUST_TARGETenvironment variable instead of matching the C target (x86_64-pc-linux-musl) against rustc’s list of targets, and imports what that needs.glean-stub.patch— stub out some glean metricsplay stupid games, win `rustc-LLVM ERROR: out of memory`
lfs64.patch— Makes three places usestat,lstatandfstatrather than their*64forms:xpcom/io/nsLocalFileUnix.h, the base profiler’smozglue/baseprofiler/core/shared-libraries-linux.cc, and the sandbox broker’sSandboxBrokerUtils.h. musl’sstatis already 64-bit, and its headers spell the*64names only as macros, under_LARGEFILE64_SOURCE.musl-no-linux-prctl.patch— Drops#include <linux/prctl.h>from libwebrtc’srtc_base/platform_thread_types.cc. musl’s<sys/prctl.h>definesstruct prctl_mm_mapas well, and with both headers the compile fails on the redefinition.rust-lto-thin.patch— Inconfig/makefiles/rust.mk, links the Rust crates with thin LTO (-Clto=thin) instead of the default-Clto, and, on riscv64, with no LTO at all.sandbox-sched_setscheduler.patch— In the seccomp filters of the media plugin (GMP) and remote data decoder (RDD) processes, allowssched_setscheduleroutright. Upstream allows it for the calling thread and returnsEPERMfor any other thread id; the patch names Mozilla bug 1657849.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install firefox-esr'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/browsers/firefox-esr.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/browsers/firefox-esr
echo '28714a7d4f9b38c7aafbe38022de7775a3d9cb3c1ebf19a567c26eb761e3410b firefox-esr-153.5.0.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/firefox-esr
SRC=$SRC_ROOT/firefox-esr-153.5.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf firefox-esr-153.5.0.tar.xz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers series, _ver and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/fix-rust-target.patch"
patch -p1 -i "$PORT_SRC/glean-stub.patch"
patch -p1 -i "$PORT_SRC/lfs64.patch"
patch -p1 -i "$PORT_SRC/musl-no-linux-prctl.patch"
patch -p1 -i "$PORT_SRC/rust-lto-thin.patch"
patch -p1 -i "$PORT_SRC/sandbox-sched_setscheduler.patch"
_gcc_triple="--gcc-triple=$(gcc -dumpmachine)"
export CC=clang
export CXX=clang++
export CFLAGS="${CFLAGS/-std=gnu11/} $_gcc_triple"
export CXXFLAGS="$CXXFLAGS $_gcc_triple"
export LDFLAGS="$LDFLAGS $_gcc_triple"
export LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/lib/firefox-esr"
export RUSTFLAGS="-C target-feature=-crt-static"
export RUST_TARGET=x86_64-unknown-linux-musl
cat > "$SRC/rustc-dynamic" <<'EOF'
#!/bin/sh
rustc=$1
shift
exec "$rustc" "$@" -C target-feature=-crt-static
EOF
chmod 755 "$SRC/rustc-dynamic"
export RUSTC_WRAPPER="$SRC/rustc-dynamic"
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none
export MOZBUILD_STATE_PATH="$SRC/.mozbuild"
export MOZ_NOSPAM=1
export MOZ_BUILD_DATE="$(date -u -d "@$SOURCE_DATE_EPOCH" +%Y%m%d%H%M%S)"
cat > mozconfig <<EOF
ac_add_options --prefix=/usr
ac_add_options --with-app-name=firefox-esr
ac_add_options MOZ_APP_REMOTINGNAME=firefox-esr
ac_add_options --enable-official-branding
ac_add_options --enable-update-channel=esr
ac_add_options --with-distribution-id=org.kdos
ac_add_options MOZ_TELEMETRY_REPORTING=
ac_add_options --enable-application=browser
ac_add_options --enable-default-toolkit=cairo-gtk3-x11-wayland
ac_add_options --enable-release
ac_add_options --enable-optimize=-O2
ac_add_options --enable-hardening
ac_add_options --enable-linker=lld
ac_add_options --with-libclang-path=/usr/lib
ac_add_options --without-wasm-sandboxed-libraries
ac_add_options --disable-bootstrap
ac_add_options --disable-cargo-incremental
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
ac_add_options --disable-eme
ac_add_options --disable-jemalloc
ac_add_options --disable-necko-wifi
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --disable-tests
ac_add_options --disable-strip
ac_add_options --disable-install-strip
ac_add_options --enable-dbus
ac_add_options --enable-alsa
ac_add_options --enable-pulseaudio
ac_add_options --disable-jack
ac_add_options --disable-sndio
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-icu
ac_add_options --with-system-ffi
ac_add_options --with-system-libevent
ac_add_options --with-system-jpeg
ac_add_options --with-system-libvpx
ac_add_options --with-system-webp
ac_add_options --with-system-zlib
ac_add_options --with-system-pixman
ac_add_options --with-system-pipewire
ac_add_options --with-system-gbm
ac_add_options --with-system-libdrm
mk_add_options MOZ_OBJDIR=$SRC/obj
EOF
export MOZCONFIG="$SRC/mozconfig"
./mach build
DESTDIR="$PKG" ./mach install
_app=/usr/lib/firefox-esr
if [ -f "$PKG$_app/firefox-esr-bin" ] && [ ! -L "$PKG$_app/firefox-esr-bin" ]; then
ln -sf firefox-esr "$PKG$_app/firefox-esr-bin"
fi
install -d "$PKG$_app/distribution"
cat > "$PKG$_app/distribution/policies.json" <<'EOF'
{
"policies": {
"DisableTelemetry": true,
"DisableFirefoxStudies": true,
"DisableRemoteImprovements": true,
"DisableAppUpdate": true,
"DisableSystemAddonUpdate": true,
"DisableFeedbackCommands": true,
"DisableFirefoxAccounts": true,
"DontCheckDefaultBrowser": true,
"CaptivePortal": false,
"DNSOverHTTPS": { "Enabled": false, "Locked": true },
"NetworkPrediction": false,
"SearchSuggestEnabled": false,
"IPProtectionAvailable": false,
"SkipTermsOfUse": true,
"OverrideFirstRunPage": "",
"OverridePostUpdatePage": "",
"AIControls": { "Default": { "Value": "blocked", "Locked": true } },
"FirefoxHome": {
"Weather": false,
"SponsoredTopSites": false,
"Pocket": false,
"Stories": false,
"SponsoredPocket": false,
"SponsoredStories": false
},
"FirefoxSuggest": {
"WebSuggestions": false,
"SponsoredSuggestions": false,
"ImproveSuggest": false,
"OnlineEnabled": false
},
"UserMessaging": {
"WhatsNew": false,
"ExtensionRecommendations": false,
"FeatureRecommendations": false,
"UrlbarInterventions": false,
"SkipOnboarding": true,
"MoreFromMozilla": false,
"FirefoxLabs": false
}
}
}
EOF
cat > "$PKG$_app/distribution/distribution.ini" <<'EOF'
[Global]
id=kdos
version=1.0
about=Firefox ESR for KDOS
[Preferences]
app.distributor="kdos"
app.distributor.channel="firefox-esr"
EOF
install -d "$PKG$_app/browser/defaults/preferences"
cat > "$PKG$_app/browser/defaults/preferences/kdos.js" <<'EOF'
pref("spellchecker.dictionary_path", "/usr/share/hunspell");
pref("widget.use-xdg-desktop-portal.file-picker", 1);
pref("media.gmp-manager.updateEnabled", false);
pref("media.gmp-gmpopenh264.enabled", false);
pref("media.gmp-gmpopenh264.visible", false);
pref("browser.newtabpage.activity-stream.telemetry", false);
pref("datareporting.healthreport.uploadEnabled", false);
pref("datareporting.usage.uploadEnabled", false);
pref("browser.region.network.url", "");
pref("browser.region.update.enabled", false);
pref("geo.provider.network.url", "");
pref("geo.provider.use_geoclue", false);
pref("app.normandy.enabled", false);
pref("app.normandy.api_url", "");
pref("app.shield.optoutstudies.enabled", false);
pref("network.connectivity-service.enabled", false);
EOF
for _png in browser/branding/official/default*.png; do
_s=${_png##*/default}
_s=${_s%.png}
install -Dm644 "$_png" "$PKG/usr/share/icons/hicolor/${_s}x${_s}/apps/firefox-esr.png"
done
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/firefox-esr.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Firefox
GenericName=Web Browser
Comment=Browse the World Wide Web
Exec=firefox-esr %u
Icon=firefox-esr
Terminal=false
StartupNotify=true
StartupWMClass=firefox-esr
Categories=Network;WebBrowser;
Keywords=web;browser;internet;www;http;firefox;
MimeType=text/html;application/xhtml+xml;x-scheme-handler/http;x-scheme-handler/https;
Actions=new-window;new-private-window;
[Desktop Action new-window]
Name=New Window
Exec=firefox-esr --new-window %u
[Desktop Action new-private-window]
Name=New Private Window
Exec=firefox-esr --private-window %u
EOF
chmod 644 "$PKG/usr/share/applications/firefox-esr.desktop"
The switches, and why each is set:
CC=clang,CXX=clang++— Mozilla builds with clang; the C++ parts of the Rust crates are compiled by clang as well.--gcc-triple=$(gcc -dumpmachine)— Added toCFLAGS,CXXFLAGSandLDFLAGS. Thecccrate passes clang Rust’s own target,x86_64-unknown-linux-musl, and clang then looks for a gcc installation under that name, finds none, and loses the C++ headers; naming gcc’s triple points the search at gcc’s own installation (see an LLVM that guessed its triple).${CFLAGS/-std=gnu11/}— Removes the tree’s-std=gnu11fromCFLAGS, so each C source is compiled with the standard Mozilla’s build gives it.-Wl,-rpath,/usr/lib/firefox-esr— A run path into the program’s private directory. The launcher loadslibxul.soand its neighbours there by full path, and musl, unlike glibc, does not take an already-loaded library for a bare-nameDT_NEEDED, so without it libxul fails to load (see a private library loaded by full path, then not found).-C target-feature=-crt-static,RUSTC_WRAPPER— Rust’s musl target links statically by default, and a statically linked build script cannot load libclang for bindgen.RUSTFLAGSturns static linking off, but mach always passes--target, and cargo then givesRUSTFLAGSto the target’s crates alone; therustc-dynamicwrapper appends the same flag to every rustc call, build scripts included (see Rust with a binding generator).RUST_TARGET=x86_64-unknown-linux-musl— The Rust target, read byfix-rust-target.patch.MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none— Mach installs none of its Python dependencies into a virtual environment with pip, which would need the network, and checks none against the system; it runs on the packages vendored in the source tree.MOZBUILD_STATE_PATH— Mach’s state directory,~/.mozbuildby default, kept inside the source tree instead.MOZ_NOSPAM=1— No desktop notification when the build finishes.MOZ_BUILD_DATE— The 14-digit build ID compiled into the program. It is taken fromSOURCE_DATE_EPOCH, so two builds of the same recipe carry the same ID; without it Mozilla uses the time of the build.--with-app-name=firefox-esr,MOZ_APP_REMOTINGNAME=firefox-esr— The program’s name, and its internal name, which is the Wayland app id and the profile and remoting name. With an update channel other thanreleasethe remoting name would default tofirefox-esr-esr. The binary,/usr/lib/firefox-esr, the desktop entry, the app id andStartupWMClassall carry the one name, so the panel finds the entry for the window.--enable-official-branding— Build with the Firefox name and logo frombrowser/branding/officialrather than the unbranded artwork. Mozilla’s help text for the switch asks that such builds be distributed only with permission under its trademark policy.--enable-update-channel=esr— Build for the ESR channel rather thandefault.--with-distribution-id=org.kdos— The distribution id,org.mozillaby default.MOZ_TELEMETRY_REPORTING=— Empty, so telemetry reporting is compiled out.--enable-application=browser,--enable-default-toolkit=cairo-gtk3-x11-wayland— Build the browser on GTK 3 with both the Wayland and X11 backends.--enable-release,--enable-optimize=-O2,--enable-hardening— Release configuration, compiled at-O2, with Mozilla’s hardening flags. Release is the default for a release or beta milestone, which an ESR is, and hardening is on unless it is disabled; both are named so neither rests on a default.--enable-linker=lld— Link with LLVM’s lld.--with-libclang-path=/usr/lib— Where bindgen findslibclang.so.--without-wasm-sandboxed-libraries— Compile in none of the libraries Mozilla runs inside a WebAssembly sandbox (graphite, ogg, hunspell, expat, woff2 and soundtouch, by default). That build needs a WASI sysroot and a compiler for the wasm32-wasi target, which no port provides; the libraries are linked as ordinary code instead.--disable-bootstrap— Mach downloads no toolchains of its own.--disable-cargo-incremental— No incremental Rust compilation.--disable-crashreporter,--disable-updater— No crash reporter and no updater; the package manager updates the program.--disable-eme— No Encrypted Media Extensions, the hook through which Firefox downloads and runs the closed Widevine module for protected video.--disable-jemalloc— Use the C library’smallocrather than Mozilla’s jemalloc, which is the default on Linux.--disable-necko-wifi— No Wi-Fi scanner in the network library.--disable-debug,--disable-debug-symbols,--disable-tests— No debug build, no debugging information, and none of the test libraries and programs.--disable-strip,--disable-install-strip— Mozilla does not strip anything itself; kpkg’s own symbol policy applies to the package (see size and language policy).--enable-dbus,--enable-alsa,--enable-pulseaudio— D-Bus, and sound through ALSA and through the PulseAudio API, whichpipewire-pulseserves (see audio).--disable-jack,--disable-sndio— No JACK or sndio audio backend, so sound goes only through the PulseAudio and ALSA backends above. sndio is not a port; the JACK library is pipewire’spipewire-jack, which Firefox is then not built against.--with-system-nspr,--with-system-nss,--with-system-icu,--with-system-ffi,--with-system-libevent,--with-system-jpeg,--with-system-libvpx,--with-system-webp,--with-system-zlib,--with-system-pixman,--with-system-pipewire,--with-system-gbm,--with-system-libdrm— Link the tree’s own ports of these libraries instead of compiling the copies in Mozilla’s source.MOZ_OBJDIR=$SRC/obj— The object directory, inside the source tree.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/firefox-esr, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf firefox-esr-153.5.0-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/firefox-esr, and runs the triggers its paths call for.
Contents
Installed programs: firefox-esr.
Installed directories: /usr/lib/firefox-esr/browser, /usr/lib/firefox-esr/defaults, /usr/lib/firefox-esr/fonts, /usr/lib/firefox-esr/gmp-clearkey, /usr/share/licenses/firefox-esr.
Notes
After mach install, build.sh adds what makes the package KDOS’s:
distribution/policies.json, Firefox’s enterprise policies, which turn off telemetry, studies, remote improvements, application and system add-on updates, the feedback commands, Firefox accounts, the default-browser check, captive portal detection, network prediction, search suggestions, IP Protection, the terms-of-use prompt, the first-run and post-update pages, the weather, sponsored and recommended content on the new tab page and in the address bar, Mozilla’s messaging and onboarding, and lock DNS over HTTPS off.AIControlsblocks and locks every AI feature, translation and the chatbot among them; it supersedes the olderTranslateEnabledandGenerativeAIpolicies, which the file therefore leaves out, since Firefox logs “Ignoring … policy in favor of AIControls” at every start for each one present;distribution/distribution.ini, naming the distributor;browser/defaults/preferences/kdos.js, which points the spelling checker at the hunspell-en dictionaries in/usr/share/hunspell, opens files through the desktop’s FileChooser portal, and turns off the media plugin downloads (OpenH264) and the remaining data reporting. It also emptiesbrowser.region.network.url, setsbrowser.region.update.enabledto false, emptiesgeo.provider.network.urland setsgeo.provider.use_geoclueto false. Without the first two Firefox asks Mozilla’s region service at its first start, and again on a timer, and setsbrowser.search.regionfrom the machine’s IP address. Without the last two a page granted the user’s location is answered first by geoclue, on the base forxdg-desktop-portal, whose wifi source asks BeaconDB and falls back to the IP address, and then by Google’s geolocation service, the defaultgeo.provider.network.url. With all four the region follows the locale and Firefox has no network location source, so a page’s location request fails. It setsapp.normandy.enabledandapp.shield.optoutstudies.enabledto false and emptiesapp.normandy.api_url: the policies already turn studies off, and the prefs leave Normandy’s recipe client nothing to fetch when its timer fires. It setsnetwork.connectivity-service.enabledto false, which stops the network connectivity service’s probes ofdetectportal.firefox.com,example.org,cloudflare-dns.comandipv4only.arpaat start and on every network change;CaptivePortalturns off only the captive-portal check, a separate service. Safe Browsing stays on, so Firefox keeps its malware, phishing and tracking-protection lists current fromsafebrowsing.googleapis.comandshavar.services.mozilla.com; those requests carry list versions and hash prefixes, not the pages visited. Remote settings stay on (firefox.settings.services.mozilla.comand its attachments CDN): they carry the certificate revocations, intermediate certificates and add-on blocklist, andDisableRemoteSettingsAndAcceptSecurityConsequenceswould stop those updates while its attachment downloads still contact the server. The push connection (push.services.mozilla.com) stays on for site notifications, and the add-on update check (services.addons.mozilla.org,versioncheck-bg.addons.mozilla.org) stays on so an add-on with a known vulnerability is updated; it runs on its own timer on a fresh profile too, with no add-on of the user’s installed. The Welcome tour’s Privacy page says that KDOS itself phones home for nothing and describes each of these connections, without the host names;- the branding PNGs installed as
firefox-esricons in hicolor, andfirefox-esr.desktop, named plainFirefox.
When mach install leaves firefox-esr-bin as a second copy of the program, it is replaced with a link to firefox-esr.
The recipe’s series key keeps ports/update offering only releases on the ESR line it names.