125.1. xdg-utils-1.2.1
Command line tools that assist applications with a variety of desktop integration tasks
| Version | 1.2.1, release 2 |
| Shelf | xdg — freedesktop desktop integration: portals, MIME, desktop entries, AppStream, tray and indicators, notifications, event sounds, script dialogs |
| Phase | 41_system (System), 42 of 1047 in build order |
| Licence | MIT |
| Homepage | https://gitlab.freedesktop.org/xdg/xdg-utils |
| Build time | 0.1 SBU |
| Installed size | 349.7 KiB in 17 files |
| Recipe | ports/core/xdg/xdg-utils/kpkgbuild |
About
xdg-utils is the freedesktop.org set of shell scripts that desktop-independent programs call to reach the desktop: xdg-open, xdg-mime, xdg-email, xdg-settings, xdg-desktop-menu, xdg-icon-resource and the others. In KDOS the xdg-open a user runs is kdos-appbox’s, a link in /usr/local/bin, which comes first on the shipped PATH; it opens a file in a native or a boxed handler and falls back to this package’s /usr/bin/xdg-open when it finds none (see kdos-appbox).
Sources
xdg-utils-1.2.1.tar.gz(300.4 KiB)
sha256f6b648c064464c2636884c05746e80428110a576f8daacf46ef2e554dcfdae75
upstream: https://gitlab.freedesktop.org/xdg/xdg-utils/-/archive/v1.2.1/xdg-utils-v1.2.1.tar.gz
archive copy: sources-4/xdg--xdg-utils-1.2.1.tar.gz
Dependencies
Depends on: xmlto, lynx, docbook-xml, docbook-xsl.
Required by (12): calibre, cups, deluge, filezilla, gimp, gramps, kdos-appbox, krohnkite, openconnect, qt5-qtbase, w3m, zim.
Patches
build.sh applies these; kpkg applies nothing by itself.
qtpaths6.patch— Find the KDE configuration directory through qtpaths6, then qtpaths, then XDG_CONFIG_HOMEmake_default_kde asks the unsuffixed qtpaths for Qt's writable ConfigLocation, which a Qt 6 system may install only as qtpaths6 or not on PATH at all; the shell then prints "qtpaths: command not found". The lookup tries qtpaths6, then qtpaths, quietly, and falls back to $XDG_CONFIG_HOME (or ~/.config), the directory Qt returns on Linux.
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 xdg-utils'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/xdg/xdg-utils.
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/xdg-utils
echo 'f6b648c064464c2636884c05746e80428110a576f8daacf46ef2e554dcfdae75 xdg-utils-1.2.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/xdg-utils
SRC=$SRC_ROOT/xdg-utils-1.2.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf xdg-utils-1.2.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:
patch -p1 -i "$PORT_SRC/qtpaths6.patch"
export XML_CATALOG_FILES=/etc/xml/catalog
./configure --prefix=/usr --mandir=/usr/share/man
make
make DESTDIR=$PKG install
The switches, and why each is set:
XML_CATALOG_FILES=/etc/xml/catalog— Makexmlto, which renders the scripts’ DocBook descriptions into manual pages and into the text of each script’s--help, resolve the DocBook DTD and stylesheets through the system catalog rather than by fetching their URLs.
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/xdg-utils, 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 xdg-utils-1.2.1-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/xdg-utils, and runs the triggers its paths call for.
Contents
Installed programs: xdg-desktop-icon, xdg-desktop-menu, xdg-email, xdg-icon-resource, xdg-mime, xdg-open, xdg-screensaver, xdg-settings.
Installed directories: /usr/share/licenses/xdg-utils.
Short descriptions
xdg-desktop-icon |
command line tool for (un)installing icons to the desktop |
xdg-desktop-menu |
command line tool for (un)installing desktop menu items |
xdg-email |
command line tool for sending mail using the users preferred e-mail composer |
xdg-icon-resource |
command line tool for (un)installing icon resources |
xdg-mime |
command line tool for querying information about file type handling and adding descriptions for new file types |
xdg-open |
opens a file or URL in the users preferred application |
xdg-screensaver |
command line tool for controlling the screensaver |
xdg-settings |
get various settings from the desktop environment |
Notes
The build needs a text-mode web browser: each script’s --help text is made with xmlto txt, which renders the DocBook to HTML and then runs a text browser over it, and the result is pasted into the script. lynx is that browser, which is why it is in depends; at run time it is only one of the text browsers xdg-open’s generic fallback tries.
qtpaths6.patch changes how xdg-mime default finds the KDE configuration directory in a Plasma session. Upstream runs the unsuffixed qtpaths, and this tree puts neither qtpaths nor qtpaths6 on PATH: Qt 6’s are /usr/lib/qt6/bin/qtpaths and /usr/lib/qt6/bin/qtpaths6, and Qt 5’s is /usr/bin/qtpaths-qt5. The unpatched script therefore prints qtpaths: command not found on every call. The patched lookup tries qtpaths6, then qtpaths, with their errors discarded, and falls back to $XDG_CONFIG_HOME or ~/.config, the directory Qt names on Linux; on KDOS both lookups miss, so the fallback is the directory it uses. mimeapps.list there is the file the generic path writes as well. The patch is to be offered upstream as a merge request to xdg/xdg-utils.