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

42.9. argp-standalone-1.4.1

Standalone version of arguments parsing functions from GLIBC

Version 1.4.1, release 2
Shelf toolchain — The native compilers, the linker, the C library, and the LLVM family
Phase 30_foundation (Build Foundation), 88 of 127 in build order
Licence LGPL-2.1-or-later
Homepage https://github.com/ericonr/argp-standalone
Build time 0.1 SBU
Installed size 102.7 KiB in 4 files
Recipe ports/core/toolchain/argp-standalone/kpkgbuild

About

argp is glibc’s command-line parser: a program describes its options in a table and argp_parse() handles them, with --help and --usage written for it. musl leaves it out, so this port supplies it as a separate library, taken from glibc’s own source by the argp-standalone project. elfutils is the port in this phase that needs it; dwarves, bcc, crun, v4l-utils and qv4l2, freeipmi, f3, tlf and ptouch-print name it too.

The package is one header, /usr/include/argp.h, and one static library, /usr/lib/libargp.a. A program that uses it carries its own copy of the code, so nothing on the installed system loads libargp at run time.

Why it is in KDOS

The comment above the 7 ports from libintl to patchelf in script/phases/30_foundation/packages.txt:

The gettext runtime: musl has no gettext in libc and the gettext port is built --disable-nls, so newsboat's libintl_gettext resolves nowhere without it.

Sources

Dependencies

Depends on: autoconf, automake.

Required by (10): bcc, crun, dwarves, elfutils, f3, freeipmi, ptouch-print, qv4l2, tlf, v4l-utils.

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 argp-standalone'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/toolchain/argp-standalone.

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/toolchain/argp-standalone
echo '879d76374424dce051b812f16f43c6d16de8dbaddd76002f83fd1b6e57d39e0b  argp-standalone-1.4.1.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/argp-standalone
SRC=$SRC_ROOT/argp-standalone-1.4.1
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf argp-standalone-1.4.1.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:

autoreconf -fi
./configure \
	--prefix=/usr \
	--sysconfdir=/etc

make CFLAGS="$CFLAGS -g0"

mkdir -p $PKG/usr/{include,lib}
install -Dm644 argp.h $PKG/usr/include/argp.h
install -Dm644 libargp.a $PKG/usr/lib/libargp.a

install -Dm644 "$SRC/README.md" "$PKG/usr/share/licenses/$name/README.md"
install -Dm644 /usr/share/licenses/gcc/COPYING.LIB "$PKG/usr/share/licenses/$name/COPYING.LIB"

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/argp-standalone, 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 argp-standalone-1.4.1-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/argp-standalone, and runs the triggers its paths call for.

Contents

Installed libraries: libargp.a.

Installed directories: /usr/share/licenses/argp-standalone.

Notes

Upstream’s Makefile.am declares libargp.a and argp.h as noinst_: built, never installed. make install installs nothing, so build.sh copies the two files into $PKG itself.

The source carries no licence text: its README.md only names the LGPL-2.1-or-later. The last line of build.sh installs that text from gcc’s /usr/share/licenses/gcc/COPYING.LIB, which is in every tree that can build this port.