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

125.2. shared-mime-info-2.5.1

The freedesktop.org shared MIME database and update-mime-database

Version 2.5.1, release 1
Shelf xdg — freedesktop desktop integration: portals, MIME, desktop entries, AppStream, tray and indicators, notifications, event sounds, script dialogs
Phase 41_system (System), 604 of 1047 in build order
Licence GPL-2.0-or-later
Homepage https://gitlab.freedesktop.org/xdg/shared-mime-info
Build time 0.5 SBU
Installed size 3.2 MiB in 8 files
Recipe ports/core/xdg/shared-mime-info/kpkgbuild

About

shared-mime-info is the freedesktop.org MIME database, the XML that says which file names and which contents make each type, and update-mime-database, which compiles every package’s XML under /usr/share/mime/packages into the caches programs read. GLib’s content-type lookup, and with it every GTK program, reads those caches, as do Qt, kdos-appbox and the file managers.

Sources

Dependencies

Depends on: glib, libxml2, gettext, meson, ninja.

Required by (33): akonadi, akonadi-mime, bluedevil, calligra, cantor, chemical-mime-data, gdk-pixbuf, gimp, glabels, gpxsee, gramps, gtk3, gtk4, itinerary, k3b, kbackup, kdepim-runtime, kdevelop, kdos-appbox, kio-extras, kitinerary, kiwix-desktop, kpkpass, krdc, krita, marble, massif-visualizer, palapeli, pencil2d, qt5-qtbase, qt6-qtbase, remmina, step.

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/41_system/phase.env && kpkg install shared-mime-info'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/xdg/shared-mime-info.

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/xdg/shared-mime-info
echo 'ea248ea157b7fa0165f4fe282c84919fa84c3f175553642f229c8f1ab7539128  shared-mime-info-2.5.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/shared-mime-info
SRC=$SRC_ROOT/shared-mime-info-2.5.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf shared-mime-info-2.5.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

meson setup build --prefix=/usr --sysconfdir=/etc --libdir=lib \
	--buildtype=release \
	-D update-mimedb=false \
	-D build-tools=true \
	-D build-tests=false \
	-D build-spec=false
meson compile -C build
DESTDIR=$PKG meson install --no-rebuild -C build

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/shared-mime-info, 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 shared-mime-info-2.5.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/shared-mime-info, and runs the triggers its paths call for.

Contents

Installed programs: update-mime-database.

Installed directories: /usr/share/licenses/shared-mime-info.

Short descriptions

update-mime-database a program to build the Shared MIME-Info database cache
shared-mime-info.pc Freedesktop common MIME database