ncurses - ncurses = new curses; screen handling and optimization ChangeLog

HOWTO


# GNU Ncurses 6.5 (2024-04-27)
# ===============
# Slackware 14.0, 14.1, 14.2: ncurses 5.9
# Slackware 15.0: ncurses 6.3

# Many other pieces of software can be removed before you install a new
# version with little to no ill-effects, 'make uninstall' the old one, 'make
# install' the new one.  ncurses is so widely used that you may not be able
# to get away with that, without breaking a bunch of things.  Below we blow
# away files that may be left over from old source-installed versions of
# ncurses, ass|u|me'ing that you still have libncurses in /lib or /lib64
# from Slackware's aaa_elflibs|aaa_libraries package to keep things working
# that use it.  If you are not comfortable with that, skip the cleanup part
# before 'make install' below, then either leave it all there and hope for
# the best, or manually clean up files after the new version is installed -
# look for a date that is other than today.  ...install, removepkg, install
# again.
#
# Loads of console programs like dialog, lynx, mc, mutt, ncftp, joe, vim,
# etc. use ncurses and even things like the Dropbox daemon do, so running
# something like:
#   lsof /lib*/libncurses*.* /usr/lib*/libncurses*.*
# is not a bad idea, to find out what running programs are using it.
# There are MANY more other than running daemons, e.g. gawk is linked with
# libtinfo for example.

# The home page for Ncurses is https://invisible-island.net/ncurses/
# and the GNU page for it is here:
# https://www.gnu.org/software/ncurses/
# (it may only redirect to the other one)

# If you have any trouble downloading Ncurses as done below, you can get
# it here:
# https://invisible-island.net/ncurses/
# https://invisible-mirror.net/archives/ncurses/
# https://ftpmirror.gnu.org/ncurses/ (automatic redirect)
# https://www.gnu.org/prep/ftp.html (mirror list)

# info-gnu: ncurses 6.5
# Release Notes
# Thomas E. Dickey's software development projects (including a Public Keys link)
# invisible-island.net PGP Keys
# Slackware64-current: ncurses source
# packages.slackware.com: slackware64-current ncurses

# Prerequisites:
# pkg-config
# ctags

# Create a directory for the tarball and patches
mkdir -p -m 0700 ~/installed/ncurses

# Get the source tarball
cd
test -f installed/ncurses/ncurses-6.5.tar.gz &&
mv -f installed/ncurses/ncurses-6.5.tar.gz .
test ! -f ncurses-6.5.tar.gz &&
wget http://ftpmirror.gnu.org/ncurses/ncurses-6.5.tar.gz

# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "136d91bc269a9a5785e5f9e980bc76ab57428f604ce3e5a5a90cebc767971c\
c6  ncurses-6.5.tar.gz" | sha256sum -c

# Verify tarball w/ gpg:
# (https://invisible-island.net/public/public.html)
# (gpg --locate-keys dickey@invisible-island.net)
( gpg --list-keys CC2AF4472167BE03 > /dev/null 2>&1 ||
  gpg --keyserver keyserver.ubuntu.com --recv-keys CC2AF4472167BE03 ) &&
wget -nc http://ftpmirror.gnu.org/ncurses/ncurses-6.5.tar.gz.sig &&
  gpg --verify ncurses-6.5.tar.gz.sig && rm ncurses-6.5.tar.gz.sig

# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "ncurses-*" -exec rm -r {} \;
tar xzvf ~/ncurses-6.5.tar.gz
cd ncurses-6.5
test $UID = 0 && chown -R root:root .

# gpg-verify, then apply patches that have come out since the full release
# if there is one, the latest rollout patch:
# [ Note: I skip the 20240427 patch, already applied to 6.5 ]
gpg --list-keys CC2AF4472167BE03 > /dev/null 2>&1 ||
gpg --recv-keys CC2AF4472167BE03
mv -f ~/installed/ncurses/ncurses-6.5-*.patch.gz .
rm -f ~/installed/ncurses/ncurses-*.patch.gz
mv -f ~/installed/ncurses/dev-patches.zip .
wget -N https://invisible-mirror.net/archives/ncurses/6.5/dev-patches.zip
unzip -n dev-patches.zip && mv -f dev-patches.zip ~/installed/ncurses/
chmod u+w ncurses-6.5-*.patch.gz*
for file in ncurses-6.5-*.patch.gz;
do
  test "$file" = "ncurses-6.5-20240427.patch.gz" &&
   rm -f "$file" "${file}.asc" && continue
  test -f ${file}.asc && gpg --verify ${file}.asc && rm ${file}.asc
  zcat $file | patch -p1 -N && mv -f $file ~/installed/ncurses/
  echo "$file - press enter to continue"
  read
done

