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

46.6. docbook-xml-4.5

Document type definitions for verification of XML data files against the DocBook rule set

Version 4.5, release 2
Shelf doctools — Documentation toolchains, man pages, markup converters and TeX typesetting
Phase 30_foundation (Build Foundation), 118 of 127 in build order
Licence DocBook-DTD
Homepage https://docbook.org/
Build time 0.1 SBU
Installed size 2.0 MiB in 147 files
Recipe ports/core/doctools/docbook-xml/kpkgbuild

About

DocBook XML is the set of document type definitions (DTDs) a DocBook document is validated against. Many projects write their manual pages and manuals in DocBook and turn them into roff or HTML at build time with xsltproc or xmlto; the dbus, polkit, udisks2, gtk3, PostgreSQL, samba and KDE kdoctools ports are among those that depend on this one. A document names the DTD version it was written against in its DOCTYPE, so the port installs several 4.x versions side by side, each in /usr/share/xml/docbook/xml-dtd-<version>, and lists all of them in an XML catalog, /etc/xml/docbook.

The catalog lets every lookup be answered from disk. The build has no network, and xmllint --nonet and xmlto validate only when each DTD the document asks for resolves to a local file.

Sources

Dependencies

Depends on: libxml2, sgml-common, libarchive.

Required by (26): alsa-utils, asciidoc, bubblewrap, cppcheck, dbus, dconf, docbook-xsl, elogind, gimp-help, gnuradio, gtk3, gvfs, kdoctools, libsecret, ocl-icd, polkit, postgresql, samba, system-config-printer, talloc, tdb, udisks2, wsjtx, xdg-dbus-proxy, xdg-user-dirs, xdg-utils.

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/30_foundation/phase.env && kpkg install docbook-xml'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/doctools/docbook-xml.

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/doctools/docbook-xml
echo '30f0644064e0ea71751438251940b1431f46acada814a062870f486c772e7772  docbkx412.zip' | sha256sum -c -
echo 'acc4601e4f97a196076b7e64b368d9248b07c7abf26b34a02cca40eeebe60fa2  docbook-xml-4.2.zip' | sha256sum -c -
echo '23068a94ea6fd484b004c5a73ec36a66aa47ea8f0d6b62cc1695931f5c143464  docbook-xml-4.3.zip' | sha256sum -c -
echo '02f159eb88c4254d95e831c51c144b1863b216d909b5ff45743a1ce6f5273090  docbook-xml-4.4.zip' | sha256sum -c -
echo '4e4e037a2b83c98c6c94818390d4bdd3f6e10f6ec62dd79188594e26190dc7b4  docbook-xml-4.5.zip' | 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/docbook-xml
SRC=$SRC_ROOT/docbook-xml-4.5
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
cp docbook-xml-4.5.zip "$SRC"
cp docbook-xml-4.4.zip "$SRC"
cp docbook-xml-4.3.zip "$SRC"
cp docbook-xml-4.2.zip "$SRC"
cp docbkx412.zip "$SRC"

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 series and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:

for ver in 4.5 4.4 4.3 4.2; do
	mkdir docbook-xml-$ver
	cd docbook-xml-$ver
	bsdtar -xf $PORT_SRC/docbook-xml-$ver.zip
	install -v -d -m755 $PKG/usr/share/xml/docbook/xml-dtd-$ver
	chown -R root:root .
	cp -v -af docbook.cat *.dtd ent/ *.mod \
		$PKG/usr/share/xml/docbook/xml-dtd-$ver/
	cd -
done

mkdir docbook-xml-4.1.2
cd docbook-xml-4.1.2
bsdtar -xf $PORT_SRC/docbkx412.zip
install -v -d -m755 $PKG/usr/share/xml/docbook/xml-dtd-4.1.2
chown -R root:root .
cp -v -af docbook.cat *.dtd ent/ *.mod \
	$PKG/usr/share/xml/docbook/xml-dtd-4.1.2/
cd -

