# Get it
cd
test -f installed/apr-1.7.4.tar.bz2 && mv installed/apr-1.7.4.tar.bz2 .
test ! -f apr-1.7.4.tar.bz2 &&
wget https://dlcdn.apache.org/apr/apr-1.7.4.tar.bz2
# Verify tarball w/ sha256sum:
# (this came from the APR site and my gpg-verified tarball)
echo "fc648de983f3a2a6c9e78dea1f180639bd2fad6c06d556d4367a701fe5c355\
77 apr-1.7.4.tar.bz2" | sha256sum -c
# If you can't get the keys using gpg below, you can download and import it
wget -nc https://dlcdn.apache.org/apr/KEYS && gpg --import KEYS
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "apr-?.*" -exec rm -r {} \;
tar xjvf ~/apr-1.7.4.tar.bz2
cd apr-1.7.4
test $UID = 0 && chown -R root:root .
# Configure the build
# The default prefix is /usr/local/apr
# The default location of the build directory is /usr/build-1
## Even though this is APR, not APR-util, if you will be building in support
## for anything to APR-util like OpenLDAP, which requires OpenSSL, if you
## have OpenSSL installed under the <= 1.0.2 default prefix of
## /usr/local/ssl, prepend the configure line here with LDFLAGS specifying
## either /usr/local/ssl/lib64 or /usr/local/ssl/lib
# LDFLAGS=-L/usr/local/ssl/lib64 ./configure ...
## or
# LDFLAGS=-L/usr/local/ssl/lib ./configure ...
# Configure for 64-bit
test $(uname -m) = 'x86_64' &&
LDFLAGS=-L/usr/local/lib64 CPPFLAGS=-I/usr/local/include \
./configure --prefix=/usr --libdir=/usr/lib64 \
--with-installbuilddir=/usr/lib64/apr-1/build-1
# Configure for anything else
test $(uname -m) != 'x86_64' &&
./configure --prefix=/usr --with-installbuilddir=/usr/lib/apr-1/build-1
# Build it
make
# Test the build
make test
# Become root to install it
su
# Remove Slackware package and old shared libraries
test -x /sbin/removepkg && /sbin/removepkg apr
rm -f /usr/lib*/libapr-1.*
# Install it
make install
ldconfig
# Make sure your non-root account can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become yourself again
exit
# Save the source for later
cd
mkdir -p -m 0700 installed
rm -f installed/apr-?.*.tar.*
mv apr-1.7.4.tar.bz2 installed/
# If you ever want to uninstall APR, this should do it:
su
test -x /sbin/removepkg && /sbin/removepkg apr
for pfx in /usr /usr/local;
do
test -d ${pfx}/build-1 && rm -r ${pfx}/build-1
test -d ${pfx}/include/apr-1 && rm -r ${pfx}/include/apr-1
find ${pfx}/lib -maxdepth 1 -type d -name "apr-?.*" -exec rm -r {} \;
test -d ${pfx}/lib/apr-1 && rm -r ${pfx}/lib/apr-1
test -d ${pfx}/lib64 &&
find ${pfx}/lib64 -maxdepth 1 -type d -name "apr-?.*" -exec rm -r {} \;
test -d ${pfx}/lib64/apr-1 && rm -r ${pfx}/lib64/apr-1
rm -f ${pfx}/bin/apr-1-config ${pfx}/lib*/libapr-1.* \
${pfx}/lib*/apr.exp ${pfx}/lib*/pkgconfig/apr-1.pc
done
ldconfig
exit
find ~/src -maxdepth 1 -type d -name "apr-*" -exec rm -r {} \;
rm -f ~/installed/apr-*.tar.*