# Though this package includes IMAP and POP daemons, utils, etc., I only
# use it here to install the static library and header files required for
# PHP to be built with IMAP support. To install the other parts of the
# toolkit, read the docs, starting with the README in the source directory.
# Success compiling single patch tarball and git repository 'master'
# with OpenSSL 1.1.1 and 3.0
# Prerequisites:
# OpenSSL (optional; to build w/o it use "make slx SSLTYPE=none")
# Git (if getting it from there vs tarball)
# From tarball with one patch
# ===========================
# Get the tarball
cd
test -f installed/imap-2007f.tar.gz &&
mv installed/imap-2007f.tar.gz .
test ! -f imap-2007f.tar.gz &&
wget https://englanders.us/pub/linux/misc/notmine/imap-2007f.tar.gz
# Verify tarball w/ md5sum:
# [ md5sum of mine matches the one at https://github.com/uw-imap/imap ]
# (or 'openssl md5 imap-2007f.tar.gz')
echo "2126fd125ea26b73b20f01fcd5940369 imap-2007f.tar.gz" | md5sum -c
# Extract the source
mkdir -p -m 0700 ~/src
cd ~/src
find -maxdepth 1 -type d -name "imap-*" -exec rm -r {} \;
tar xzvf ~/imap-2007f.tar.gz
cd imap-2007f*
test $UID = 0 && chown -R root:root .
# Get this patch from Debian to enable building with OpenSSL 1.1.x
# https://sources.debian.org/patches/uw-imap/8:2007f~dfsg-5/
wget -nc https://sources.debian.org/data/main/u/uw-imap/8:2007f~dfsg-5/\
debian/patches/1006_openssl1.1_autoverify.patch
test -s 1006_openssl1.1_autoverify.patch &&
patch -p1 < 1006_openssl1.1_autoverify.patch
# Read through ./README, docs/BUILD, docs/SSLBUILD
# There are lots of different types of builds (see the Makefile). There's
# one for Debian, RedHat, SuSE, Linux with -lcrypt, Linux with Shadow,
# Linux w/ PAM, etc. If you're installing this just for PHP and you won't be
# using the daemons, slx should be fine in all cases.
# The default OpenSSL paths are based on the < 1.1.0 prefix of /usr/local/ssl
# for everything. So that would be:
# SSLDIR=/usr/local/ssl
# SSLINCLUDE=/usr/local/ssl/include/openssl
# SSLLIB=/usr/local/ssl/lib
# SSLCERTS=/usr/local/ssl/certs
# SSLKEYS=/usr/local/ssl/certs
#
# In OpenSSL >= 1.1.0 the /usr/local/ssl prefix is still used, but not for
# programs, includes, or libraries. For 64-bit >= 1.1.0 default paths,
# you'll need something like this:
# SSLINCLUDE=/usr/local/include/openssl
# SSLLIB=/usr/local/lib64
# and you can leave SSLDIR=/usr/local/ssl
#
# In addition to ./Makefile, see src/osdep/unix/Makefile
# Build it for 64-bit with OpenSSL >= 1.1.x under /usr/local
test $(uname -m) = 'x86_64' &&
test ! -d /usr/local/ssl/lib64 -a -d /usr/local/include/openssl &&
make slx EXTRACFLAGS=-fPIC \
SSLINCLUDE=/usr/local/include/openssl \
SSLLIB=/usr/local/lib64 \
SSLTYPE=unix.nopwd
# Build it for 64-bit with OpenSSL under /usr/local/ssl
test $(uname -m) = 'x86_64' &&
test -d /usr/local/ssl/lib64 -a -d /usr/local/include/openssl &&
make slx EXTRACFLAGS=-fPIC \
SSLINCLUDE=/usr/local/include/openssl \
SSLLIB=/usr/local/ssl/lib64 \
SSLTYPE=unix.nopwd
# Build it for 64-bit with OpenSSL under /usr
test $(uname -m) &&
test -d /usr/include/openssl &&
make slx EXTRACFLAGS=-fPIC \
SSLINCLUDE=/usr/include/openssl \
SSLLIB=/usr/lib64 \
SSLTYPE=unix.nopwd
# Build it for not 64-bit (32-bit) with OpenSSL under /usr/local/ssl
test $(uname -m) != 'x86_64' &&
test -d /usr/local/ssl/lib &&
make slx \
SSLINCLUDE=/usr/local/ssl/include/openssl \
SSLLIB=/usr/local/ssl/lib \
SSLTYPE=unix.nopwd
# Build it for not 64-bit (32-bit) with OpenSSL under /usr
test $(uname -m) != 'x86_64' && test -d /usr/include/openssl &&
make slx \
SSLINCLUDE=/usr/include/openssl \
SSLLIB=/usr/lib \
SSLTYPE=unix.nopwd
# Build it for anything 32-bit with OpenSSL under /usr/local/ssl
test $(uname -m) != 'x86_64' &&
make slx SSLTYPE=unix.nopwd
# Now go in here...
cd c-client
# Become root to install it
su
# Install the library - 64-bit
test $(uname -m) = 'x86_64' &&
cp c-client.a /usr/local/lib64/libc-client.a
# Install the library - anything else
test $(uname -m) != 'x86_64' &&
cp c-client.a /usr/local/lib/libc-client.a
# From GitHub with several patches
# ================================
# Get/update the source from the git repository
mkdir -p -m 0700 ~/src/uw-imap
cd ~/src/uw-imap
test -d ./imap && ( cd imap ; git fetch )
test ! -d ./imap &&
git clone https://github.com/uw-imap/imap.git
cd imap
# If you have compiled it before
make clean
# See tarball instructions above for more details and other
# compiling options
#
# Build it for 64-bit with OpenSSL >= 1.1.x under /usr/local
# (the default for source-installed OpenSSL)
test $(uname -m) = 'x86_64' &&
test ! -d /usr/local/ssl/lib64 -a -d /usr/local/include/openssl &&
make slx EXTRACFLAGS=-fPIC \
SSLINCLUDE=/usr/local/include/openssl \
SSLLIB=/usr/local/lib64 \
SSLTYPE=unix.nopwd
# Now go in here...
cd c-client
# Become root to install it
su
# Install the library - 64-bit
test $(uname -m) = 'x86_64' &&
cp c-client.a /usr/local/lib64/libc-client.a
# Remove old header files, install the new ones
( cd /usr/local/include ; rm -f rfc822.h mail.h linkage.h )
test -d /usr/local/include/c-client && rm -r /usr/local/include/c-client
mkdir -p /usr/local/include/c-client
cp *.h /usr/local/include/c-client/
# Make sure your non-root user can remove the source later
chown -R $(logname) .
chmod -R u+w .
# Become your non-root user again
exit
# Note where the source is
echo "uw-imap c-client is in ~/src/uw-imap/imap" > \
~/installed/uw-imap.README