install -v -d -m755 $PKG/etc/xml
xmlcatalog --noout --create $PKG/etc/xml/docbook

for vers in 4.1.2 4.2 4.3 4.4 4.5; do
xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML V$vers//EN" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers/docbookx.dtd" \
    $PKG/etc/xml/docbook
xmlcatalog --noout --add "public" \
    "-//OASIS//DTD DocBook XML CALS Table Model V$vers//EN" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers/calstblx.dtd" \
    $PKG/etc/xml/docbook
xmlcatalog --noout --add "public" \
    "-//OASIS//DTD XML Exchange Table Model 19990315//EN" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers/soextblx.dtd" \
    $PKG/etc/xml/docbook
xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML Information Pool V$vers//EN" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers/dbpoolx.mod" \
    $PKG/etc/xml/docbook
xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML Document Hierarchy V$vers//EN" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers/dbhierx.mod" \
    $PKG/etc/xml/docbook
xmlcatalog --noout --add "public" \
    "-//OASIS//ELEMENTS DocBook XML HTML Tables V$vers//EN" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers/htmltblx.mod" \
    $PKG/etc/xml/docbook
xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Notations V$vers//EN" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers/dbnotnx.mod" \
    $PKG/etc/xml/docbook
xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Character Entities V$vers//EN" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers/dbcentx.mod" \
    $PKG/etc/xml/docbook
xmlcatalog --noout --add "public" \
    "-//OASIS//ENTITIES DocBook XML Additional General Entities V$vers//EN" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers/dbgenent.mod" \
    $PKG/etc/xml/docbook
xmlcatalog --noout --add "rewriteSystem" \
    "http://www.oasis-open.org/docbook/xml/$vers" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers" \
    $PKG/etc/xml/docbook
xmlcatalog --noout --add "rewriteURI" \
    "http://www.oasis-open.org/docbook/xml/$vers" \
    "file:///usr/share/xml/docbook/xml-dtd-$vers" \
    $PKG/etc/xml/docbook
done

install -Dm644 "$SRC/docbook-xml-4.5/docbookx.dtd" "$PKG/usr/share/licenses/$name/docbookx.dtd"

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/docbook-xml, 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 docbook-xml-4.5-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/docbook-xml, and runs the triggers its paths call for.

Contents

Installed directories: /usr/share/licenses/docbook-xml, /usr/share/xml/docbook/xml-dtd-4.1.2, /usr/share/xml/docbook/xml-dtd-4.2, /usr/share/xml/docbook/xml-dtd-4.3, /usr/share/xml/docbook/xml-dtd-4.4, /usr/share/xml/docbook/xml-dtd-4.5.

Notes

Each version’s public identifiers (-//OASIS//DTD DocBook XML V<version>//EN and the rest) map straight to file:///usr/share/xml/docbook/xml-dtd-<version>/…, not to the http://www.oasis-open.org/… URL left for a rewriteSystem entry to turn into a local path. libxml2 does not pass the result of a public lookup through the rewriteSystem entries, so a public entry that names the URL sends a document whose system identifier is relative ("docbookx.dtd", as gnuradio’s gr-trellis manual writes it) to the network, and validation fails. The rewriteSystem and rewriteURI entries serve a document that names the DTD by its URL alone.

/etc/xml/docbook is not the catalog libxml2 reads by default; that is /etc/xml/catalog, which the docbook-xsl port writes. It delegates the DocBook XML DTD and entity public identifiers, and the http://www.oasis-open.org/docbook/ system identifiers and URIs, to /etc/xml/docbook. A build that has this port but not docbook-xsl resolves nothing through the default catalog. Every other port that depends on this one also depends on docbook-xsl.

The 4.1.2 archive is named docbkx412.zip rather than docbook-xml-4.1.2.zip, so build.sh unpacks it on its own, after the loop over the others. The files are unpacked with bsdtar, from libarchive, which reads zip archives, and chown -R root:root gives them to root before cp -af copies them with their ownership.