Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

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

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.

Patches

build.sh applies these; kpkg applies nothing by itself.

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:

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:

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.