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

154.2. cups-2.4.20

Print spooler and associated utilities

Version 2.4.20, release 1
Shelf printing — Printing, printer drivers, labels, scanning and OCR
Phase 41_system (System), 46 of 1047 in build order
Licence Apache-2.0 WITH LLVM-exception
Homepage https://openprinting.github.io/cups/
Build time 0.7 SBU
Installed size 14.1 MiB in 862 files
Recipe ports/core/printing/cups/kpkgbuild

About

CUPS is the print system: the cupsd scheduler that holds the queues, libcups that every printing application links, the lp, lpstat and lpadmin commands, and the filters and backends that carry a job to a printer. On KDOS it prints to driverless (IPP Everywhere) printers it discovers through avahi, and Plasma’s print-manager manages its queues; see Printing. /etc/init.d/80_cups.sh runs cupsd -f under supervision.

Sources

Dependencies

Depends on: gnutls, libusb, pam, dbus, xdg-utils, avahi, zlib, acl, libpaper.

Required by (29): bluez, brlaser, chromium, cups-browsed, cups-filters, darktable, foomatic-db, foomatic-db-engine, freerdp, ghostscript, gtk3, gtk4, gutenprint, hplip, libcupsfilters, libppd, libreoffice, openjdk, print-manager, python3-cups, qt5-qtbase, qt6-qtbase, qt6-qtwebengine, remmina, samba, splix, system-config-printer, tk, wine.

Patches

build.sh applies these; kpkg applies nothing by itself.

Each patch’s own Subject: line names what it changes; the background is here.

local-names-through-avahi.patch gives httpAddrGetList(), the lookup every libcups client connects through, a second way to resolve a host name in the mDNS .local domain. musl has no NSS, so no nss-mdns module answers such a name for getaddrinfo(), and every printer that DNS-SD discovers is named by one: without the patch cupsd refuses to add a discovered driverless printer with Unable to connect to <host>.local:8631: Name does not resolve, although Avahi resolved the service. When getaddrinfo() fails for a name ending in .local (or .local.), the patch asks the Avahi daemon through avahi-client, which libcups already links under --with-dnssd=avahi, waits at most two seconds, and returns the address with the port asked for; an IPv6 link-local answer carries the interface it came on as its scope. cupsd, the ipp backend, lpadmin, lpstat, cups-browsed and Plasma’s printer settings then all resolve .local names. A lookup that getaddrinfo() answers, and every name outside .local, is unchanged. With the Avahi daemon down the second lookup fails at once and the original error stands.

no-idle-exit.patch removes the IdleExitTimeout line from the cupsd.conf that make install writes. The scheduler knows that directive only when it is built for on-demand starts, which --with-ondemand=no turns off, so with the line in place every start of cupsd logs Unknown directive IdleExitTimeout in /var/log/cups/error_log. No configure switch leaves it out: --with-idle-exit-timeout=no still writes it, as IdleExitTimeout 0.

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 cups'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/printing/cups.

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/printing/cups
echo '213084ea7bf4f9fb718a9743eed81ef2600b8c90448ead7fa77cedcf0eadc076  cups-2.4.20.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/cups
SRC=$SRC_ROOT/cups-2.4.20
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf cups-2.4.20.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/no-idle-exit.patch"
patch -p1 -i "$PORT_SRC/local-names-through-avahi.patch"

export LDFLAGS="$LDFLAGS -Wl,-z,stack-size=8388608"

./configure \
	--prefix=/usr \
	--libdir=/usr/lib \
	--sysconfdir=/etc \
	--localstatedir=/var \
	--with-menudir=/usr/share/applications \
	--with-icondir=/usr/share/icons \
	--with-logdir=/var/log/cups \
	--with-docdir=/usr/share/cups \
	--with-rundir=/run/cups \
	--with-cupsd-file-perm=0755 \
	--with-cups-user=lp \
	--with-cups-group=lp \
	--with-system-groups="lpadmin root" \
	--with-domainsocket=/run/cups/cups.sock \
	--enable-acl \
	--enable-dbus \
	--enable-pam \
	--enable-libpaper \
	--with-dnssd=avahi \
	--with-dbusdir=/usr/share/dbus-1 \
	--enable-libusb \
	--enable-raw-printing \
	--enable-relro \
	--with-tls=gnutls \
	--with-optim="${CFLAGS/-std=gnu11/}" \
	--without-rcdir \
	--without-systemd \
	--with-ondemand=no
