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

42.5. libintl-1.0

GNU libintl — the gettext runtime musl does not carry in libc

Version 1.0, release 1
Shelf toolchain — The native compilers, the linker, the C library, and the LLVM family
Phase 30_foundation (Build Foundation), 78 of 127 in build order
Licence LGPL-2.1-or-later
Homepage https://www.gnu.org/software/gettext/
Build time 1.2 SBU
Installed size 211.4 KiB in 4 files
Recipe ports/core/toolchain/libintl/kpkgbuild

About

libintl is the run-time half of GNU gettext: the library a program calls to look up the translation of a message (gettext, ngettext, dgettext and the rest) in the message catalogues installed for the current locale. This port builds that library alone, from the same gettext tarball and version as the gettext port.

It is in KDOS for programs built against musl. musl’s libc has gettext() and its relatives, but not the libintl_gettext, libintl_ngettext and other libintl_-prefixed names that GNU’s libintl.h maps them to, which only GNU’s libintl defines. The gettext port is built --disable-nls and installs no libintl, so a program whose objects call those names, such as newsboat, or whose build links libintl whenever it finds one, as gdk-pixbuf’s and fcitx5’s do, links against this one. The diagnosis and the choice between a build switch and this library are in Gettext on musl.

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: gettext.

Required by (19): fcitx5, gdk-pixbuf, kate, libcupsfilters, libexif, libgphoto2, libgsf, libhangul, libiptcdata, libpulse, libreoffice, linuxcnc, newsboat, qv4l2, remmina, texinfo, v4l-utils, viking, widelands.

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

What kpkg does

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

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

cd gettext-runtime
./configure \
	--prefix=/usr \
	--libdir=/usr/lib \
	--disable-static \
	--disable-rpath \
	--disable-java \
	--disable-csharp \
	--without-emacs \
	--enable-nls \
	--with-included-libintl
make -C intl
make -C intl DESTDIR=$PKG install

rm -f "$PKG/usr/include/libintl.h"

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

Contents

Installed libraries: libintl.so.

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

Notes

configure runs at the level of gettext-runtime, which configures intl/ as a subdirectory with the same options; make -C intl then builds and installs only the library. Everything else in gettext-runtime, gettext, ngettext, envsubst and libasprintf, belongs to the gettext port, and installing it here as well would put two packages on the same paths.

intl’s install writes GNU’s libintl.h too, and build.sh deletes it from $PKG. /usr/include/libintl.h is musl’s, and kpkg refuses a package that would overwrite a path another package owns (Who owns a file). A program compiled against musl’s header calls the plain names; the library exports those as well as the libintl_ ones.