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

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

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.

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 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:

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.