46.10. help2man-1.49.3
Turns a program's own --help into a man page
| Version | 1.49.3, release 1 |
| Shelf | doctools — Documentation toolchains, man pages, markup converters and TeX typesetting |
| Phase | 30_foundation (Build Foundation), 125 of 127 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://www.gnu.org/software/help2man/ |
| Build time | 0.1 SBU |
| Installed size | 75.6 KiB in 4 files |
| Recipe | ports/core/doctools/help2man/kpkgbuild |
About
help2man writes a manual page from what a program prints for --help and --version. It is a Perl script, and in KDOS it is purely a build tool: libgpiod, libqmi, libmbim, speech-dispatcher, verilator, z3 and the other ports that depend on it run it on their freshly built programs to make the pages they install (see Manual pages).
Its absence switches nothing off. A Makefile rule that pipes a program’s --help into help2man exits 127 when the script is missing and fails the build.
Why it is in KDOS
The comment above it in script/phases/30_foundation/packages.txt:
A Makefile rule that pipes
$(PROG) --helpinto help2man does not degrade when it is absent — it exits 127 and takes the build with it.
Sources
help2man-1.49.3.tar.xz(223.1 KiB)
sha2564d7e4fdef2eca6afe07a2682151cea78781e0a4e8f9622142d9f70c083a2fd4f
upstream: https://ftp.gnu.org/gnu/help2man/help2man-1.49.3.tar.xz
archive copy: sources-1/doctools--help2man-1.49.3.tar.xz
Dependencies
Depends on: perl.
Required by (12): bladerf, libcdio, libgpiod, liblouis, libmbim, libqmi, openexr, sassc, speech-dispatcher, verilator, z3, zenity.
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 help2man'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/doctools/help2man.
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/help2man
echo '4d7e4fdef2eca6afe07a2682151cea78781e0a4e8f9622142d9f70c083a2fd4f help2man-1.49.3.tar.xz' | 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/help2man
SRC=$SRC_ROOT/help2man-1.49.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf help2man-1.49.3.tar.xz -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:
./configure --prefix=/usr --disable-nls
make
make DESTDIR=$PKG install
The switches, and why each is set:
--disable-nls— Builds without help2man’s support for localised pages: the message catalogues for its own text, and thebindtextdomain.sopreload that lets a program read its message catalogues from the build tree so that its translated--helpcan be captured. configure otherwise turns the support on by itself whenever it finds the Perl moduleLocale::gettext,msgfmt,dlsymandbindtextdomaintogether. Only English pages are wanted: the package step removes every translated manual page directory (see Size and language policy).
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/help2man, 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 help2man-1.49.3-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/help2man, and runs the triggers its paths call for.
Contents
Installed programs: help2man.
Installed directories: /usr/share/licenses/help2man.
Short descriptions
help2man |
generate a simple manual page |