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

19. Gawk

gawk is GNU awk, the pattern-scanning language, and on KDOS it is also /usr/bin/awk. Configure scripts and makefiles run awk constantly, and GCC’s build does too. This step builds it with no optional library. This page shows the commands of script/phases/10_bootstrap/065_gawk.sh and explains them.

Source: the archive of the gawk port
Installs into: build/fs/usr and build/fs/etc/profile.d
Approximate build time: 0.3 SBU

Installation of gawk

GAWK_SRC=$(extract_port_source gawk)

cd "$GAWK_SRC"

./configure \
    --host=$KDOS_TARGET \
    --build=$(build-aux/config.guess) \
    --prefix=/usr \
    --sysconfdir=/etc \
    --without-readline \
    --without-mpfr \
    --disable-nls

make
make DESTDIR=$SYSROOT install

# The gawk port installs only gawk.sh in /etc/profile.d and
# leaves out gawk.csh and gawknotes.info; this copy matches it, so nothing
# here outlives the port's install over it.
rm -f $SYSROOT/etc/profile.d/gawk.csh $SYSROOT/usr/share/info/gawknotes.info

script/phases/10_bootstrap/065_gawk.sh, lines 23–42

The meaning of the configure options

--host=$KDOS_TARGET, --build=$(build-aux/config.guess), --prefix=/usr
A cross build, installed under /usr (see Part III).
--sysconfdir=/etc
Install gawk’s login-shell profile scripts in /etc/profile.d, where the system’s profile reads them, rather than under /usr/etc.
--without-readline
Build gawk’s debugger, gawk -D, with plain line input. readline is built in step 070, after this one.
--without-mpfr
Build without arbitrary-precision arithmetic, so gawk -M is not available. MPFR is not in the root.
--disable-nls
Build no message catalogues.

The rm deletes gawk.csh, the C-shell variant of the profile script, and gawknotes.info, the maintainers’ notes. The gawk port leaves both out of its package, so a copy installed here would never be replaced or removed (see Part III). gawk.sh stays, and the port installs over it.

Contents of gawk

Installed programs: gawk, gawk- followed by the version (a second name for the same file), awk (a symbolic link to gawk) and gawkbug; grcat and pwcat in /usr/libexec/awk.

Installed libraries: the dynamic extensions in /usr/lib/gawk, such as filefuncs.so, inplace.so, readdir.so and time.so.

Installed files: /etc/profile.d/gawk.sh, the awk library functions in /usr/share/awk, and gawkapi.h, the header a dynamic extension is compiled against.

The gawk port’s page describes each program.

Built again later

The gawk port, in 20_selfhost, is built inside the chroot with readline, MPFR and GMP installed before it, and kpkg adopts the files this step installed. It swaps the two without switches for --with-mpfr and --with-readline, so its gawk links libreadline, libmpfr and libgmp. It deletes gawk.csh and gawknotes.info from its package, as this step does.

See also