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

39.14. gzip-1.15

GNU compression utility

Version 1.15, release 2
Shelf base — The minimal userland and system daemons that every KDOS image boots with
Phase 30_foundation (Build Foundation), 75 of 127 in build order
Licence GPL-3.0-or-later
Homepage https://www.gnu.org/software/gzip/
Build time 0.3 SBU
Installed size 349.9 KiB in 25 files
Recipe ports/core/base/gzip/kpkgbuild

About

GNU gzip compresses and decompresses the .gz format. Besides gzip itself, the package installs gunzip, zcat and the z tools (zgrep, zdiff, zless and the rest), most of them shell scripts that run gzip. tar runs gzip to read a .tar.gz, and many upstream sources ship as one, so the bootstrap builds gzip before the first port (see Gzip). This port replaces that copy in 30_foundation and adopts its files. Apart from the switches of the cross build, the two builds run the same commands, but they do not install the same files: see the note on zless.

Sources

Dependencies

Depends on: nothing a recipe names.

Required by (30): aisleriot, bomber, bovo, bpftrace, foomatic-db, freeciv, granatier, kapman, kblackbox, kbreakout, kdiamond, kfourinline, kgoldrunner, kigo, killbots, kjumpingcube, klickety, klines, knavalbattle, knetwalk, knights, kolf, kollision, ksnakeduel, kubrick, libplasma, lskat, musescore, oxygen, picmi.

Differs from the bootstrap build. Gzip builds this source too, in script/phases/10_bootstrap/060_gzip.sh, before kpkg exists.

Only in the bootstrap build: --build=$(build-aux/config.guess), --host=$KDOS_TARGET.

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

What kpkg does

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

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/gzip
echo '545886cf57fa88a65e967fbf705903d7fcb2567c82c7342493e82e8d7b1a210b  gzip-1.15.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/gzip
SRC=$SRC_ROOT/gzip-1.15
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf gzip-1.15.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
make
make DESTDIR=$PKG install

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

Contents

Installed programs: gunzip, gzexe, gzip, uncompress, zcat, zcmp, zdiff, zegrep, zfgrep, zforce, zgrep, zmore, znew.

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

Short descriptions

gzexe compress executable files in place
gzip compress or expand files
zdiff compare compressed files
zforce force a '.gz' extension on all gzip files
zgrep search possibly compressed files for a regular expression
zmore file perusal filter for crt viewing of compressed text
znew recompress .Z files to .gz files

Notes

The build writes the path of the grep configure found into zgrep. The installed script runs /usr/bin/grep unless the GREP environment variable names another, and tests that grep for GNU behaviour before passing it GNU options such as --label.

configure builds and installs zless and zless.1 only when it finds less on the PATH; zmore is installed whatever the build host holds. The bootstrap runs on the build host, which has both, so it installs zless. The port does not name less in depends, so whether its package carries zless depends on whether less is installed when it builds. In 30_foundation the two are on the same shelf: a serial run installs less first and gzip’s configure finds it, while a --port-jobs run builds gzip at a lower level than less (which waits on pcre2), against a tree without less, and the package has no zless. The bootstrap deletes the zless and zless.1 it installed, so a tree built either way holds no copy of gzip’s that no package owns.