34.1. ncurses-6.6
System V Release 4.0 curses emulation library
| Version | 6.6, release 2 |
| Shelf | base-libs — Low-level C libraries that the base system links |
| Phase | 20_selfhost (Self-Hosting Bootstrap), 11 of 15 in build order |
| Licence | X11-distribute-modifications-variant |
| Homepage | https://invisible-island.net/ncurses/ |
| Build time | 0.8 SBU |
| Installed size | 7.0 MiB in 3901 files |
| Recipe | ports/core/base-libs/ncurses/kpkgbuild |
About
ncurses is the terminal-handling library behind full-screen text programs: it reads the terminfo database to learn what a terminal can do and draws windows, colours and menus through it. It also installs the terminfo database itself and the tools that compile and query it, tic, infocmp and tput. readline, bash and the text-mode programs of the tree build against it, and 20_selfhost builds it because gawk needs readline.
KDOS builds one ncurses, the wide-character one, and makes every other name a build may ask for point at it. Its headers go flat into /usr/include, with no ncursesw/ directory; what that means for a port that includes <ncursesw/ncurses.h> or wants the wide API is in The wide curses API.
Sources
ncurses-6.6.tar.gz(3.6 MiB)
sha256355b4cbbed880b0381a04c46617b7656e362585d52e9cf84a67e2009b749ff11
upstream: https://mirrors.ocf.berkeley.edu/gnu/ncurses/ncurses-6.6.tar.gz
archive copy: sources-1/base-libs--ncurses-6.6.tar.gz
Dependencies
Depends on: nothing a recipe names.
Required by (79): aalib, alsa-utils, aspell, bash, bc, bitwise, bladerf, brltty, bsd-games, calcurse, clamav, cmake, cmus, frotz, gdb, gdbm, gettext, ghc, gnugo, gpsd, gptfdisk, guile, htop, hunspell, hwloc, iftop, iotop, kalgebra, kdos-bb, lagrange, lame, less, libcdio, libcec, libedit, lldb, lnav, lynx, minicom, moon-buggy, mosh, mtr, nano, ncdu, nethack, newsboat, ngspice, nvtop, octave, partclone, parted, pinentry, pipewire, powertop, predict, procps-ng, profanity, psmisc, pv, python3, qemu, readline, samba, samtools, sc-im, sdcc, sfeed, sqlite, stfl, testdisk, texinfo, tig, tlf, tmux, util-linux, vlc, w3m, weechat, zsh.
Differs from the bootstrap build. Ncurses builds this source too, in script/phases/10_bootstrap/040_ncurses.sh, before kpkg exists.
Only in the bootstrap build: --build=$(../config.guess), --disable-stripping, --host=$KDOS_TARGET, --prefix=$CROSS_SYSROOT, --with-manpage-format=normal, --without-ada, --without-normal.
Only in this build: --disable-pkg-ldflags, --enable-pc-files, --with-pkg-config-libdir=/usr/lib/pkgconfig.
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 ncurses'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/base-libs/ncurses.
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/ncurses
echo '355b4cbbed880b0381a04c46617b7656e362585d52e9cf84a67e2009b749ff11 ncurses-6.6.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/ncurses
SRC=$SRC_ROOT/ncurses-6.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf ncurses-6.6.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:
./configure --prefix=/usr \
--mandir=/usr/share/man \
--with-shared \
--without-debug \
--with-cxx-shared \
--enable-pc-files \
--disable-pkg-ldflags \
--enable-widec \
--with-pkg-config-libdir=/usr/lib/pkgconfig
make
make DESTDIR=$PKG install
for lib in ncurses form panel menu; do
ln -sf lib${lib}w.so $PKG/usr/lib/lib${lib}.so
ln -sf ${lib}w.pc $PKG/usr/lib/pkgconfig/${lib}.pc
done
ln -sf libncurses.so $PKG/usr/lib/libcurses.so
The switches, and why each is set:
--mandir=/usr/share/man— install the manual pages in/usr/share/man. This is also what configure’s default,${datarootdir}/man, comes to under--prefix=/usr; the switch names it.--with-shared— build shared libraries as well as the static ones configure builds by default.--without-debug— skip the_gdebugging variants of each library, which configure builds by default.--with-cxx-shared— build the C++ binding,libncurses++w, as a shared library too.--enable-pc-files— install a pkg-config file for each library (ncursesw.pc,formw.pcand the rest).--disable-pkg-ldflags— keep the linker flags of this build out of those.pcfiles and out ofncursesw6-config. Without it configure copies$LDFLAGSinto them, and every program that asks pkg-config how to link ncurses would be handed this build’s release flags as well.--enable-widec— build the wide-character libraries, which handle UTF-8. Each carries awin its name:libncursesw,libformw,libmenuw,libpanelw. For this ABI it is configure’s default; the switch names it.--with-pkg-config-libdir=/usr/lib/pkgconfig— install the.pcfiles there. Left to itself, configure takes the first directory of$PKG_CONFIG_PATHthat exists. The chroot’sPKG_CONFIG_PATH(fromscript/env/chroot.env) starts with/usr/local/share/pkgconfig,/usr/local/lib/pkgconfig,/usr/local/lib64/pkgconfigand/usr/share/pkgconfig, so the files would land in the first of those the root holds when the port builds, ahead of/usr/lib/pkgconfiglater in the list.
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/ncurses, 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 ncurses-6.6-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/ncurses, and runs the triggers its paths call for.
Contents
Installed programs: captoinfo, clear, infocmp, infotocap, ncursesw6-config, reset, tabs, tic, toe, tput, tset.
Installed libraries: libcurses.so, libform.so, libformw.a, libformw.so, libmenu.so, libmenuw.a, libmenuw.so, libncurses++w.a, libncurses++w.so, libncurses.so, libncursesw.a, libncursesw.so, libpanel.so, libpanelw.a, libpanelw.so.
Installed directories: /usr/share/licenses/ncurses, /usr/share/tabset, /usr/share/terminfo.
Short descriptions
captoinfo |
convert a termcap description into a terminfo description |
clear |
clear the terminal screen |
infocmp |
compare or print out terminfo descriptions |
infotocap |
convert a terminfo description into a termcap description |
ncursesw6-config |
configuration helper for ncurses libraries |
tabs |
set terminal tab stops |
tic |
compile terminal descriptions for terminfo or termcap |
toe |
list table of entries of terminfo terminal types |
tput |
initialize a terminal, exercise its capabilities, or query terminfo database |
tset |
initialize or reset terminal state |
formw.pc |
ncurses 6.6 add-on library |
menuw.pc |
ncurses 6.6 add-on library |
ncurses++w.pc |
ncurses 6.6 add-on library |
ncursesw.pc |
ncurses 6.6 library |
panelw.pc |
ncurses 6.6 add-on library |
Notes
The for loop after the install links the names without the w to the wide libraries: libncurses.so, libform.so, libmenu.so and libpanel.so, and the .pc files of the same names. libcurses.so then links to libncurses.so. A build that asks for -lncurses, -lcurses or pkg-config ncurses gets the wide library, and nothing in the tree links a narrow one, because there is none.
Those links are also what readline’s configure finds first when it searches for the library holding tgetent, which is why that port names libncursesw outright.