[CentOS] Building Dovecot CentOS 5 RPMs with custom LDAP packages

Sat Jan 12 09:09:31 UTC 2013
Nikolaos Milas <nmilas at noa.gr>

On 11/1/2013 1:44 μμ, fakessh @ wrote:

> I do not know the only thing I can tell you that laziness is a value in
> the computer

You are partly right.

However, IMHO building dovecot using standard openldap-devel on CentOS 5 
means that, even though the final RPM works, it will use *ancient* 
openldap v2.3 libraries.

If we manage to use custom openldap libaries (like those from LTB 
Openldap builds) then Dovecot can be built against modern/current 
Openldap v2.4 libraries. That may provide significant improvements to 
the final RPM, in terms of LDAP usage.

In any case, I found the solution (based on the documentation: 
http://wiki2.dovecot.org/CompilingSource); I added the following lines 
(marked below with ++) in your spec file:

    export PATH=/usr/kerberos/bin:$PATH
    #required for fdpass.c line 125,190: dereferencing type-punned
    pointer will break strict-aliasing rules
    ++  export CPPFLAGS="${CPPFLAGS} -I/usr/local/openldap/include"
    ++  export LDFLAGS="${LDFLAGS} -L/usr/local/openldap/lib64"
    export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
         INSTALL_DATA="install -c -p -m644" \
         --docdir=%{_docdir}/%{name}-%{version}     \
         --disable-static             \
         --disable-rpath              \
         --with-nss                   \
         --with-shadow                \
         --with-pam                   \
         --with-gssapi=plugin         \
         --with-ldap=plugin           \

So, this produces a dovecot package based on Openldap 2.4 
libraries(follows excerpt from the rpmbuild output):

    Requires(interp): /bin/sh /bin/sh /bin/sh /bin/sh
    Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1
    rpmlib(PayloadFilesHavePrefix) <= 4.0-1
    Requires(pre): /bin/sh shadow-utils
    Requires(post): /bin/sh chkconfig shadow-utils
    Requires(preun): /bin/sh chkconfig initscripts shadow-utils
    Requires(postun): /bin/sh initscripts
    Requires: /bin/bash /bin/sh config(dovecot) = 1:2.1.13-3.centme
    initscripts ... libldap-2.4.so.2()(64bit) ...

    It was initially using: libldap-2.3.so.0()(64bit)