# wget, Cyrus IMAP, Apache httpd, KDE, PHP, and other significant things use
# this library, so I would suggest shutting them down before upgrading this
# library or at least knowing what is running that uses it before beginning.
# Try running 'lsof /usr/lib*/libpcre*'
# (if you have lsof installed) to see if anything else is running that
# uses the PCRE shared library.
# Get the source
cd
test -f installed/pcre-8.45.tar.bz2 && mv installed/pcre-8.45.tar.bz2 .
test ! -f pcre-8.45.tar.bz2 &&
wget https://downloads.sf.net/pcre/pcre-8.45.tar.bz2
# Verify tarball w/ sha256sum:
# (this came from my gpg-verified tarball)
echo "4dae6fdcd2bb0bb6c37b5f97c33c2be954da743985369cddac3546e3218bff\
b8 pcre-8.45.tar.bz2" | sha256sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "pcre-*" -exec rm -r {} \;
tar xjvf ~/pcre-8.45.tar.bz2
cd pcre-8.45
test $UID = 0 && chown -R root:root .
# Something to consider...
#
# Slackware's pcre package puts the shared library files in /lib64 (or /lib)
# because they are important, used by setup scripts, /usr may not be mounted
# yet early on in the boot process, etc.
#
# After 'make install', rather than just removing the old files in /lib64,
# you may want to move the new, real .so.1.2.13 files to /lib64, then create
# symlinks pointing to them in /usr/lib64
# Just keep in mind, many things use libpcre, be careful
#
# Don't just use --libdir=/lib64 because that will also effect where the
# pkgconfig/libpcre*.pc files end up
# In the past, I've seen configure test for -lreadline and fail with this:
# libreadline.so: undefined reference to `tgetflag'
# and then I would do someting like run it again with LIBS=ltermcap
# The configure tests have been updated to try a different way if it fails
# Become root to clean up old files and to install it
su
# Because grep may be linked with the existing libpcre, and configure and
# 'make install' use grep, we can't run removepkg at this point - if your
# grep is linked with a shared libpcre (ldd /usr/bin/grep). If you're
# replacing a Slackware PCRE package, manually remove files from it except
# for /usr/lib*/libpcre* files. Look in ./zapme.txt after this, if the list
# looks good, run: cat zapme.txt | xargs rm -f
rm -f ./zapme.txt
egrep "^usr\/" /var/adm/packages/pcre-* |
egrep -v "\/$" | egrep -v "^usr\/(lib|lib64)\/" |
while read zapme; do echo "/${zapme}" >> ./zapme.txt; done
# Install it
make install
ldconfig
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# The Slackware package libpcre*.so* files will be in /lib64, not /usr/lib64
# If you are upgrading from a package and use the default of /usr/lib*/, you
# may find things are still using those and not the ones you just installed
# in to /usr/lib64
# If you did want to move them and create symlinks, assuming you are 64-bit,
# this is one way to do that:
( cd /usr/lib64
find . -type f -name "libpcre*.so*" -exec mv {} /lib64/ \;
find . -type l -name "libpcre*.so*" -exec rm {} \;
find /lib64 -type f -name "libpcre*.so*" -exec ln -s {} \;
ln -s /lib64/libpcre.so.1.2.13 libpcre.so.1
ln -s /lib64/libpcre.so.1.2.13 libpcre.so
ln -s /lib64/libpcre16.so.0.2.13 libpcre16.so.0
ln -s /lib64/libpcre16.so.0.2.13 libpcre16.so
ln -s /lib64/libpcre32.so.0.0.13 libpcre32.so.0
ln -s /lib64/libpcre32.so.0.0.13 libpcre32.so
ln -s /lib64/libpcrecpp.so.0.0.2 libpcrecpp.so.0
ln -s /lib64/libpcrecpp.so.0.0.2 libpcrecpp.so
ln -s /lib64/libpcreposix.so.0.0.7 libpcreposix.so.0
ln -s /lib64/libpcreposix.so.0.0.7 libpcreposix.so )
( cd /lib64
ln -sf libpcre.so.1.2.13 libpcre.so.1
ln -sf libpcre.so.1.2.13 libpcre.so
ln -sf libpcre16.so.0.2.13 libpcre16.so.0
ln -sf libpcre16.so.0.2.13 libpcre16.so
ln -sf libpcre32.so.0.0.13 libpcre32.so.0
ln -sf libpcre32.so.0.0.13 libpcre32.so
ln -sf libpcrecpp.so.0.0.2 libpcrecpp.so.0
ln -sf libpcrecpp.so.0.0.2 libpcrecpp.so
ln -sf libpcreposix.so.0.0.7 libpcreposix.so.0
ln -sf libpcreposix.so.0.0.7 libpcreposix.so )
ldconfig
# If you have grep, PHP or KDE installed, or anything else that you know uses
# libpcre as a shared library, verify that it is linked to the new version
# OK.
test -x /bin/grep && ldd /bin/grep | grep pcre
test -x /usr/bin/grep && ldd /usr/bin/grep | grep pcre
test -x /usr/bin/kaddressbook && ldd /usr/bin/kaddressbook | grep pcre
test -x /usr/bin/php && ldd /usr/bin/php | grep pcre
test -x /usr/local/bin/php && ldd /usr/local/bin/php | grep pcre
# Now if you want, remove old real-file not-symlink versions of libpcre.so.*,
# libpcrecpp.so.*, and libpcreposix.so.* in /lib*/, if there are any. This
# is purely to avoid clutter, so if you feel like leaving them there, that's
# fine, and probably safer. Normally you'd be weary of programs that are linked
# to libpcre.so.1 when you upgrade to libpcre.so.2 (remove .1 and break that
# program), but every version that I've installed so far has named the shared
# library files something like libpcre*.so.0.0.x
# If you remove the old Slackware libpcre files, move the package files for
# Slackware's PCRE out of the way (as if you had removed pcre with
# removepkg):
find /var/adm/packages -type f -name "pcre-*" \
-exec mv {} /var/adm/removed_packages/ \;
find /var/adm/scripts -type f -name "pcre-*" \
-exec mv {} /var/adm/removed_scripts/ \;
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/pcre-*.tar.*
mv pcre-8.45.tar.bz2 installed/