make
make BUILDROOT=$PKG install

install -d -m 755 $PKG/etc/pam.d
cat > $PKG/etc/pam.d/cups << "EOF"
auth    required pam_unix.so
account required pam_unix.so
EOF
chmod 644 $PKG/etc/pam.d/cups

rm -fr $PKG/tmp $PKG/run $PKG/var/run

chmod 0755 $PKG/var/cache
chmod 0755 $PKG/var/spool
chmod -R +w $PKG

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/cups, 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 cups-2.4.20-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/cups, and runs the triggers its paths call for.

Contents

Installed programs: cancel, cups-config, cupsaccept, cupsctl, cupsd, cupsdisable, cupsenable, cupsfilter, cupsreject, cupstestppd, ippeveprinter, ippfind, ipptool, lp, lpadmin, lpc, lpinfo, lpmove, lpoptions, lpq, lpr, lprm, lpstat, ppdc, ppdhtml, ppdi, ppdmerge, ppdpo.

Installed libraries: libcups.so, libcupsimage.so.

Installed directories: /etc/cups/ppd, /etc/cups/ssl, /usr/include/cups, /usr/lib/cups/cgi-bin, /usr/lib/cups/command, /usr/lib/cups/daemon, /usr/lib/cups/monitor, /usr/lib/cups/notifier, /usr/share/cups/da, /usr/share/cups/de, /usr/share/cups/es, /usr/share/cups/examples, /usr/share/cups/fr, /usr/share/cups/help, /usr/share/cups/images, /usr/share/cups/ipptool, /usr/share/cups/ja, /usr/share/cups/ppdc, /usr/share/cups/profiles, /usr/share/cups/pt_BR, /usr/share/cups/ru, /usr/share/cups/templates, /usr/share/licenses/cups, /var/cache/cups, /var/log/cups, /var/spool.

Short descriptions

cancel cancel jobs
cups-config get cups api, compiler, directory, and link information (deprecated).
cupsaccept accept/reject jobs sent to a destination
cupsctl configure cupsd.conf options
cupsd cups scheduler
cupsenable stop/start printers and classes
cupsfilter convert a file to another format using cups filters (deprecated)
cupstestppd test conformance of ppd files (deprecated)
ippeveprinter an ipp everywhere printer application for cups
ippfind find internet printing protocol printers
ipptool perform internet printing protocol requests
lp print files
lpadmin configure cups printers and classes
lpc line printer control program (deprecated)
lpinfo show available devices or drivers (deprecated)
lpmove move a job or all jobs to a new destination
lpoptions display or set printer options and defaults
lpq show printer queue status
lpr print files
lprm cancel print jobs
lpstat print cups status information
ppdc cups ppd compiler (deprecated)
ppdhtml cups html summary generator (deprecated)
ppdi import ppd files (deprecated)
ppdmerge merge ppd files (deprecated)
ppdpo ppd message catalog generator (deprecated)
cups.pc CUPS API Library

Notes

build.sh stages the install with make BUILDROOT=$PKG install. BUILDROOT is the prefix every install path in CUPS’s Makedefs is built on; it defaults to $(DSTROOT)$(DESTDIR), so setting it directly stages the same tree.

After the install build.sh removes /tmp, /run and /var/run from the package (tmpfs at run time, and refused by the lint), sets /var/cache and /var/spool to 0755, and makes every staged file writable by its owner.

The configuration files under /etc/cups and the backends under /usr/lib/cups/backend keep the restricted modes CUPS gives them; both paths are on the lint’s allowlist of files that need not be world-readable. The installer enables the service by default; a person who turns printing off in the installer gets /etc/service.disabled/cups, and service enable cups turns it back on.