Nikolaos Milas
2012-Apr-20 19:45 UTC
[CentOS] Building Dovecot CentOS 5 RPMs with custom LDAP packages
Hi, 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 (http://packages.atrpms.net/dist/el5/dovecot/). 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. Thanks, Nick
fakessh
2012-Apr-20 20:10 UTC
[CentOS] Building Dovecot CentOS 5 RPMs with custom LDAP packages
Le 2012-04-20 21:45, Nikolaos Milas a ?crit?:> Hi, > > 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 > (http://packages.atrpms.net/dist/el5/dovecot/). > > 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. > > Thanks, > Nick > _______________________________________________look my personal rpm source of dovecot its more simply and stable http://ns.fakessh.eu/rpms/dovecot-2.1.4-1.centme.el5.src.rpm -- http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xC2626742 gpg --keyserver pgp.mit.edu --recv-key C2626742 http://urlshort.eu fakessh @ http://gplus.to/sshfake http://gplus.to/sshswilting http://gplus.to/john.swilting https://lists.fakessh.eu/mailman/ This list is moderated by me, but all applications will be accepted provided they receive a note of presentation
Nikolaos Milas
2013-Jan-11 10:25 UTC
[CentOS] Building Dovecot CentOS 5 RPMs with custom LDAP packages
On 20/4/2012 11:10 ??, fakessh wrote:> look my personal rpm source of dovecot > its more simply and stable > > http://ns.fakessh.eu/rpms/dovecot-2.1.4-1.centme.el5.src.rpmHi fakessh, I was looking at your: http://ns.fakessh.eu/rpms/dovecot-2.1.8-1.centme.src.rpm package (after adapting to build for 2.1.13) and I am trying to figure out how to build with custom LDAP libraries. I build Postfix using: CCARGS="${CCARGS} -DHAS_LDAP -I/usr/local/openldap/include" AUXLIBS="${AUXLIBS} -L/usr/local/openldap/lib64 -lldap -llber" and: BuildRequires: openldap-ltb-debuginfo >= 2.4.33 Your Dovecot spec file (with respect to LDAP) only states: BuildRequires: openldap-devel So, I can change that to: BuildRequires: openldap-ltb-debuginfo >= 2.4.33 but I will need to define custom locations for the libraries. How do I do that in your spec file? Please advise. (Sorry, I am not an RPM-build guru.) Thanks in advance. Regards, Nick
Nikolaos Milas
2013-Jan-12 09:09 UTC
[CentOS] Building Dovecot CentOS 5 RPMs with custom LDAP packages
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 computerYou 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: %build 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" %configure 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) Regards, Nick
Nikolaos Milas
2013-Jan-12 09:52 UTC
[CentOS] Building Dovecot CentOS 5 RPMs with custom LDAP packages
On 12/1/2013 11:09 ??, Nikolaos Milas wrote:> ++ export LDFLAGS="${LDFLAGS} -L/usr/local/openldap/lib64"Or, more correctly: export LDFLAGS="${LDFLAGS} -L/usr/local/openldap/lib64 -lldap" Nick