34.2. readline-8.3
GNU readline library
| Version | 8.3, release 1 |
| Shelf | base-libs — Low-level C libraries that the base system links |
| Phase | 20_selfhost (Self-Hosting Bootstrap), 12 of 15 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://tiswww.case.edu/php/chet/readline/rltop.html |
| Build time | 0.1 SBU |
| Installed size | 1.2 MiB in 25 files |
| Recipe | ports/core/base-libs/readline/kpkgbuild |
About
GNU readline is the line editor interactive programs link to give their prompt Emacs- and vi-style editing, history and completion; libhistory, its history half, comes with it. On KDOS it is the line editing of bash, of gawk’s debugger, and of the many other shells, calculators and debuggers in the tree that name it. It builds in 20_selfhost because gawk links it. 30_foundation names it again, and python3, one of the build tools that phase installs first, depends on it, so a changed recipe is rebuilt there ahead of python3.
The port builds upstream’s release with its official patch series applied: numbered files (readline<ver>-NNN) that upstream publishes for each release. Each is a source = of the recipe with its own sha256 =, so the archive and every patch are verified before anything is unpacked (see Patches). The for loop at the top of build.sh applies them in order with -p0, because they are diffs taken from the top of the release tree.
Sources
readline-8.3.tar.gz(3.3 MiB)
sha256fe5383204467828cd495ee8d1d3c037a7eba1389c22bc6a041f627976f9061cc
upstream: https://mirrors.ocf.berkeley.edu/gnu/readline/readline-8.3.tar.gz
archive copy: sources-1/base-libs--readline-8.3.tar.gzreadline83-001
sha25621f0a03106dbe697337cd25c70eb0edbaa2bdb6d595b45f83285cdd35bac84de
upstream: https://mirrors.ocf.berkeley.edu/gnu/readline/readline-8.3-patches/readline83-001readline83-002
sha256e27364396ba9f6debf7cbaaf1a669e2b2854241ae07f7eca74ca8a8ba0c97472
upstream: https://mirrors.ocf.berkeley.edu/gnu/readline/readline-8.3-patches/readline83-002readline83-003
sha25672dee13601ce38f6746eb15239999a7c56f8e1ff5eb1ec8153a1f213e4acdb29
upstream: https://mirrors.ocf.berkeley.edu/gnu/readline/readline-8.3-patches/readline83-003readline83-004
sha2561f189c4566aa35950964647b9ec3be1a821e42b86048129c63eb7f9d4d2f5a74
upstream: https://mirrors.ocf.berkeley.edu/gnu/readline/readline-8.3-patches/readline83-004readline83-005
sha2565481adbe161c9f6ba972c74db9e18c7aa351d3df3035cc4a673a1aa06247d1c6
upstream: https://mirrors.ocf.berkeley.edu/gnu/readline/readline-8.3-patches/readline83-005readline83-006
sha2564ebd261a608287796e171af0ea9af5a1e3122e46672accda2484b6698c47c1a4
upstream: https://mirrors.ocf.berkeley.edu/gnu/readline/readline-8.3-patches/readline83-006
Dependencies
Depends on: ncurses.
Required by (66): abiword, afflib, android-file-transfer, ardour, avrdude, bash, bc, bitwise, bluez, fluidsynth, fontforge, freeciv, fwupd, gawk, gdb, gdbm, gnugo, gnupg, gnuplot, gphoto2, guile, gutenprint, hamlib, hatari, hunspell, inkscape, iverilog, kalgebra, keepassxc, libimobiledevice, libisoburn, libqalculate, libvirt, libxml2, linuxcnc, lua, lua54, lvm2, lxi-tools, networkmanager, nfs-utils, nftables, ngspice, octave, opensc, pari, parted, pcre2, pipewire, postgresql, profanity, python3, R, samba, sdcc, sdcv, slang, socat, sqlite, tig, udftools, units, unixodbc, util-linux, wesnoth, yosys.
Differs from the bootstrap build. Readline builds this source too, in script/phases/10_bootstrap/070_readline.sh, before kpkg exists.
Only in the bootstrap build: --host=$KDOS_TARGET.
Only in this build: --disable-install-examples, --with-curses, --with-shared-termcap-library.
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/20_selfhost/phase.env && kpkg install readline'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/base-libs/readline.
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-libs/readline
echo 'fe5383204467828cd495ee8d1d3c037a7eba1389c22bc6a041f627976f9061cc readline-8.3.tar.gz' | sha256sum -c -
echo '21f0a03106dbe697337cd25c70eb0edbaa2bdb6d595b45f83285cdd35bac84de readline83-001' | sha256sum -c -
echo 'e27364396ba9f6debf7cbaaf1a669e2b2854241ae07f7eca74ca8a8ba0c97472 readline83-002' | sha256sum -c -
echo '72dee13601ce38f6746eb15239999a7c56f8e1ff5eb1ec8153a1f213e4acdb29 readline83-003' | sha256sum -c -
echo '1f189c4566aa35950964647b9ec3be1a821e42b86048129c63eb7f9d4d2f5a74 readline83-004' | sha256sum -c -
echo '5481adbe161c9f6ba972c74db9e18c7aa351d3df3035cc4a673a1aa06247d1c6 readline83-005' | sha256sum -c -
echo '4ebd261a608287796e171af0ea9af5a1e3122e46672accda2484b6698c47c1a4 readline83-006' | 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/readline
SRC=$SRC_ROOT/readline-8.3
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf readline-8.3.tar.gz -C "$SRC" --strip-components=1
cp readline83-001 "$SRC"
cp readline83-002 "$SRC"
cp readline83-003 "$SRC"
cp readline83-004 "$SRC"
cp readline83-005 "$SRC"
cp readline83-006 "$SRC"
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 recipe’s helpers _patches, _pfx and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
for p in "$_pfx"-[0-9][0-9][0-9]; do
patch -p0 -i "$p"
done
./configure --prefix=/usr \
--with-curses --with-shared-termcap-library \
--disable-static --disable-install-examples \
bash_cv_termcap_lib=libncursesw
_xld='SHLIB_XLDFLAGS=-Wl,-soname,`basename $@ $(SHLIB_MINOR)`'
make "$_xld"
make DESTDIR=$PKG "$_xld" install
test -z "$(readelf -d "$PKG"/usr/lib/libreadline.so.*.* | grep -i 'rpath\|runpath')"
The switches, and why each is set:
--with-curses— prefer a curses library to a termcap one for the terminal functions (tgetent,tputsand the rest). configure consults the preference only when its search ends at atermcaplibrary or at readline’s bundled termcap; withbash_cv_termcap_libgiven below, it never searches, so the switch changes nothing in this build.--with-shared-termcap-library— linklibreadline.soitself against that library, so the shared library records that it needslibncursesw.so.6and a program linking readline does not have to name ncurses as well. readline’s default leaves that to each program.--disable-install-examples— do not copy the C sources of readline’s example programs (examples/*.c) into/usr/share/readline.bash_cv_termcap_lib=libncursesw— answer, in advance, configure’s question of which library holdstgetent. Left to search, configure tries libc,termcap,tinfoandcursesbeforencursesw, and finds it inlibcurses.so, the compatibility link the ncurses port installs. The link line would then name-lcursesand theRequires.private:ofreadline.pcwould namencurses, both aliases; with the answer they namencursesw, the library itself.SHLIB_XLDFLAGS— the linker flags readline’s makefiles add when they link the shared libraries. readline’s default for Linux is-Wl,-rpath,$(libdir) -Wl,-soname,…; the recipe passes the soname part alone, on bothmakelines, solibreadline.soandlibhistory.socarry no run-time search path. A plain/usr/libRPATHis one of the findings the package lint warns on, and it names a directory the loader searches anyway.
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/readline, 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 readline-8.3-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/readline, and runs the triggers its paths call for.
Contents
Installed libraries: libhistory.so, libreadline.so.
Installed directories: /usr/include/readline, /usr/share/doc/readline, /usr/share/licenses/readline.
Short descriptions
history.pc |
Gnu History library for managing previously-entered lines |
readline.pc |
Gnu Readline library for command line editing |
Notes
The last line of build.sh is a check, not a build step: it reads the dynamic section of the installed libreadline.so and fails the build if it carries an RPATH or RUNPATH. A change that lets readline’s default -rpath through stops the build there instead of shipping it.