46.9. xmlto-0.0.29
Front-end to an XSL toolchain
| Version | 0.0.29, release 1 |
| Shelf | doctools — Documentation toolchains, man pages, markup converters and TeX typesetting |
| Phase | 30_foundation (Build Foundation), 122 of 127 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://pagure.io/xmlto |
| Build time | 0.1 SBU |
| Installed size | 109.8 KiB in 40 files |
| Recipe | ports/core/doctools/xmlto/kpkgbuild |
About
xmlto converts a DocBook document into a manual page, HTML, text or another format: it picks the stylesheet for the format asked for, runs xsltproc, and hands the result to a post-processor when the format needs one. xmlif, installed with it, selects the conditional sections of an XML file. In KDOS it is a build tool: git, alsa-utils, zbar and the other ports that depend on it render their manual pages through xmlto man (see Manual pages).
xmlto is a shell script. Its configure writes the programs it calls into the installed script: one it finds in the build root by its absolute path, one it does not find by its bare name, which the script then looks up on PATH each time it runs. configure also checks that getopt handles long options, which the one from util-linux does, and stops when it does not.
Sources
xmlto-0.0.29.tar.bz2(53.4 KiB)
sha2566000d8e8f0f9040426c4f85d7ad86789bc88d4aeaef585c4d4110adb0b214f21
upstream: https://releases.pagure.org/xmlto/xmlto-0.0.29.tar.bz2
archive copy: sources-1/doctools--xmlto-0.0.29.tar.bz2
Dependencies
Depends on: libxslt, docbook-xsl, flex, util-linux.
Required by (11): alsa-utils, git, gnuradio, libtraceevent, libtracefs, ocl-icd, opensp, phodav, system-config-printer, xdg-utils, zbar.
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 xmlto'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/doctools/xmlto.
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/xmlto
echo '6000d8e8f0f9040426c4f85d7ad86789bc88d4aeaef585c4d4110adb0b214f21 xmlto-0.0.29.tar.bz2' | 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/xmlto
SRC=$SRC_ROOT/xmlto-0.0.29
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf xmlto-0.0.29.tar.bz2 -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:
export XML_CATALOG_FILES="/etc/xml/catalog"
LINKS="/usr/bin/links"
autoreconf -vfi
./configure --prefix=/usr PAPER_CONF=paperconf
make
make DESTDIR=$PKG install
The switches, and why each is set:
XML_CATALOG_FILES="/etc/xml/catalog"— Names the XML catalogue libxml2 reads. The build makesxmlto.1andxmlif.1by running the freshly builtxmlto manoverdoc/xmlto.xmlanddoc/xmlif.xml, and the stylesheet it applies is named by its docbook.sourceforge.net address, which only the catalogue that docbook-xsl installs maps onto a local file. The file named is the one libxml2 reads when the variable is unset.autoreconf -vfi— The release tarball carriesconfigure.acandMakefile.amand no generatedconfigure.PAPER_CONF=paperconf— Presets the variable configure’sAC_PATH_PROGwould otherwise fill with the absolute path ofpaperconf, the program of libpaper that xmlto asks for the default paper size. With the bare name, the installed script findspaperconfonPATHeach time it runs. libpaper is installed in a later phase, and an absolute path would record whether it happened to be present when xmlto was configured (see An optional tool found in the tree).
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/xmlto, 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 xmlto-0.0.29-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/xmlto, and runs the triggers its paths call for.
Contents
Installed programs: xmlif, xmlto.
Installed directories: /usr/share/licenses/xmlto, /usr/share/xmlto.
Short descriptions
xmlif |
conditional processing instructions for XML |
xmlto |
apply an XSL stylesheet to an XML document |
Notes
The LINKS="/usr/bin/links" line in build.sh sets a shell variable without exporting it, and configure is not passed it, so it changes nothing. Nothing configure finds would reach the installed script either: asked for text output, xmlto looks on PATH each time it runs for w3m, then lynx, then elinks or links, and uses the first it finds.