6.13. Ncurses-5.7

The Ncurses package contains libraries for terminal-independent handling of character screens.

6.13.1. Environment Settings

This package requires compiler variables to be set for the target in the environment.

export CC="${CLFS_TARGET}-gcc"
export CXX="${CLFS_TARGET}-g++"
export AR="${CLFS_TARGET}-ar"
export AS="${CLFS_TARGET}-as"
export RANLIB="${CLFS_TARGET}-ranlib"
export LD="${CLFS_TARGET}-ld"
export STRIP="${CLFS_TARGET}-strip"

6.13.2. Installation of Ncurses

The following patch contains updates from the 5.7 branch by the Ncurses developers:

patch -Np1 -i ../ncurses-5.7-branch_update-18.patch

This patch fixes an issue with some Bash versions:

patch -Np1 -i ../ncurses-5.7-bash_fix-1.patch

Prepare Ncurses for compilation:

./configure --build=${CLFS_HOST} --host=${CLFS_TARGET} \
    --prefix=/usr --libdir=/lib --with-shared \
    --enable-widec --without-debug --without-ada \
    --with-manpage-format=normal \
    --with-build-cc="gcc -D_GNU_SOURCE"

Compile the package:

make

Install the package:

make DESTDIR=${CLFS} install

Move the Ncurses static libraries to the proper location:

mv -v ${CLFS}/lib/lib{panelw,menuw,formw,ncursesw,ncurses++w}.a \
    ${CLFS}/usr/lib

Create symlinks in /usr/lib:

rm -v ${CLFS}/lib/lib{ncursesw,menuw,panelw,formw}.so
ln -sfv ../../lib/libncursesw.so.5 ${CLFS}/usr/lib/libncursesw.so
ln -sfv ../../lib/libmenuw.so.5 ${CLFS}/usr/lib/libmenuw.so
ln -sfv ../../lib/libpanelw.so.5 ${CLFS}/usr/lib/libpanelw.so
ln -sfv ../../lib/libformw.so.5 ${CLFS}/usr/lib/libformw.so

Now we will make our Ncurses compatible for older and non-widec compatible programs can build properly:

for lib in curses ncurses form panel menu ; do
        echo "INPUT(-l${lib}w)" > ${CLFS}/usr/lib/lib${lib}.so
        ln -sfv lib${lib}w.a ${CLFS}/usr/lib/lib${lib}.a
done
ln -sfv libncursesw.so ${CLFS}/usr/lib/libcursesw.so
ln -sfv libncursesw.a ${CLFS}/usr/lib/libcursesw.a
ln -sfv libncurses++w.a ${CLFS}/usr/lib/libncurses++.a
ln -sfv ncursesw5-config ${CLFS}/usr/bin/ncurses5-config

Now we will create a symlink for /usr/share/terminfo in /usr/lib for compatibility:

ln -sfv ../share/terminfo ${CLFS}/usr/lib/terminfo

6.13.3. Contents of Ncurses

Installed programs: captoinfo (link to tic), clear, infocmp, infotocap (link to tic), ncursesw5-config, reset (link to tset), tabs, tic, toe, tput, and tset
Installed libraries: libcursesw.so (link to libncursesw.so), libformw.[a,so], libmenuw.[a,so], libncurses++w.a, libncursesw.[a,so], and libpanelw.[a,so]

Short Descriptions

captoinfo

Converts a termcap description into a terminfo description

clear

Clears the screen, if possible

infocmp

Compares or prints out terminfo descriptions

infotocap

Converts a terminfo description into a termcap description

ncursesw5-config

Provides configuration information for ncurses

reset

Reinitializes a terminal to its default values

tabs

Sets and clears tab stops on a terminal

tic

The terminfo entry-description compiler that translates a terminfo file from source format into the binary format needed for the ncurses library routines. A terminfo file contains information on the capabilities of a certain terminal

toe

Lists all available terminal types, giving the primary name and description for each

tput

Makes the values of terminal-dependent capabilities available to the shell; it can also be used to reset or initialize a terminal or report its long name

tset

Can be used to initialize terminals

libcursesw

A link to libncursesw

libncursesw

Contains functions to display text in many complex ways on a terminal screen; a good example of the use of these functions is the menu displayed during the kernel's make menuconfig

libformw

Contains functions to implement forms

libmenuw

Contains functions to implement menus

libpanelw

Contains functions to implement panels