301.3. thunderbird-153.5.0
Mail, calendar, contacts and feeds, offline-first, on GTK 3 for Wayland and X11
The build-state snapshot was taken from 153.5.0-1; this recipe is 153.5.0-2, so the size, time and contents below describe the earlier build.
| Version | 153.5.0, release 2 |
| Shelf | mail — Email clients, fetch and send tools, mail libraries, and feed readers |
| Phase | 44_apps (Applications), 277 of 422 in build order |
| Licence | MPL-2.0 |
| Homepage | https://www.thunderbird.net/ |
| Build time | 793.8 SBU |
| Installed size | 285.9 MiB in 60 files |
| Recipe | ports/core/mail/thunderbird/kpkgbuild |
About
Thunderbird is Mozilla’s mail, calendar, address-book, chat and feed client, built from its extended-support release on the same Gecko engine as firefox-esr. It is the graphical mail client of KDOS and the default handler for mailto: links, message/rfc822 and text/calendar in /usr/share/kdos/xdg/kde-mimeapps.list. It reaches the network for the accounts, calendars and feeds it is given. The paths that reach the network on their own (update checks, telemetry, add-on updates, the start page, captive-portal and connectivity probes, safe-browsing lists) are off, by build switch where one exists and by default prefs and policies where none does.
Why it is in KDOS
The comment above it in script/phases/44_apps/packages.d/mail.txt:
Ships a policies file that turns off its telemetry and update checks.
Sources
thunderbird-153.5.0.tar.xz(891.1 MiB)
sha256f29c5ba3acdf3e756e87f23d30c814c1ad70093a4fb5b383fdf9c51e21cc0baf
upstream: https://archive.mozilla.org/pub/thunderbird/releases/153.5.0esr/source/thunderbird-153.5.0esr.source.tar.xz
archive copy: sources-3/mail--thunderbird-153.5.0.tar.xz
Dependencies
Depends on: clang, lld, llvm, rust, cbindgen, nodejs, nasm, python3, m4, pkgconf, zip, unzip, gtk3, glib, pango, cairo, fontconfig, freetype2, at-spi2-core, wayland, libxkbcommon, libX11, libxcb, libXext, libXfixes, libXrandr, libXcomposite, libXcursor, libXdamage, libXi, dbus, alsa-lib, libpulse, pipewire, mesa, libdrm, pciutils, libva, ffmpeg, nspr, nss, libjpeg-turbo, libwebp, libvpx, libevent, libffi, zlib, bzip2, json-c, pixman, hunspell-en, hyphen.
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 (explained with the switches below)
Patches
build.sh applies these; kpkg applies nothing by itself.
fix-libresolv-path.patch— on Linux,comm/mail/modules/DNS.worker.mjslooks for the resolver functions inlibcinstead oflibresolv.so.9,libresolv.so.2orlibresolv.so. musl’s resolver is part of its C library, so account setup’s SRV and MX lookups would otherwise find no library.fix-rust-target.patch— inbuild/moz.configure/rust.configure, take the Rust target from theRUST_TARGETenvironment variable instead of matching the C triple againstrustc --print target-list.x86_64-pc-linux-muslmatches bothx86_64-unknown-linux-muslandx86_64-unikraft-linux-musl, and configure refuses the pair as ambiguous.glean-stub.patch— stub out some glean metricsplay stupid games, win `rustc-LLVM ERROR: out of memory`
lfs64.patch— usestatandlstatinstead ofstat64andlstat64inxpcom/io/nsLocalFileUnix.hand in the sandbox broker’sSandboxBrokerUtils.h, and take the 64-bit branch in the base profiler’sshared-libraries-linux.cc. musl has nostat64; itsstatis already 64-bit.metainfo.patch— add<launchable type="desktop-id">thunderbird.desktop</launchable>to the AppStream file, tying it to the desktop entrybuild.shwrites.musl-no-linux-prctl.patch— drop#include <linux/prctl.h>from libwebrtc’splatform_thread_types.cc, keeping<sys/prctl.h>. musl’s<sys/prctl.h>and the kernel’s header both definestruct prctl_mm_map, and the second definition stops the compile.rust-lto-thin.patch— inconfig/makefiles/rust.mk, link the top-level Rust library with-Clto=thininstead of full LTO, and skip LTO on riscv64. Together withglean-stub.patchit keeps the Rust link within a build machine’s memory.sandbox-sched_setscheduler.patch— allowsched_setschedulerwhatever thread it names in the media plugin (GMP) and remote data decoder (RDD) sandbox policies. Upstream allows it only for the calling thread and answers any other thread id withEPERM; musl’spthread_setschedparammakes the call with the target thread’s id.
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 thunderbird'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/mail/thunderbird.
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/mail/thunderbird
echo 'f29c5ba3acdf3e756e87f23d30c814c1ad70093a4fb5b383fdf9c51e21cc0baf thunderbird-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/thunderbird
SRC=$SRC_ROOT/thunderbird-153.5.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf thunderbird-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 _esr 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"
patch -p1 -i "$PORT_SRC/fix-libresolv-path.patch"
patch -p1 -i "$PORT_SRC/metainfo.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/thunderbird"
export AR=llvm-ar
export NM=llvm-nm
export RANLIB=llvm-ranlib
export RUST_TARGET=x86_64-unknown-linux-musl
unset MOZILLA_OFFICIAL MOZ_TELEMETRY_REPORTING
export RUSTFLAGS="-C target-feature=-crt-static"
cat > "$SRC_ROOT/rustc-dynamic" <<'EOF'
#!/bin/sh
rustc=$1
shift
exec "$rustc" "$@" -C target-feature=-crt-static
EOF
chmod 755 "$SRC_ROOT/rustc-dynamic"
export RUSTC_WRAPPER="$SRC_ROOT/rustc-dynamic"
export MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none
export MOZBUILD_STATE_PATH="$SRC_ROOT/mozbuild"
export MOZ_NOSPAM=1
export SHELL=/bin/sh
MOZ_BUILD_DATE=$(date -u -d "@$SOURCE_DATE_EPOCH" +%Y%m%d%H%M%S)
export MOZ_BUILD_DATE
cat > mozconfig <<CONF
ac_add_options --enable-application=comm/mail
ac_add_options --prefix=/usr
ac_add_options --enable-default-toolkit=cairo-gtk3-x11-wayland
ac_add_options --enable-official-branding
ac_add_options --enable-update-channel=release
ac_add_options --with-distribution-id=org.kdos
ac_add_options --with-unsigned-addon-scopes=app,system
ac_add_options --disable-bootstrap
ac_add_options --disable-crashreporter
ac_add_options --disable-updater
ac_add_options --disable-tests
ac_add_options --disable-debug
ac_add_options --disable-debug-symbols
ac_add_options --disable-strip
ac_add_options --disable-install-strip
ac_add_options --disable-jemalloc
ac_add_options --disable-necko-wifi
ac_add_options --disable-cargo-incremental
ac_add_options --without-wasm-sandboxed-libraries
ac_add_options --enable-release
ac_add_options --enable-optimize
ac_add_options --enable-hardening
ac_add_options --enable-linker=lld
ac_add_options --with-libclang-path=/usr/lib
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-jpeg
ac_add_options --with-system-webp
ac_add_options --with-system-libvpx
ac_add_options --with-system-libevent
ac_add_options --with-system-ffi
ac_add_options --with-system-zlib
ac_add_options --with-system-pixman
ac_add_options --with-system-jsonc
ac_add_options --with-system-bz2
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
CONF
export MOZCONFIG="$SRC/mozconfig"
_jobs=${MAKEFLAGS#-j}
unset MAKEFLAGS
./mach build ${_jobs:+-j"$_jobs"}
DESTDIR="$PKG" ./mach install
_app=/usr/lib/thunderbird
install -Dm644 /dev/stdin "$PKG$_app/defaults/pref/kdos-prefs.js" <<'PREFS'
pref("intl.locale.requested", "");
pref("spellchecker.dictionary_path", "/usr/share/hunspell");
pref("mail.shell.checkDefaultMail", false);
pref("mailnews.start_page.enabled", false);
pref("app.update.auto", false);
pref("extensions.update.enabled", false);
pref("extensions.update.autoUpdateDefault", false);
pref("extensions.getAddons.cache.enabled", false);
pref("datareporting.healthreport.uploadEnabled", false);
pref("datareporting.policy.dataSubmissionEnabled", false);
pref("toolkit.telemetry.enabled", false);
pref("toolkit.telemetry.unified", false);
pref("toolkit.telemetry.archive.enabled", false);
pref("network.captive-portal-service.enabled", false);
pref("network.connectivity-service.enabled", false);
pref("browser.safebrowsing.malware.enabled", false);
pref("browser.safebrowsing.phishing.enabled", false);
pref("browser.safebrowsing.downloads.remote.enabled", false);
PREFS
install -Dm644 /dev/stdin "$PKG$_app/distribution/policies.json" <<'POLICIES'
{
"policies": {
"DisableAppUpdate": true,
"DisableTelemetry": true,
"ExtensionUpdate": false
}
}
POLICIES
ln -sfn /usr/share/hunspell "$PKG$_app/dictionaries"
ln -sfn /usr/share/hyphen "$PKG$_app/hyphenation"
_brand=comm/mail/branding/thunderbird
for s in 16 22 24 32 48 64 128 256; do
install -Dm644 "$_brand/default$s.png" \
"$PKG/usr/share/icons/hicolor/${s}x$s/apps/thunderbird.png"
done
install -Dm644 "$_brand/net.thunderbird.Thunderbird.appdata.xml" \
"$PKG/usr/share/metainfo/net.thunderbird.Thunderbird.appdata.xml"
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/thunderbird.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Thunderbird
GenericName=Mail, Calendar and Contacts
Comment=Read and write mail, keep a calendar and address book, follow feeds
Exec=thunderbird %u
Icon=thunderbird
Terminal=false
StartupWMClass=thunderbird
Categories=Network;Email;Calendar;ContactManagement;Feed;
MimeType=message/rfc822;x-scheme-handler/mailto;text/calendar;text/vcard;text/x-vcard;
Keywords=mail;email;e-mail;calendar;contacts;address book;feeds;rss;news;imap;smtp;
DESKTOP
chmod 644 "$PKG/usr/share/applications/thunderbird.desktop"
The switches, and why each is set:
CC=clang— withCXX=clang++,AR=llvm-ar,NM=llvm-nm,RANLIB=llvm-ranliband--enable-linker=lld: Gecko is compiled with clang and linked with lld rather than the phase’s gcc. Its Rust bindings are generated through libclang, and Mozilla builds its own Linux releases with clang. The phase’s-std=gnu11is cut out ofCFLAGS, because mozbuild sets each C file’s standard itself.--gcc-triple=$(gcc -dumpmachine)— added toCFLAGS,CXXFLAGSandLDFLAGS. Rust’scccrate hands clang--target=x86_64-unknown-linux-musl, and clang then looks for gcc’s headers and libstdc++ under that triple; naming gcc’s own triple finds them. Without it the build stops on'new' file not foundunderdist/system_wrappers; see An LLVM that guessed its triple.-Wl,-rpath,/usr/lib/thunderbird— a run path into the program’s private library directory.libxul.sonameslibmozsandbox.so,libgkcodecs.soand its other siblings by bare name; the launcher loads them by full path first, but musl does not reuse an already-loaded library for a bare-nameDT_NEEDED, so without the run path libxul fails to load; see A private library loaded by full path, then not found.RUST_TARGET=x86_64-unknown-linux-musl— the Rust target, read byfix-rust-target.patch.RUSTFLAGS="-C target-feature=-crt-static"— withRUSTC_WRAPPER, which points at a small script that runs rustc with the same flag appended: link the Rust code against the shared musl. mach always passes cargo--target, and cargo then givesRUSTFLAGSto the target’s crates only, so build scripts, bindgen’s among them, would still link statically; every rustc call goes through the wrapper. See Rust with a binding generator.MACH_BUILD_PYTHON_NATIVE_PACKAGE_SOURCE=none— mach builds its virtualenv from the packages vendored underthird_party/pythonand installs nothing more into it, so no pip reaches the network.MOZBUILD_STATE_PATHkeeps mach’s state directory inside the build tree.MOZ_NOSPAM=1— skip the desktop notification mach sends throughnotify-sendwhen a build finishes. The build chroot has no desktop session to show one on, and a notification that cannot be sent ends the build log with aNotification center failedwarning.MOZ_BUILD_DATE— the build ID, a timestamp compiled into the binary and written into every profile’scompatibility.ini. Taking it fromSOURCE_DATE_EPOCHmakes two builds of the recipe agree.--enable-application=comm/mail— build Thunderbird, the application undercomm/, rather than Firefox from the same tree.--enable-default-toolkit=cairo-gtk3-x11-wayland— compile in both of GTK 3’s display backends and link them, so a missing X11 library is a configure error rather than a build with Wayland only. GDK tries Wayland first; the X11 backend serves Xwayland.--enable-official-branding— the Thunderbird name and artwork undercomm/mail/branding/thunderbird, whichbuild.shinstalls the icons and AppStream file from.--enable-update-channel=releasesets the update channel toreleasein place of upstream’sdefault.--with-distribution-id=org.kdos— the distribution id compiled into the build, in place of upstream’s defaultorg.mozilla.--with-unsigned-addon-scopes=app,system— accept add-ons in the application and system scopes, the ones installed into the program’s own directory and the system’s extension directories, without a Mozilla signature.--disable-bootstrap— do not download or update toolchains; every compiler comes from the tree.--disable-crashreporter— with--disable-updater: no crash reporter and no self-updater; the program is updated as a package.--disable-tests— with--disable-debugand--disable-debug-symbols: no test programs and no debug information in the package.--disable-strip— with--disable-install-strip: Mozilla’s packaging strips nothing. What the package keeps is the tree’s size policy; see Size and language policy.--disable-jemalloc— run on musl’s allocator instead of Mozilla’s own mozjemalloc, which is unproven on musl.--disable-necko-wifi— leave out the Wi-Fi scanner of Necko, Gecko’s network library.--disable-cargo-incremental— compile the Rust code without cargo’s incremental cache, which serves only a rebuild in the same tree.--without-wasm-sandboxed-libraries— no RLBox sandboxing. It needs wasi-sdk, which the tree does not carry, so the libraries it would isolate (graphite, ogg, hunspell, expat, woff2, soundtouch) run in the content process as in any build without it.--enable-release— with--enable-optimizeand--enable-hardening: release-engineering options instead of developer ones, an optimised build, and Mozilla’s set of hardening compiler options.--enable-releasealso turns offDEVELOPER_OPTIONS, which is what letsconfig/makefiles/rust.mkrun link-time optimisation on the Rust library (seerust-lto-thin.patch).--with-libclang-path=/usr/lib— where bindgen findslibclang.so.--enable-dbus— with--enable-alsaand--enable-pulseaudio: D-Bus support and the ALSA and PulseAudio sound backends, the second reaching pipewire throughlibpulse.--disable-jackand--disable-sndioleave out the JACK and sndio backends; sndio is not a port.--with-system-nspr— and the--with-system-*switches after it (nss, jpeg, webp, libvpx, libevent, ffi, zlib, pixman, jsonc, bz2, pipewire, gbm, libdrm): link the tree’s library instead of the copy in the source.jsoncandbz2are for librnp, the in-tree OpenPGP library, which runs on the in-tree Botan. PNG stays in-tree: Mozilla’s configure refuses a system libpng without APNG support, which this one lacks. AV1 stays in-tree too, because--with-system-av1requires aom as well as dav1d, and aom is not a port. ICU stays in-tree as well, with no--with-system-icu. Mozilla’s copy carriesintl/icu-patches/bug-1790071-ICU-22132-standardize-vtzone-output.diff, which writes theX-TZINFO:property name before the zone id inVTimeZone::write(); the tree’s icu is upstream’s and writes a bareEurope/Berlin[2026a]line there. The calendar hands that text to ical.js for every zone but UTC, ical.js refuses the line, and calendar startup fails, leaving the main window without account setup, tabs or a working menu in any non-UTC time zone. Patching the tree’s icu instead would rebuild30_foundationand everything after it.MOZILLA_OFFICIAL— unset, together withMOZ_TELEMETRY_REPORTING, so no telemetry upload code is compiled in.MAKEFLAGS— unset after its job count is read off it: mach runs its own make, so the phase’s-jis handed to./mach buildinstead and is not read twice.
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/thunderbird, 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 thunderbird-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/thunderbird, and runs the triggers its paths call for.
Contents
Installed programs: thunderbird.
Installed directories: /usr/lib/thunderbird, /usr/share/licenses/thunderbird.
Notes
glean-stub.patch carries its own description. It empties the Glean telemetry functions for boolean, counter, event and string metrics and drops those metrics from the generated Rust code. With telemetry compiled out the stubbed metrics record nothing either way.
After the install, build.sh writes defaults/pref/kdos-prefs.js and distribution/policies.json under /usr/lib/thunderbird. A file under defaults/pref is read at every start and a user’s own prefs.js overrides it, so each line there is a default. The policies (no update check, no telemetry, no add-on update) are what the settings page cannot turn back on. The dictionaries and hyphenation directories are links to /usr/share/hunspell and /usr/share/hyphen, from hunspell-en and hyphen, so the spell checker shares its dictionaries with every other program.