Linux HOWTOs

About | Home | Search


HOWTO: apr
Description: Apache Portable Runtime
Click here for ChangeLog
NOTE: I use GNU tar >= 1.13.25 so it's -j for .tar.bz2 files,
it's safe to assume that make, gcc, binutils, fileutils/coreutils, gawk, sed, and grep are prerequisites for almost everything


# APR 1.7.0
# =========
# Slackware 13.37: apr 1.4.2
# Slackware 14.0, 14.1: apr 1.4.6
# Slackware 14.2: apr 1.5.2

# If you ever want to uninstall APR, or if you want to remove an old version
# before installing a new one, skip down to the bottom for instructions.

# If you have trouble with the download URL below, go here for a list of
# other mirrors:
# http://apr.apache.org/download.cgi

# 1.x Release Notes
# 1.7.x Changelog

# Prerequisites:
# OpenSSL

# Get it
cd
test -f installed/apr-1.7.0.tar.bz2 && mv installed/apr-1.7.0.tar.bz2 .
test ! -f apr-1.7.0.tar.bz2 &&
 wget http://apache.osuosl.org/apr/apr-1.7.0.tar.bz2

# Verify tarball w/ sha256sum:
# (this came from the APR site and my gpg-verified tarball)
echo "e2e148f0b2e99b8e5c6caa09f6d4fb4dd3e83f744aa72a952f94f5a14436f7\
ea  apr-1.7.0.tar.bz2" | sha256sum -c

# Verify tarball w/ gpg:
( gpg --list-keys 11C78735 > /dev/null 2>&1 || gpg --recv-keys 11C78735 ) &&
 wget -nc https://www.apache.org/dist/apr/apr-1.7.0.tar.bz2.asc &&
  gpg --verify apr-1.7.0.tar.bz2.asc && rm apr-1.7.0.tar.bz2.asc

# 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.0.tar.bz2
cd apr-1.7.0
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.0.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.*

Back to the list


Last updated: Tue, 07 Aug 2018 12:06:17 -0400
Jason Englander <jason at englanders dot us>