[openldap] clean the package build process
jvcelak
jvcelak at fedoraproject.org
Wed Jul 18 17:11:29 UTC 2012
commit 824671e8d79872abc56cc993e20dab649b65c58a
Author: Jan Vcelak <jvcelak at redhat.com>
Date: Wed Jul 18 18:57:33 2012 +0200
clean the package build process
openldap-autoconf-pkgconfig-nss.patch | 47 +++++++
openldap.spec | 226 ++++++++++++++-------------------
2 files changed, 140 insertions(+), 133 deletions(-)
---
diff --git a/openldap-autoconf-pkgconfig-nss.patch b/openldap-autoconf-pkgconfig-nss.patch
new file mode 100644
index 0000000..3b11eea
--- /dev/null
+++ b/openldap-autoconf-pkgconfig-nss.patch
@@ -0,0 +1,47 @@
+Use pkg-config for Mozilla NSS library detection
+
+Author: Jan Vcelak <jvcelak at redhat.com>
+
+---
+ configure.in | 20 +++++---------------
+ 1 file changed, 5 insertions(+), 15 deletions(-)
+
+diff --git a/configure.in b/configure.in
+index f0f8d99..2a9cfb4 100644
+--- a/configure.in
++++ b/configure.in
+@@ -1223,26 +1223,16 @@ if test $ol_link_tls = no ; then
+ fi
+ fi
+
+-dnl NOTE: caller must specify -I/path/to/nspr4 and -I/path/to/nss3
+-dnl and -L/path/to/nspr4 libs and -L/path/to/nss3 libs if those libs
+-dnl are not in the default system location
+ if test $ol_link_tls = no ; then
+ if test $ol_with_tls = moznss || test $ol_with_tls = auto ; then
+- have_moznss=no
+- AC_CHECK_HEADERS([nssutil.h])
+- if test "$ac_cv_header_nssutil_h" = yes ; then
+- AC_CHECK_LIB([nss3], [NSS_Initialize],
+- [ have_moznss=yes ], [ have_moznss=no ])
+- fi
++ PKG_CHECK_MODULES(MOZNSS, [nss nspr], [have_moznss=yes], [have_moznss=no])
+
+- if test "$have_moznss" = yes ; then
++ if test $have_moznss = yes ; then
+ ol_with_tls=moznss
+ ol_link_tls=yes
+- AC_DEFINE(HAVE_MOZNSS, 1,
+- [define if you have MozNSS])
+- TLS_LIBS="-lssl3 -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4"
+- else
+- AC_MSG_ERROR([MozNSS not found - please specify the location to the NSPR and NSS header files in CPPFLAGS and the location to the NSPR and NSS libraries in LDFLAGS (if not in the system location)])
++ AC_DEFINE(HAVE_MOZNSS, 1, [define if you have MozNSS])
++ TLS_LIBS="$MOZNSS_LIBS"
++ CFLAGS="$CFLAGS $MOZNSS_CFLAGS"
+ fi
+ fi
+ fi
+--
+1.7.10.4
+
diff --git a/openldap.spec b/openldap.spec
index 8ba77e0..28f5df0 100644
--- a/openldap.spec
+++ b/openldap.spec
@@ -8,7 +8,7 @@
Name: openldap
Version: 2.4.31
-Release: 3%{?dist}
+Release: 4%{?dist}
Summary: LDAP support libraries
Group: System Environment/Daemons
License: OpenLDAP
@@ -48,13 +48,13 @@ Patch16: openldap-nss-default-cipher-suite-always-selected.patch
Patch17: openldap-nss-multiple-tls-contexts.patch
# Fedora specific patches
-Patch100: openldap-fedora-systemd.patch
+Patch100: openldap-autoconf-pkgconfig-nss.patch
+Patch101: openldap-fedora-systemd.patch
# patches for the evolution library (see README.evolution)
Patch200: openldap-evolution-ntlm.patch
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-
+BuildRequires: autoconf
BuildRequires: cyrus-sasl-devel, nss-devel, krb5-devel, tcp_wrappers-devel, unixODBC-devel
BuildRequires: glibc-devel, libtool, libtool-ltdl-devel, groff, perl
# smbk5pwd overlay:
@@ -137,10 +137,16 @@ programs needed for accessing and modifying OpenLDAP directories.
%prep
%setup -q -c -a 0
-# setup tree for openldap
-
pushd openldap-%{version}
+# use pkg-config for Mozilla NSS library
+%patch100 -p1
+AUTOMAKE=/bin/true autoreconf --install --force
+
+# alternative include paths for Mozilla NSS
+ln -s %{_includedir}/nss3 include/nss
+ln -s %{_includedir}/nspr4 include/nspr
+
%patch0 -p1
%patch1 -p1
%patch2 -p1
@@ -160,14 +166,7 @@ pushd openldap-%{version}
%patch16 -p1
%patch17 -p1
-%patch100 -p1
-
-cp %{_datadir}/libtool/config/config.{sub,guess} build/
-
-for subdir in build-servers build-clients ; do
- mkdir $subdir
- ln -s ../configure $subdir
-done
+%patch101 -p1
# build smbk5pwd with other overlays
ln -s ../../../contrib/slapd-modules/smbk5pwd/smbk5pwd.c servers/slapd/overlays
@@ -181,8 +180,7 @@ done
popd
-# setup tree for openldap with evolution-specific patches
-
+# patched static libraries for Evolution
if ! cp -al openldap-%{version} evo-openldap-%{version} ; then
rm -fr evo-openldap-%{version}
cp -a openldap-%{version} evo-openldap-%{version}
@@ -193,141 +191,97 @@ popd
%build
-libtool='%{_bindir}/libtool'
-export tagname=CC
-
-export CPPFLAGS="-I%_includedir/nss3 -I%_includedir/nspr4"
-export CFLAGS="$RPM_OPT_FLAGS $CPPFLAGS -fPIC -D_REENTRANT -DLDAP_CONNECTIONLESS -D_GNU_SOURCE -DHAVE_TLS -DHAVE_MOZNSS -DSLAPD_LMHASH"
-export NSS_LIBS="-lssl3 -lsmime3 -lnss3 -lnssutil3 -lplds4 -lplc4 -lnspr4"
-export LIBS=""
-
-build() {
+# avoid stray dependencies (linker flag --as-needed)
+# enable experimental support for LDAP over UDP (LDAP_CONNECTIONLESS)
+export CFLAGS="%{optflags} -Wl,--as-needed -DLDAP_CONNECTIONLESS"
+pushd openldap-%{version}
%configure \
- --with-threads=posix \
- \
- --enable-local \
- --enable-rlookups \
- \
- --with-tls=no \
- --with-cyrus-sasl \
- \
- --enable-wrappers \
- \
- --enable-passwd \
- \
+ --enable-debug \
+ --enable-dynamic \
+ --enable-syslog \
+ --enable-proctitle \
+ --enable-ipv6 \
+ --enable-local \
+ \
+ --enable-slapd \
+ --enable-dynacl \
+ --enable-aci \
--enable-cleartext \
--enable-crypt \
+ --enable-lmpasswd \
--enable-spasswd \
- --disable-lmpasswd \
- --enable-modules \
- --disable-sql \
- \
- --libexecdir=%{_libdir} \
- $@
-
-# allow #include <nss/file.h> and <nspr/file.h>
-pushd include
-if [ ! -d nss ] ; then
- ln -s %{_includedir}/nss3 nss
-fi
-if [ ! -d nspr ] ; then
- ln -s %{_includedir}/nspr4 nspr
-fi
-popd
-
-make %{_smp_mflags} LIBTOOL="$libtool"
-
-}
-
-# Kerberos support:
-# - enabled in server (mainly for password checking)
-# - disabled in clients (not needed, to avoid stray dependencies)
-
-# build servers
-export LIBS="$NSS_LIBS -lpthread"
-pushd openldap-%{version}/build-servers
-build \
- --enable-slapd \
- --enable-bdb \
- --enable-dnssrv=mod \
- --enable-hdb \
- --enable-ldap=mod \
- --enable-meta=mod \
- --enable-monitor \
- --enable-null=mod \
- --enable-shell=mod \
- --enable-sql=mod \
- --enable-mdb=mod \
+ --enable-modules \
+ --enable-rewrite \
+ --enable-rlookups \
+ --enable-slapi \
+ --disable-slp \
+ --enable-wrappers \
+ \
+ --enable-backends=mod \
+ --enable-bdb=yes \
+ --enable-hdb=yes \
+ --enable-monitor=yes \
--disable-ndb \
- --enable-passwd=mod \
- --enable-sock=mod \
--disable-perl \
- --enable-relay=mod \
+ \
--enable-overlays=mod \
- --enable-dynacl \
- --enable-aci=yes \
- --disable-shared \
- --disable-dynamic
-popd
-
-# build clients
-export LIBS="$NSS_LIBS"
-pushd openldap-%{version}/build-clients
-build \
- --disable-slapd \
- --enable-shared \
- --enable-dynamic \
- --without-kerberos \
- --with-pic
+ \
+ --disable-static \
+ --enable-shared \
+ \
+ --with-cyrus-sasl \
+ --without-fetch \
+ --with-threads \
+ --with-pic \
+ --with-tls=moznss \
+ --with-gnu-ld \
+ \
+ --libexecdir=%{_libdir}
+
+make %{_smp_mflags}
popd
-# build evolution-specific clients
-# (specific patch, different installation directory, no shared libraries)
+# build patched static library for Evolution
pushd evo-openldap-%{version}
-build \
- --disable-slapd \
- --disable-shared \
- --disable-dynamic \
- --enable-static \
- --without-kerberos \
- --with-pic \
+%configure \
+ --enable-debug \
+ --disable-dynamic \
+ --disable-syslog \
+ --disable-proctitle \
+ --enable-ipv6 \
+ --disable-local \
+ \
+ --disable-slapd \
+ \
+ --enable-static \
+ --disable-shared \
+ \
+ --with-cyrus-sasl \
+ --without-fetch \
+ --with-threads \
+ --with-pic \
+ --with-tls=moznss \
+ --with-gnu-ld \
+ \
--includedir=%{evolution_connector_includedir} \
--libdir=%{evolution_connector_libdir}
+
+make %{_smp_mflags}
popd
%install
-rm -rf %{buildroot}
-libtool='%{_bindir}/libtool'
-export tagname=CC
mkdir -p %{buildroot}%{_libdir}/
-# install servers
-pushd openldap-%{version}/build-servers
-make install DESTDIR=%{buildroot} \
- libdir=%{_libdir} \
- LIBTOOL="$libtool" \
- STRIP=""
-popd
-
-# install evolution-specific clients (conflicting files will be overwriten by generic version)
+# install evolution-specific libraries (conflicting files will be overwriten by generic version)
pushd evo-openldap-%{version}
-make install DESTDIR=%{buildroot} \
- includedir=%{evolution_connector_includedir} \
- libdir=%{evolution_connector_libdir} \
- LIBTOOL="$libtool" \
- STRIP=""
-install -m 644 %SOURCE100 \
- %{buildroot}%{evolution_connector_prefix}/
+make install DESTDIR=%{buildroot} STRIP=""
+install -m 644 %SOURCE100 %{buildroot}%{evolution_connector_prefix}/
popd
-# install clients
-pushd openldap-%{version}/build-clients
-make install DESTDIR=%{buildroot} \
- libdir=%{_libdir} \
- LIBTOOL="$libtool" \
- STRIP=""
+pushd openldap-%{version}
+make install DESTDIR=%{buildroot} STRIP=""
popd
# setup directories for TLS certificates
@@ -402,10 +356,7 @@ chmod 0644 %{buildroot}%{_datadir}/openldap-servers/DB_CONFIG.example
# remove files which we don't want packaged
rm -f %{buildroot}%{_libdir}/*.la
-rm -f %{buildroot}%{_libdir}/*.a
rm -f %{buildroot}%{evolution_connector_libdir}/*.la
-rm -f %{buildroot}%{evolution_connector_libdir}/*.so*
-rm -f %{buildroot}%{_libdir}/openldap/*.a
rm -f %{buildroot}%{_libdir}/openldap/*.so
rm -f %{buildroot}%{_localstatedir}/openldap-data/DB_CONFIG.example
@@ -610,6 +561,7 @@ exit 0
%dir %attr(-,ldap,ldap) %{_localstatedir}/run/openldap
%{_unitdir}/slapd.service
%{_datadir}/openldap-servers/
+%{_libdir}/libslapi-2.4*.so.*
%{_libdir}/openldap/accesslog*
%{_libdir}/openldap/auditlog*
%{_libdir}/openldap/back_dnssrv*
@@ -664,12 +616,20 @@ exit 0
%files devel
%doc openldap-%{version}/doc/drafts openldap-%{version}/doc/rfc
-%{_libdir}/libl*.so
+%{_libdir}/lib*.so
%{_includedir}/*
%{_mandir}/man3/*
%{evolution_connector_prefix}/
%changelog
+* Wed Jul 18 2012 Jan Vcelak <jvcelak at redhat.com> 2.4.31-4
+- modify the package build process
+ + fix autoconfig files to detect Mozilla NSS library using pkg-config
+ + remove compiler flags which are not needed currently
+ + build server, client and library together
+ + avoid stray dependencies by using --as-needed linker flag
+ + enable SLAPI interface in slapd
+
* Wed Jun 27 2012 Jan Vcelak <jvcelak at redhat.com> 2.4.31-3
- update fix: count constraint broken when using multiple modifications (#795766)
- fix: invalid order of TLS shutdown operations (#808464)
More information about the scm-commits
mailing list