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

39.10. less-710

A text file viewer

Version 710, release 1
Shelf base — The minimal userland and system daemons that every KDOS image boots with
Phase 30_foundation (Build Foundation), 71 of 127 in build order
Licence GPL-3.0-or-later OR BSD-2-Clause
Homepage https://www.greenwoodsoftware.com/less/
Build time 0.1 SBU
Installed size 512.4 KiB in 8 files
Recipe ports/core/base/less/kpkgbuild

About

less is the pager: it shows a file or a program’s output a screen at a time, scrolls both ways, and searches with regular expressions. On KDOS it is what man pages through (mandoc depends on it), and the login profile points it at an input filter from lesspipe with LESSOPEN, and sets LESS=-R so colour escapes are shown as colour (see Shell environment). The port installs less, and its helpers lessecho and less-osc8-open in /usr/libexec.

Why it is in KDOS

The comment above the 8 ports from skalibs to sed in script/phases/30_foundation/packages.txt:

utmps, the utmp and wtmp service over skalibs (shelves auth and base-libs): coreutils, sysvinit, util-linux and shadow build against it, and coreutils' depends installs both in the pinned run above, ahead of the other three.

Sources

Dependencies

Depends on: ncurses, pcre2.

Required by (2): lesspipe, mandoc.

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

What kpkg does

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

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/base/less
echo 'd1008fb78dcae1323ddab664bcb352a61f022b1b131bd8018548e021d975ec7a  less-710.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/less
SRC=$SRC_ROOT/less-710
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf less-710.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:

./configure --prefix=/usr --sysconfdir=/etc --with-regex=pcre2
grep -q '^#define HAVE_PCRE2 1' defines.h \
	|| { echo "less: pcre2 missing" >&2; exit 1; }
make
make DESTDIR=$PKG install

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

Contents

Installed programs: less.

Installed directories: /usr/share/licenses/less.

Short descriptions

less display the contents of a file in a terminal

Notes

less’s configure does not stop when the regular-expression library it was told to use is missing. It prints “cannot find regular expression library” and builds a less with no regular expressions at all, in which / matches only literal text. build.sh therefore checks the generated defines.h for HAVE_PCRE2 and stops the build when it is not there, so a less without PCRE2 never reaches a package.