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

12. Ncurses

ncurses is the terminal library: it knows, from the terminfo database, how to move the cursor and draw on every kind of terminal. Readline and Bash link it later in the bootstrap, and every full-screen program after them. The step builds it twice from one source: first a tic for the container, then the library for KDOS. This page shows the commands of script/phases/10_bootstrap/040_ncurses.sh and explains both halves.

Source: the archive of the ncurses port
Installs into: build/fs/usr, and one program into build/cross/bin
Approximate build time: 1.0 SBU

A tic for the container

NCURSES_SRC=$(extract_port_source ncurses)

cd "$NCURSES_SRC"
mkdir -p build1 && cd build1
../configure --prefix=$CROSS_SYSROOT
make -C include
make -C progs tic
install progs/tic $CROSS_SYSROOT/bin
cd ..

script/phases/10_bootstrap/040_ncurses.sh, lines 24–32

tic compiles terminal descriptions into the terminfo database, and the install of the KDOS build below runs it to write that database into build/fs. The tic the KDOS build compiles cannot run in the container, and a tic from another ncurses might write a database format this one does not read. So the first configure, with no --host, builds for the container: only the generated headers (make -C include) and tic itself (make -C progs tic), with no library to install.

tic is copied into build/cross/bin, which host.env puts first on PATH. When the second configure looks for a tic to run, as a cross build of ncurses does, this is the one it finds.

Installation of ncurses

mkdir -p build && cd build

../configure \
    --host=$KDOS_TARGET \
    --build=$(../config.guess)    \
    --prefix=/usr \
    --mandir=/usr/share/man      \
    --with-manpage-format=normal \
    --with-shared                \
    --without-normal             \
    --with-cxx-shared            \
    --without-debug              \
    --without-ada                \
    --enable-widec               \
    --disable-stripping

make DESTDIR=$SYSROOT install

script/phases/10_bootstrap/040_ncurses.sh, lines 34–50

The meaning of the configure options

--host=$KDOS_TARGET, --build=$(../config.guess), --prefix=/usr
A cross build for KDOS, installed under /usr (see Part III).
--mandir=/usr/share/man
Put the manual pages where the rest of the system’s are.
--with-manpage-format=normal
Install the manual pages uncompressed. Left to itself, configure guesses the format from the container’s existing pages.
--with-shared, --without-normal
Build shared libraries and no static ones. Nothing in the bootstrap links ncurses statically.
--with-cxx-shared
Build the C++ binding as a shared library too.
--without-debug
Build no debugging variants of the libraries.
--without-ada
Build no Ada binding, and do not look for an Ada compiler.
--enable-widec
Build the wide-character library, which handles UTF-8. Its files carry a w: libncursesw.so, libformw.so, libmenuw.so, libpanelw.so. readline is linked with -lncursesw in step 070 for that reason; this step makes no libncurses.so without the w.
--disable-stripping
Do not strip the programs during install. The install would run the container’s strip on programs compiled for KDOS.

Contents of ncurses

Installed programs: clear, infocmp, tabs, tic, toe, tput, tset, and the links captoinfo, infotocap and reset; ncursesw6-config.

Installed libraries: libncursesw.so, libformw.so, libmenuw.so, libpanelw.so and libncurses++w.so.

Installed directories: the headers in /usr/include, and the terminfo database in /usr/share/terminfo, with /usr/lib/terminfo a link to it.

The ncurses port’s page describes each program.

Built again later

The ncurses port is built in 20_selfhost, whose list does not name it: gawk there depends on readline, which depends on ncurses. It builds natively, so it needs no tic of its own first, and it differs in these switches:

See also