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

43.3. libtool-2.6.2

The GNU generic library support script

Version 2.6.2, release 1
Shelf buildtools — Build systems and build helpers
Phase 30_foundation (Build Foundation), 12 of 127 in build order
Licence GPL-2.0-or-later AND LGPL-2.1-or-later
Homepage https://www.gnu.org/software/libtool/
Build time 0.2 SBU
Installed size 2.7 MiB in 67 files
Recipe ports/core/buildtools/libtool/kpkgbuild

About

GNU libtool hides the differences between platforms’ ways of building and linking shared libraries behind one script. A package that uses it carries ltmain.sh and libtool’s macros, copied in by libtoolize, and its configure writes a libtool script from them. A recipe that runs autoreconf -i on a project whose configure.ac uses those macros runs libtoolize from this port, whether or not it names libtool in depends, and that is why 30_foundation installs it in its opening run, ahead of the ports that need it. The port also installs libltdl, a portable wrapper around dlopen through which some programs load their plugins.

Why it is in KDOS

The comment above the 24 ports from fortify-headers to musl-utils in script/phases/30_foundation/packages.txt is quoted in The build foundation.

Sources

Dependencies

Depends on: nothing a recipe names.

Required by (84): abiword, admesh, afflib, aircrack-ng, anthy-unicode, audiofile, avahi, bitwise, brltty, catatonit, cyrus-sasl-xoauth2, dasher, dotconf, erfa, erofs-utils, espeak-ng, expat, f2fs-tools, freedv-gui, gmime, graphviz, hamlib, handbrake, id3lib, kodi, koreader, libao, libcanberra, libcap-ng, libdmtx, libetpan, libgphoto2, libiscsi, libixion, libmodbus, libndp, libnova, libraw, libsass, libsigrok, libsigrokdecode, libstrophe, libtpms, libuv, libxdg-basedir, lnav, lrdf, ltrace, minicom, minidlna, minizip, motif, musl-fts, musl-obstack, nco, networkmanager-openvpn, nfs-utils, nut, ocl-icd, openocd, opensp, orcaslicer, par2cmdline-turbo, partclone, pcaudiolib, qrencode, sane-backends, sassc, sdl2-gfx, shairplay, sleuthkit, sox, swtpm, thermald, tlf, ubdsrv, unixodbc, usbmuxd, xastir, xnec2c, yara, yices2, zbar, zimg.

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

What kpkg does

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

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/buildtools/libtool
echo '2ef1067c16c97db930fd740cc9bc3d3ba9a583804ae5ac42cc3e8719e49e191e  libtool-2.6.2.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/libtool
SRC=$SRC_ROOT/libtool-2.6.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libtool-2.6.2.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:

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

Contents

Installed programs: libtool, libtool-next-version, libtoolize.

Installed libraries: libltdl.a, libltdl.so.

Installed directories: /usr/include/libltdl, /usr/share/libtool, /usr/share/licenses/libtool.

Short descriptions

libtool Provide generalized library-building support services
libtool-next-version Determines next version to use for a libtool library
libtoolize Prepare a package to use libtool

Notes

The .la files libtool writes beside each library are removed from every package by kpkg itself, so no recipe deletes them (see Anatomy of a kpkg install).

A configure script generated with libtool’s macros looks for file, which the same opening run installs, and on x86-64 Linux runs it on a test object to learn whether the compiler produces 32-bit code, which needs a different linker emulation. When file is missing, the check reads nothing and the linker is left as it is.