# Configure the build for 64-bit
# Build #1 - ncurses.so.6.5
# [ I'll just duplicate this for 64-bit and not for readability, there
#   are some different configure options, lib64 vs lib, etc. ]
test $(uname -m) = 'x86_64' &&
CFLAGS="-O2 -fPIC" ./configure --prefix=/usr --libdir=/usr/lib64 \
--mandir=/usr/man --with-shared \
--enable-colorfgbg \
--enable-hard-tabs \
--enable-pc-files \
--enable-symlinks \
--enable-xmc-glitch \
--with-chtype=long \
--with-cxx-shared \
--with-mmask-t=long \
--with-pkg-config-libdir=/usr/lib64/pkgconfig \
--with-termlib=tinfo \
--with-ticlib=tic \
--with-versioned-syms \
--without-ada \
--without-debug \
--without-normal \
--disable-widec

# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
CFLAGS="-O2" ./configure --prefix=/usr \
--mandir=/usr/man --with-shared \
--enable-colorfgbg \
--enable-hard-tabs \
--enable-pc-files \
--enable-symlinks \
--enable-xmc-glitch \
--with-cxx-shared \
--with-pkg-config-libdir=/usr/lib/pkgconfig \
--with-termlib=tinfo \
--with-ticlib=tic \
--with-versioned-syms \
--without-ada \
--without-debug \
--without-normal \
--disable-widec

# Build it
make

# Become root to clean up old files and to install it
su

# Save a copy of every actual shared library file (or the Slackware package)
# in case it goes badly and you have to manually copy it back in place
# and create symlinks.  Also do this for libform, libmenu, libpanel too if
# necessary.
find /lib*/ /usr/lib*/ -type f -name "libncurses*.so.*" \
-exec cp -ip {} /root/ \;

# The new shared libraries will be .so.6.5
# If you have an older libncurses*.so.5.* from the aaa_elflibs package,
# you probably want to leave that in place

# As I write this, Slackware 15.0 and current no longer include a libtermcap
# package, and ncurses includes a /usr/include/termcap.h ...
text -x /sbin/removepkg && /sbin/removepkg libtermcap

# Remove Slackware package, if there is one
test -x /sbin/removepkg && /sbin/removepkg ncurses

# Remove files from old source-installed versions.
# The safer thing to do is NOT do this and check everything carefully
# and manually after the new version is installed.
( cd /usr/bin ; rm -f clear infocmp ncurses5-config ncursesw5-config \
  ncurses6-config ncursesw6-config tabs tic toe tput tset )
find /usr/doc -maxdepth 1 -type d -name "ncurses-*" -exec rm -r {} \;
test -d /usr/doc/ncurses && rm -r /usr/doc/ncurses
find /usr/include -type l -ilname "ncurses/*" -exec rm -r {} \;
test -L /usr/include/ncursesw && rm -f /usr/include/ncursesw
test -d /usr/include/ncurses && rm -r /usr/include/ncurses
test -d /usr/include/ncursesw && rm -r /usr/include/ncursesw
for lib in libform libformw libmenu libmenuw libncurses++ libncurses++w \
libncurses libncursest libcursestw libncursesw libpanel libpanelw;
do
  ( cd /usr/lib ; rm -f "./${lib}.*" )
  test -d /usr/lib64 && ( cd /usr/lib64 ; rm -f "./${lib}.*" )
done

# If you have a termcap.h from the libtermcap package (Slackware <= 14.2)
# and you want to move it out of the way for the one from ncurses:
grep -q usr/include/termcap.h /var/adm/packages/libtermcap* &&
test ! -L /usr/include/termcap.h &&
  mv -f /usr/include/termcap.h /usr/include/termcap.h.orig

