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

Fri Apr 20 19:45:50 UTC 2012
Nikolaos Milas <nmilas at noa.gr>


We are (still) mainly using CentOS 5 (5.8 x86_64). As CentOS / EL 5 
standard OpenLDAP packages are rather old (2.3.x), we've been using LTB 
OpenLDAP packages ( http://ltb-project.org/wiki/download#openldap), 
which get installed in non-standard file system locations.

I am not much experienced in building RPMs and preparing spec files. We 
are currently using dovecot RPM packages from the atrpms repo 

I would like to re-build Dovecot packages based on the LTB OpenLDAP RPM 
packages (OpenLDAP v2.4.x), esp. because I see that ATRPMs Dovecot RPM 
packages are built using OpenLDAP v2.3 devel code (i.e. standard CentOS 
OpenLDAP devel packages).

In http://dl.atrpms.net/all/dovecot.spec I see:

BuildRequires: openldap-devel, cyrus-sasl-devel


Obsoletes: %{name}-pgsql < %{epoch}:%{version}-%{release}, %{name}-mysql 
< %{epoch}:%{version}-%{release}, %{name}-sqlite < 
%{epoch}:%{version}-%{release}, %{name}-ldap < 
%{epoch}:%{version}-%{release}, $
Conflicts: %{name}-pgsql > %{epoch}:%{version}-%{release}, %{name}-mysql 
 > %{epoch}:%{version}-%{release}, %{name}-sqlite > 
%{epoch}:%{version}-%{release}, %{name}-ldap > 
%{epoch}:%{version}-%{release}, $

So, I guess I can/should change the former line to:

BuildRequires: openldap-ltb-debuginfo, cyrus-sasl-devel

Note: The final Dovecot RPM and the associated executables (included 
therein) do not need any LDAP dynamic library in order to run with LDAP 
support; i.e. after building, the produced package does not require any 
ldap package on the system.

Question 1: What other changes/additions should we make in the spec file 
in order to specify that we will be using (if needed) LDAP libraries 
from: /usr/local/openldap/lib64 and include files from: 
/usr/local/openldap/include (rather than from /usr/lib64 and 
/usr/include, respectively, which are the standard file paths used in 
native openldap-devel RPM)?

Question 2: How the Obsoletes and Conflicts lines should be changed?

Any other associated info would be appreciated.