303.7. librewolf-158.0.1
LibreWolf, the privacy-hardened Firefox fork, on GTK 3 with Wayland and X11
| Version | 158.0.1, release 1 |
| Shelf | browsers — Web, Gemini and text-mode browsers |
| Phase | 44_apps (Applications), 18 of 422 in build order |
| Licence | MPL-2.0 |
| Homepage | https://librewolf.net/ |
| Build time | 59.9 SBU |
| Installed size | 284.8 MiB in 43 files |
| Recipe | ports/core/browsers/librewolf/kpkgbuild |
About
LibreWolf is a fork of Firefox with telemetry removed and its privacy settings on by default. It is built from LibreWolf’s source tarball, which is Firefox’s source with LibreWolf’s patches, branding and settings already applied, and follows Firefox’s release line rather than the ESR one firefox-esr follows. The recipe is firefox-esr’s with LibreWolf’s names and LibreWolf’s own build options.
Sources
librewolf-158.0.1.tar.gz(1.1 GiB)
sha256ea2424fb4c02916c0c531210f1dd8b460e85074f2d8ca0529d49553d36dd13c0
upstream: https://librewolf.dev/api/packages/librewolf/generic/librewolf-source/158.0-1/librewolf-158.0-1.source.tar.gz
archive copy: sources-1/browsers--librewolf-158.0.1.tar.gz
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 70: jemalloc
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.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.musl-pthread-t.patch— In the vendoredaudio_thread_prioritycrate, serialises and deserialises the thread’spthread_tthroughusize, and updates the crate’s.cargo-checksum.jsonto match. musl’spthread_tis a pointer, which has noto_ne_bytesorfrom_ne_bytes; glibc’s is an integer.parakeet-cstdint.patch— Adds#include <cstdint>tothird_party/parakeet.cpp/src/backend.hpp, which declares functions takingint64_tbut includes only<cstddef>,<functional>,<string>and<vector>; none of these declares it with this tree’s C++ standard library, and the compile fails on the unknown type.rust-lto-thin.patch— Inconfig/makefiles/rust.mk, links the Rust crates with thin LTO,-Clto=thin, instead of-Clto.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 librewolf'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/browsers/librewolf.
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/librewolf
echo 'ea2424fb4c02916c0c531210f1dd8b460e85074f2d8ca0529d49553d36dd13c0 librewolf-158.0.1.tar.gz' | 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/librewolf
SRC=$SRC_ROOT/librewolf-158.0.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf librewolf-158.0.1.tar.gz -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 _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/musl-pthread-t.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"
patch -p1 -i "$PORT_SRC/parakeet-cstdint.patch"
_gcc_triple="--gcc-triple=$(gcc -dumpmachine)"
export CC=clang
export CXX=clang++
export CFLAGS="-ftrivial-auto-var-init=zero -fwrapv ${CFLAGS/-std=gnu11/} $_gcc_triple"
export CXXFLAGS="-ftrivial-auto-var-init=zero -fwrapv $CXXFLAGS $_gcc_triple"
export LDFLAGS="$LDFLAGS $_gcc_triple"
export LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/lib/librewolf"
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 > "$SRC/kdos.mozconfig" <<EOF
ac_add_options --prefix=/usr
ac_add_options --with-app-name=librewolf
ac_add_options --with-branding=browser/branding/librewolf
ac_add_options MOZ_APP_REMOTINGNAME=librewolf
ac_add_options --with-distribution-id=org.kdos
ac_add_options MOZ_TELEMETRY_REPORTING=
ac_add_options MOZ_REQUIRE_SIGNING=
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-stl-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
mk_add_options MOZ_CRASHREPORTER=0
mk_add_options MOZ_DATA_REPORTING=0
mk_add_options MOZ_SERVICES_HEALTHREPORT=0
mk_add_options MOZ_TELEMETRY_REPORTING=0
EOF
export MOZCONFIG="$SRC/kdos.mozconfig"
./mach build
DESTDIR="$PKG" ./mach install
_app=/usr/lib/librewolf
if [ -f "$PKG$_app/librewolf-bin" ] && [ ! -L "$PKG$_app/librewolf-bin" ]; then
ln -sf librewolf "$PKG$_app/librewolf-bin"
fi
install -d "$PKG$_app/distribution"
cat > "$PKG$_app/distribution/policies.json" <<'EOF'
{
"policies": {
"DisableTelemetry": true,
"DisableFirefoxStudies": true,
"DisableRemoteImprovements": true,
"DisableRemoteSettingsAndAcceptSecurityConsequences": true,
"DisableAppUpdate": true,
"AppUpdateURL": "https://localhost",
"DisableSystemAddonUpdate": true,
"DisableDefaultBrowserAgent": true,
"DisableFeedbackCommands": true,
"DisableFirefoxAccounts": true,
"DontCheckDefaultBrowser": true,
"CaptivePortal": false,
"DNSOverHTTPS": { "Enabled": false, "Locked": true },
"NetworkPrediction": false,
"SearchSuggestEnabled": false,
"IPProtectionAvailable": false,
"SkipTermsOfUse": true,
"NoDefaultBookmarks": true,
"HttpsOnlyMode": "enabled",
"EncryptedMediaExtensions": { "Enabled": false },
"ContentAnalysis": {
"Enabled": false,
"InterceptionPoints": {
"Clipboard": { "Enabled": false },
"ClipboardCopy": { "Enabled": false },
"Download": { "Enabled": false },
"DragAndDrop": { "Enabled": false },
"FileUpload": { "Enabled": false },
"Print": { "Enabled": false }
}
},
"LocalNetworkAccess": {
"Enabled": true,
"BlockTrackers": true,
"EnablePrompting": true
},
"OverrideFirstRunPage": "",
"OverridePostUpdatePage": "",
"AIControls": { "Default": { "Value": "blocked", "Locked": true } },
"ExtensionSettings": {
"*": {
"blocked_install_message": "LibreWolf does not allow installing Language Packs.",
"installation_mode": "allowed",
"allowed_types": ["dictionary", "extension", "sitepermission", "theme"]
}
},
"FirefoxHome": {
"Weather": false,
"TopSites": false,
"SponsoredTopSites": false,
"Highlights": 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
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);
EOF
for _png in browser/branding/librewolf/default*.png; do
_s=${_png##*/default}
_s=${_s%.png}
install -Dm644 "$_png" "$PKG/usr/share/icons/hicolor/${_s}x${_s}/apps/librewolf.png"
done
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/librewolf.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=LibreWolf
GenericName=Web Browser
Comment=Browse the World Wide Web with privacy protections on
Exec=librewolf %u
Icon=librewolf
Terminal=false
StartupNotify=true
StartupWMClass=librewolf
Categories=Network;WebBrowser;
Keywords=web;browser;internet;www;http;librewolf;
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=librewolf --new-window %u
[Desktop Action new-private-window]
Name=New Private Window
Exec=librewolf --private-window %u
EOF
chmod 644 "$PKG/usr/share/applications/librewolf.desktop"
install -d "$PKG/usr/share/metainfo"
cat > "$PKG/usr/share/metainfo/librewolf.metainfo.xml" <<'EOF'
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>librewolf.desktop</id>
<metadata_license>CC0-1.0</metadata_license>
<project_license>MPL-2.0</project_license>
<name>LibreWolf</name>
<summary>Browse the World Wide Web with privacy protections on</summary>
<developer id="net.librewolf">
<name>LibreWolf Community</name>
</developer>
<description>
<p>
LibreWolf is a web browser built from Firefox, with telemetry removed and its
privacy and security settings on from the first start.
</p>
<p>
It blocks trackers, opens sites over HTTPS only, and sends no usage data,
studies or crash reports.
</p>
</description>
<launchable type="desktop-id">librewolf.desktop</launchable>
<url type="homepage">https://librewolf.net/</url>
<categories>
<category>Network</category>
<category>WebBrowser</category>
</categories>
<content_rating type="oars-1.1"/>
</component>
EOF
chmod 644 "$PKG/usr/share/metainfo/librewolf.metainfo.xml"
The switches, and why each is set:
The switches this build shares with firefox-esr (the toolchain, the Rust target and wrapper, the run path, the mach variables, the feature switches and the system libraries) do the same thing here and are explained on firefox-esr’s page. These are the ones that differ.
-ftrivial-auto-var-init=zero,-fwrapv— Added to the front ofCFLAGSandCXXFLAGS. The first has clang fill every automatic variable that is not initialised with zeros; the second makes signed integer overflow wrap instead of leaving it undefined, so the optimiser cannot assume it never happens. Both come from themozconfigLibreWolf ships in its tarball.-Wl,-rpath,/usr/lib/librewolf— The run path into the program’s private directory, for the same musl reason as firefox-esr’s.--with-app-name=librewolf,MOZ_APP_REMOTINGNAME=librewolf— The program’s name and its internal name, which is the Wayland app id. LibreWolf’s ownmozconfigsets the remoting name toLibreWolf; here it is the same lower-case name as the binary,/usr/lib/librewolf, the desktop entry andStartupWMClass, so the panel finds the entry for the window.--with-branding=browser/branding/librewolf— LibreWolf’s name and artwork.MOZ_REQUIRE_SIGNING=— Empty, so the build does not enforce that add-ons are signed by the trusted root. LibreWolf’smozconfigsets it the same way.--enable-stl-hardening— Turns on the C++ standard library’s hardening checks, as LibreWolf’smozconfigdoes.MOZ_CRASHREPORTER=0,MOZ_DATA_REPORTING=0,MOZ_SERVICES_HEALTHREPORT=0,MOZ_TELEMETRY_REPORTING=0— Set for make throughmk_add_options, as in LibreWolf’smozconfig: no crash reporter, data reporting, health report or telemetry.
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/librewolf, 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 librewolf-158.0.1-1.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/librewolf, and runs the triggers its paths call for.
Contents
Installed programs: librewolf.
Installed directories: /usr/lib/librewolf/browser, /usr/lib/librewolf/defaults, /usr/lib/librewolf/fonts, /usr/lib/librewolf/gmp-clearkey, /usr/share/licenses/librewolf.
Notes
The configuration is written to $SRC/kdos.mozconfig and named by MOZCONFIG, so the mozconfig LibreWolf ships at the top of its tarball is left as it is and not read. That file’s other choices are therefore not in this build: it uses jemalloc with a replaceable allocator (this build passes --disable-jemalloc), enables Rust SIMD and proxy bypass protection, disables the default-browser agent at build time, sets the release update channel and MOZILLA_OFFICIAL=1, and points --with-l10n-base at its bundled translations.
The policies file adds to firefox-esr’s: remote settings off (DisableRemoteSettingsAndAcceptSecurityConsequences, which also stops the certificate-revocation and add-on blocklist updates firefox-esr keeps), no default bookmarks, HTTPS-only mode, no Encrypted Media Extensions, content analysis off at every interception point, local network access protection on, with trackers blocked and a prompt, an update URL of https://localhost, no default-browser agent, language packs refused as extensions, and the new-tab top sites and highlights off. Like firefox-esr’s, it blocks and locks every AI feature, translation among them, through AIControls alone and leaves out the older TranslateEnabled and GenerativeAI policies, which the browser ignores beside AIControls with an “Ignoring … policy in favor of AIControls” line at every start. kdos.js keeps only the spelling dictionary path and the portal file chooser, and no distribution.ini is written.
The source tarball ships no AppStream metainfo of LibreWolf’s own, only Firefox’s flatpak templates under browser/installer/linux/app/flatpak, so build.sh writes /usr/share/metainfo/librewolf.metainfo.xml beside the desktop entry. Discover’s author line and the description on the program’s page come only from a metainfo file the package installs; with the desktop entry alone the catalogue component has no <developer> and Discover says “Unknown author”. The component id is librewolf.desktop, the id the catalogue gives the bare desktop entry, so the Discover entry keeps its identity. appstreamcli validate reports one warning for it, cid-desktopapp-is-not-rdns, and one pedantic hint, and exits non-zero on the warning; it reports no error, and a reverse-domain id would change the Discover entry’s id.