Dovecot – compilation and installation

dovecotOn Linux systems you can install Dovecot from packages. Appropriate packages supports also LDAP authentication, MySQL and so on. Unfortunatelly you probably would not find a newest versions, when you install in this manner. Eg. for today in Ubuntu packages you will find version 2.0.19-0ubuntu1, while on Dovecot page version 2.1.7 is available. For this reason it is worth to compile and install software by yourself, even it is available in package.

Below is my script, which I used to compilation of Dovecot server on Solaris 10 SPARC with SunStudio compiler.


#!/bin/sh
#

# for GCC:
#CC=gcc
#CFLAGS="-O2 -mcpu=v9"
#MAKE=gmake
#
# for Sun Studio
CC=cc
CXX=CC
CFLAGS="-xO3 -xautopar"
CXXFLAGS=$CFLAGS
CPPFLAGS="-I/usr/local/ssl/include -I/usr/local/openldap/include -I/usr/local/include"
MAKE=dmake
#DMAKE_MODE=serial

export CC CFLAGS CPPFLAGS MAKE DMAKE_MODE
export CXX CXXFLAGS LDFLAGS LIBS

# $CC -v
$CC -V
set|grep PATH
set|grep FLAGS

DIR="dovecot"
VER="2.1.7"

cd $DIR-$VER

tn="n"
echo "============================================="
echo "$MAKE clean [y|n] ?"
read tn
if [ "$tn" = "t" ] || [ "$tn" = "y" ]; then
  $MAKE distclean || $MAKE realclean || $MAKE clean

  rm -f config.status
  rm -f config.log
fi;

tn="n"
echo "============================================="
echo "configure [y|n] ?"
read tn
if [ "$tn" = "t" ] || [ "$tn" = "y" ]; then
    ./configure \
    --prefix=/usr/local/$DIR-$VER \
    --infodir=/usr/local/info --mandir=/usr/local/man \
    --sysconfdir=/data/etc \
    --localstatedir=/data/var/$DIR \
    --with-libiconv-prefix=/usr/local \
    --with-ldap \
    --with-ssl \
    --with-ssldir=/data/etc/certs

fi;

tn="n"
echo "============================================="
echo "$MAKE [y|n] ?"
read tn
if [ "$tn" = "t" ] || [ "$tn" = "y" ]; then
  $MAKE && echo "Compillation successful"
fi;

DMAKE_MODE=serial
export DMAKE_MODE

tn="n"
echo "============================================="
echo "$MAKE test || $MAKE check [y|n] ?"
read tn
if [ "$tn" = "t" ] || [ "$tn" = "y" ]; then
  $MAKE test || $MAKE check
fi;

Transcript of session:

checking for a BSD-compatible install... /usr/local/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/local/bin/mkdir -p
checking for gawk... gawk
checking whether dmake sets $(MAKE)... yes
...
Install prefix . : /usr/local/dovecot-2.1.7
File offsets ... : 64bit
I/O polling .... : poll
I/O notifys .... : none
SSL ............ : yes (OpenSSL)
GSSAPI ......... : no
passdbs ........ : static passwd passwd-file shadow pam checkpassword ldap
                 : -bsdauth -sia -sql -vpopmail
userdbs ........ : static prefetch passwd passwd-file checkpassword ldap
                 : -sql -vpopmail -nss
SQL drivers .... :
                 : -pgsql -mysql -sqlite
Full text search : squat
                 : -lucene -solr
dmake [y|n] ?
y
dmake  all-recursive
Making all in .
old=`pwd` && cd . && abs_builddir=`pwd` && cd $old && \
cd . && abs_srcdir=`pwd` && cd $old && \
cat dovecot-config.in | sed \
-e "s|\$(top_builddir)|$abs_builddir|g" \
-e "s|\$(incdir)|$abs_srcdir|g" \
-e "s|\$(LIBICONV)|/usr/local/lib/libiconv.so -R/usr/local/lib|g" \
-e "s|^\(dovecot_pkgincludedir\)=|\1=/usr/local/dovecot-2.1.7/include/dovecot|" \
-e "s|^\(dovecot_pkglibdir\)=|\1=/usr/local/dovecot-2.1.7/lib/dovecot|" \
-e "s|^\(dovecot_pkglibexecdir\)=|\1=/usr/local/dovecot-2.1.7/libexec/dovecot|" \
-e "s|^\(dovecot_docdir\)=|\1=/usr/local/dovecot-2.1.7/share/doc/dovecot|" \
-e "s|^\(dovecot_moduledir\)=|\1=/usr/local/dovecot-2.1.7/lib/dovecot|" \
> dovecot-config
...
Making all in wiki
Making all in example-config
Making all in conf.d
cat ./README.in | sed "s|@exampledir@|/usr/local/dovecot-2.1.7/share/doc/dovecot/example-config|" > README
Compillation successful
=============================================
dmake test || dmake check [y|n] ?
y
dmake: Fatal error: Don't know how to make target `test'
Making check in .
/bin/bash ./update-version.sh . .
Making check in src
Making check in lib-test
Making check in lib
for bin in test-lib; do \
  if !  ./$bin; then exit 1; fi; \
done
aqueue ............................................................... : ok
array foreach ........................................................ : ok
array reverse ........................................................ : ok
base64_encode() ...................................................... : ok
...
0 / 73 tests failed
dmake  check-am
Making check in lib-auth
...
mbox_from_parse(1,14) ................................................ : ok
mbox_from_create() ................................................... : ok
0 / 31 tests failed
...
proxy server msg copy ................................................ : ok
proxy server msg save ................................................ : ok
0 / 13 tests failed
Making check in ssl-params
Making check in stats
...

Installation with root privileges (su - or sudo -i)

# dmake install

If you have Sieve support, you need to compile sieve for new version before you switch to new Dovecot.

You may also like...

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.