# Slackware puts the includes in /usr/include/ncurses/
# The source puts them in /usr/include/
# If any of these exists as a symlink in /usr/include, remove it
for file in include/*.h; do test -L /usr/${file} && rm /usr/${file}; done

# Install the new version
make install

# Create a /etc/termcap file
# (to revert back to the one from the 'etc' package,
#  copy or symlink /etc/termcap-Linux to /etc/termcap)
cp -a /etc/termcap /etc/termcap.old
tic -C -t misc/terminfo.src > /etc/termcap
touch -r misc/terminfo.src /etc/termcap

# If it exists, create symlinks from the *.h files in /usr/include/ncurses/
# to /usr/include
( cd /usr/include
  test -d ncurses &&
   for file in ncurses/*.h ; do ln -sf $file . ; done )

# Become yourself again (to rebuild it)
exit

# Clean the previous build files
make clean

## Configure build #2 (libncursesw.so.*) for 64-bit
test $(uname -m) = 'x86_64' &&
CFLAGS="-O2 -fPIC" ./configure --prefix=/usr --libdir=/usr/lib64 \
--mandir=/usr/man --with-shared \
--enable-colorfgbg \
--enable-hard-tabs \
--enable-pc-files \
--enable-symlinks \
--enable-xmc-glitch \
--with-chtype=long \
--with-cxx-shared \
--with-mmask-t=long \
--with-pkg-config-libdir=/usr/lib64/pkgconfig \
--with-termlib=tinfo \
--with-ticlib=tic \
--with-versioned-syms \
--without-ada \
--without-debug \
--without-normal

# Configure the build for anything else
test $(uname -m) != 'x86_64' &&
CFLAGS="-O2" ./configure --prefix=/usr \
--mandir=/usr/man --with-shared \
--enable-colorfgbg \
--enable-hard-tabs \
--enable-pc-files \
--enable-symlinks \
--enable-xmc-glitch \
--with-cxx-shared \
--with-pkg-config-libdir=/usr/lib/pkgconfig \
--with-termlib=tinfo \
--with-ticlib=tic \
--with-versioned-syms \
--without-ada \
--without-debug \
--without-normal

# Re-build it
make


# Become root to install it
su

# Install the 'w' version of everything
# It will just install the same man pages, /usr/share/terminfo files...
make install



# Move libncurses library files into /lib*/ because Slackware does
# (in case /usr is not in the same location as / and not mounted yet)
# libform, libmenu, libncurses++, libpanel can stay in /usr/lib*/
LIBDIR=lib
test $(uname -m) = 'x86_64' && LIBDIR=lib64
( cd /usr/${LIBDIR}
  rm -f libcurses.so libcursesw.so libncurses.so libncursesw.so
  rm -f libtic.so libticw.so
  rm -f libtinfo.so libtinfow.so
  mv -f libncurses.so.* /${LIBDIR}/
  mv -f libncursesw.so.* /${LIBDIR}/
  mv -f libtic.so.* /${LIBDIR}/
  mv -f libtinfo.so.* /${LIBDIR}/
  mv -f libtinfow.so.* /${LIBDIR}/ )

# Fix up symlinks within /lib*/
# Leave older ones alone, we only handle .so, .so.6, .so.6.5
( cd /${LIBDIR}
  rm -f libcurses.so libncurses.so libncurses.so.6 libncursesw.so \
   libncursesw.so.6 libtic.so.6 libtinfo.so.6 libtinfo.so libtinfow.so
  ln -sf libncurses.so.6.5 libncurses.so.6
  ln -sf libncurses.so.6 libncurses.so
  ln -sf libncursesw.so.6.5 libncursesw.so.6
  ln -sf libncursesw.so.6 libncursesw.so
  ln -sf libncurses.so libcurses.so
  ln -sf libtic.so.6.5 libtic.so.6
  ln -sf libtic.so.6 libtic.so
  ln -sf libtinfo.so.6.5 libtinfo.so.6
  ln -sf libtinfo.so.6 libtinfo.so )

# If you want things looking for -lcurses (no "n") and
# libncurses (no trailing "w") and -ltermcap to work
( cd /usr/${LIBDIR}
  rm -f libcurses.so libcursesw.so libncurses.so libncursesw.so libtermcap.so
  echo "INPUT(-lncurses)" > libcurses.so
  echo "INPUT(-lncursesw)" > libcursesw.so
  echo "INPUT(libncurses.so.6 -ltinfo)" > libncurses.so
  echo "INPUT(libncursesw.so.6 -ltinfo)" > libncursesw.so
  echo "INPUT(-ltinfo)" > libtermcap.so )

# Make sure the linker can see the libraries
ldconfig

# Unset the temporary lib or lib64
unset LIBDIR

# ncurses has a 'clear' and the textutils package has a 'clear'.  The latter
# is a shell script that runs 'tput clear'.  textutils, fileutils, and
# sh-utils became coreutils, and there was no clear in Slackware's coreutils
# last time I checked.

# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .

# Become yourself again
exit

# If you see anything about the terminal not being fully functional after
# this, you may need to try "TERM=linux" or something like that,
# the $TERM set before that did work may not work now.  To change it
# to a different default at login, see /etc/profile, /etc/profile.d/*,
# $HOME/.bash_login, $HOME/.bashrc, etc.

# Save the tarball for later
cd
mkdir -p -m 0700 installed/ncurses
rm -f installed/ncurses-*.tar.* installed/ncurses/ncurses-*.tar.*
mv ncurses-6.5.tar.gz installed/ncurses/

List of HOWTOs

Web page itself last updated: 2023-12-20 8:06pm (EDT -0400)
HOWTO last updated: 2025-04-17 9:08am
Copyright © 2001-2025 Jason Englander. All Rights reserved.
[HTML5]