# Below I just blow away existing library files before running 'make
# install' to ensure that extra files aren't left behind that are no longer
# needed. If you run a production system with multiple local users (or some
# daemon) that may be using something linked with libreadline and/or
# libhistory, you'll want to skip that part below and you should clean up old
# files manually after you're done installing readline. Try using
# lsof to see what might be using libreadline.so at that moment.
# Get it
cd
test -f installed/readline-7.0.tar.gz && mv installed/readline-7.0.tar.gz .
test ! -f readline-7.0.tar.gz &&
wget http://ftpmirror.gnu.org/readline/readline-7.0.tar.gz
# Verify tarball w/ sha1sum:
# (this came from my gpg-verified tarball)
echo "d9095fa14a812495052357e1d678b3f2ac635463 readline-7.0.tar.gz" | \
sha1sum -c
# Verify tarball w/ sha256sum:
# (this also came from my gpg-verified tarball)
echo "750d437185286f40a369e1e4f4764eda932b9459b5ec9a731628393dd3d32334 r\
eadline-7.0.tar.gz" | sha256sum -c
# Extract the tarball
mkdir -p -m 0700 src
cd src
find -maxdepth 1 -type d -name "readline-*" -exec rm -r {} \;
tar xzvf ~/readline-7.0.tar.gz
cd readline-7.0
test $UID = 0 && chown -R root:root .
# Apply patches
# In case this is done again to rebuild, we do not save *.rej files here
gpg --list-keys 64EA74AB > /dev/null 2>&1 || gpg --recv-keys 64EA74AB
for pnum in $(seq -f "%03g" -s ' ' 5); do
wget -nc \
http://ftpmirror.gnu.org/gnu/readline/readline-7.0-patches/\
readline70-${pnum} \
http://ftpmirror.gnu.org/gnu/readline/readline-7.0-patches/\
readline70-${pnum}.sig &&
gpg --verify readline70-${pnum}.sig && rm readline70-${pnum}.sig &&
patch -p0 -N -r - < readline70-${pnum}
echo "Hit enter to continue"
read
done
## Build it
# If your /usr/share/info is a symlink to /usr/info, you can skip that part
# If your /usr/share/man is a symlink to /usr/man, you can skip that part
# If you want to use termcap instead of curses/ncurses, skip that part
# Configure the build for 64-bit
test $(uname -m) = 'x86_64' &&
./configure --prefix=/usr --docdir=/usr/doc/readline-7.0 \
--infodir=/usr/info --libdir=/usr/lib64 --mandir=/usr/man --with-curses
# Configure the build for 64-bit
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --docdir=/usr/doc/readline-7.0 \
--infodir=/usr/info --mandir=/usr/man --with-curses
# Build it
make
# Become root to install it
su
# If you are upgrading from an older full version of readline, like 6.x to
# 7.x, you will most likely have programs that are linked to the shared
# library for the older versions. Check 'lsof /usr/lib*/libreadline.so*',
# restart those things after upgrading it to see if they start using the
# new one (i.e. they are linked to libreadline.so, not libreadline.so.6).
# The safe bet is to leave the old shared library files where they are
# unless you are 100% sure nothing is using them.
#
# Anything that was compiled with the static libreadline.a that you had
# installed at the itme will need to be rebuilt and reinstalled to use
# the new one.
# Remove the installed Slackware package
# libhistory.so.? and libreadline.so.? are also in the 'aaa_elflibs'
# package, so they should still be there after you remove the package
test -x /sbin/removepkg && /sbin/removepkg readline
# Remove old docs from previous versions
find /usr/doc -maxdepth 1 -type d -name "readline-*" -exec rm -r {} \;
# Again, as noted above, if you are 100% sure nothing is using them,
# which is unlikely, remove the old library files from previous versions.
# Maybe even save a copy of them too if you do this.
( cd /usr/lib ; rm -f libreadline.* libhistory.* )
test -d /usr/lib64 &&
( cd /usr/lib64 ; rm -f libreadline.* libhistory.* )
# Install the new one
make install
# If you've got programs installed that are looking for the old shared
# library files that are no longer there, this may help by creating
# symlinks from the old names to the new .so symlink
for libdir in /usr/lib /usr/lib64;
do
test ! -d $libdir && continue
test ! -L ${libdir}/${libname}.so && continue
for libname in libhistory libreadline;
do
for libver in $(seq -s ' ' 4 6);
do
test ! -L ${libdir}/${libname}.so.${libver} &&
ln -s ${libdir}/${libname}.so ${libdir}/${libname}.so.${libver}
test ! -L ${libdir}/${libname}.so.${libver} &&
ln -s ${libdir}/${libname}.so ${libdir}/${libname}.so.${libver}
done
done
done
# Update the libraries that 'ld' knows about via /etc/ld.so.cache
ldconfig
# If you use Perl and you have Term::ReadLine::Gnu installed, you should
# run this, or you may not be able to use the CPAN shell any more.
# If you don't know what I'm talking about, you probably don't need this,
# so don't bother.
# perl -MCPAN -e 'install Term::ReadLine::Gnu'
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
## Here is a list of some things that use readline. If they no longer run
## and you get an error like this:
# error while loading shared libraries: libreadline.so.6: cannot open shared
# object file: No such file or directory
## you should try creating symlinks as shown above.
# bc
# lftp
# parted
# ...and many more...
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/readline-*.tar.*
mv readline-7.0.tar.gz installed/
# If you ever want to uninstall readline, which I would NOT recommend,
# this should do it:
cd
rm -f installed/readline-*.tar.*
su
test -d src/readline-* && ( cd src/readline-* ; make uninstall )
find /usr/doc -maxdepth 1 -type d -name "readline-*" -exec rm -r {} \;
test -d /usr/doc/readline && rm -r /usr/doc/readline
test -d /usr/include/readline && rm -r /usr/include/readline
( cd /usr/info
rm -f history.info readline.info readline.info.gz rluserman.info )
( cd /usr/lib ; rm -f libhistory.* libreadline.* )
( cd /usr/man/man3 ; rm -f history.3 readline.3 readline.3.gz )
find /usr/share/doc -maxdepth 1 -type d -name "readline-*" -exec rm -r {} \;
test -d /usr/share/doc/readline && rm -r /usr/share/doc/readline
( cd /usr/share/info ; rm -f readline.info rluserman.info history.info )
( cd /usr/share/man/man3 ; rm -f history.3 readline.3 readline.3.gz )
test -d /usr/share/readline && rm -r /usr/share/readline
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "readline-*" -exec rm -r {} \;
rm -f ~/installed/readline-*.tar.*