# 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.
# 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
# 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 )
# 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}/ )
# 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/