8.31. Ncurses-6.5

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

Approximate build time: 0.2 SBU
Required disk space: 46 MB

8.31.1. Installation of Ncurses

Prepare Ncurses for compilation:

./configure --prefix=/usr           \
            --mandir=/usr/share/man \
            --with-shared           \
            --without-debug         \
            --without-normal        \
            --with-cxx-shared       \
            --enable-pc-files       \
            --with-pkg-config-libdir=/usr/lib/pkgconfig

The meaning of the new configure options:

--with-shared

This makes Ncurses build and install shared C libraries.

--without-normal

This prevents Ncurses building and installing static C libraries.

--without-debug

This prevents Ncurses building and installing debug libraries.

--with-cxx-shared

This makes Ncurses build and install shared C++ bindings. It also prevents it building and installing static C++ bindings.

--enable-pc-files

This switch generates and installs .pc files for pkg-config.

Compile the package:

make

This package has a test suite, but it can only be run after the package has been installed. The tests reside in the test/ directory. See the README file in that directory for further details.

The installation of this package will overwrite libncursesw.so.6.5 in-place. It may crash the shell process which is using code and data from the library file. Install the package with DESTDIR, and replace the library file correctly using install command (the header curses.h is also edited to ensure the wide-character ABI to be used as what we've done in Section 6.3, “Ncurses-6.5”):

make DESTDIR=$PWD/dest install
install -vm755 dest/usr/lib/libncursesw.so.6.5 /usr/lib
rm -v  dest/usr/lib/libncursesw.so.6.5
sed -e 's/^#if.*XOPEN.*$/#if 1/' \
    -i dest/usr/include/curses.h
cp -av dest/* /

Many applications still expect the linker to be able to find non-wide-character Ncurses libraries. Trick such applications into linking with wide-character libraries by means of symlinks (note that the .so links are only safe with curses.h edited to always use the wide-character ABI):

for lib in ncurses form panel menu ; do
    ln -sfv lib${lib}w.so /usr/lib/lib${lib}.so
    ln -sfv ${lib}w.pc    /usr/lib/pkgconfig/${lib}.pc
done

Finally, make sure that old applications that look for -lcurses at build time are still buildable:

ln -sfv libncursesw.so /usr/lib/libcurses.so

If desired, install the Ncurses documentation:

cp -v -R doc -T /usr/share/doc/ncurses-6.5
[Note]

Note

The instructions above don't create non-wide-character Ncurses libraries since no package installed by compiling from sources would link against them at runtime. However, the only known binary-only applications that link against non-wide-character Ncurses libraries require version 5. If you must have such libraries because of some binary-only application or to be compliant with LSB, build the package again with the following commands:

make distclean
./configure --prefix=/usr     \
            --with-shared     \
            --without-normal  \
            --with-cxx-shared \
            --without-debug   \
            --without-cxx-binding \
            --with-abi-version=5
make sources libs
cp -av lib/lib*.so.5* /usr/lib

8.31.2. Building Ncurses - 32bit

Clean previous build:

make distclean

Prepare Ncurses for compilation:

CC="gcc -m32" CXX="g++ -m32" \
./configure --prefix=/usr           \
            --host=i686-pc-linux-gnu \
            --libdir=/usr/lib32     \
            --mandir=/usr/share/man \
            --with-shared           \
            --without-debug         \
            --without-normal        \
            --with-cxx-shared       \
            --enable-pc-files       \
            --with-pkg-config-libdir=/usr/lib32/pkgconfig

Compile the package:

make

Install the package:

make DESTDIR=$PWD/DESTDIR install
mkdir -p DESTDIR/usr/lib32/pkgconfig
for lib in ncurses form panel menu ; do
    rm -vf                    DESTDIR/usr/lib32/lib${lib}.so
    echo "INPUT(-l${lib}w)" > DESTDIR/usr/lib32/lib${lib}.so
    ln -svf ${lib}w.pc        DESTDIR/usr/lib32/pkgconfig/$lib.pc
done
rm -vf                     DESTDIR/usr/lib32/libcursesw.so
echo "INPUT(-lncursesw)" > DESTDIR/usr/lib32/libcursesw.so
ln -sfv libncurses.so      DESTDIR/usr/lib32/libcurses.so
cp -Rv DESTDIR/usr/lib32/* /usr/lib32
rm -rf DESTDIR

8.31.3. Building Ncurses - x32bit

Clean previous build:

make distclean

Prepare Ncurses for compilation:

CC="gcc -mx32" CXX="g++ -mx32" \
./configure --prefix=/usr           \
            --host=x86_64-pc-linux-gnux32 \
            --libdir=/usr/libx32    \
            --mandir=/usr/share/man \
            --with-shared           \
            --without-debug         \
            --without-normal        \
            --enable-pc-files       \
            --with-pkg-config-libdir=/usr/libx32/pkgconfig

Compile the package:

make

Install the package:

make DESTDIR=$PWD/DESTDIR install
mkdir -p DESTDIR/usr/libx32/pkgconfig
for lib in ncurses form panel menu ; do
    rm -vf                    DESTDIR/usr/libx32/lib${lib}.so
    echo "INPUT(-l${lib}w)" > DESTDIR/usr/libx32/lib${lib}.so
    ln -svf ${lib}w.pc        DESTDIR/usr/libx32/pkgconfig/$lib.pc
done
rm -vf                     DESTDIR/usr/libx32/libcursesw.so
echo "INPUT(-lncursesw)" > DESTDIR/usr/libx32/libcursesw.so
ln -sfv libncurses.so      DESTDIR/usr/libx32/libcurses.so
cp -Rv DESTDIR/usr/libx32/* /usr/libx32
rm -rf DESTDIR

8.31.4. Contents of Ncurses

Installed programs: captoinfo (link to tic), clear, infocmp, infotocap (link to tic), ncursesw6-config, reset (link to tset), tabs, tic, toe, tput, and tset
Installed libraries: libcurses.so (symlink), libform.so (symlink), libformw.so, libmenu.so (symlink), libmenuw.so, libncurses.so (symlink), libncursesw.so, libncurses++w.so, libpanel.so (symlink), and libpanelw.so,
Installed directories: /usr/share/tabset, /usr/share/terminfo, and /usr/share/doc/ncurses-6.5

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

ncursesw6-config

Provides configuration information for ncurses

reset

Reinitializes a terminal to its default values

tabs

Clears and sets 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

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

libncurses++w

Contains C++ binding for other libraries in this package

libformw

Contains functions to implement forms

libmenuw

Contains functions to implement menus

libpanelw

Contains functions to implement panels