File openldap2.spec of Package openldap2
#
# spec file for package openldap2
#
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define run_test_suite 0
%define version_main 2.6.6
%define _rundir /run/slapd
Name: openldap2
Summary: An open source implementation of the Lightweight Directory Access Protocol
License: OLDAP-2.8
Group: Productivity/Networking/LDAP/Servers
Version: %{version_main}
Release: 0
URL: https://www.openldap.org
Source0: https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-%{version_main}.tgz
Source1: https://www.openldap.org/software/download/OpenLDAP/openldap-release/openldap-%{version_main}.tgz.asc
Source2: openldap2.keyring
Source4: sasl-slapd.conf
Source7: baselibs.conf
Source99: openldap2-rpmlintrc
Patch3: 0003-LDAPI-socket-location.dif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: argon2-devel
BuildRequires: cyrus-sasl-devel
BuildRequires: groff
BuildRequires: libopenssl-devel
BuildRequires: libtool
# avoid cycle with krb5
BuildRequires: pkgconfig(krb5)
BuildRequires: pkgconfig(systemd)
BuildRequires: systemd-devel
Requires: libldap2 = %{version}-%{release}
Recommends: cyrus-sasl
Conflicts: openldap
PreReq: %fillup_prereq
%description
OpenLDAP is a client and server reference implementation of the
Lightweight Directory Access Protocol v3 (LDAPv3).
The server provides several database backends and overlays.
%package back-sock
Summary: OpenLDAP Socket Back-End
Group: Productivity/Networking/LDAP/Servers
Requires: openldap2 = %{version_main}-%{release}
Provides: openldap2:/usr/share/man/man5/slapd-sock.5.gz
%description back-sock
The OpenLDAP socket back-end allows you to handle LDAP requests and
results with an external process listening on a Unix domain socket.
%package back-meta
Summary: OpenLDAP Meta Back-End
Group: Productivity/Networking/LDAP/Servers
Requires: openldap2 = %{version_main}-%{release}
Provides: openldap2:/usr/share/man/man5/slapd-meta.5.gz
%description back-meta
The OpenLDAP Meta back-end is able to perform basic LDAP proxying with
respect to a set of remote LDAP servers. The information contained in
these servers can be presented as belonging to a single Directory
Information Tree (DIT).
%package back-asyncmeta
Summary: OpenLDAP Async Meta Back-End
Group: Productivity/Networking/LDAP/Servers
Requires: openldap2 = %{version_main}-%{release}
%description back-asyncmeta
The new asynchronous OpenLDAP meta back-end.
%package -n libldap-data
Summary: Configuration file for system-wide defaults for all uses of libldap
Group: Productivity/Networking/LDAP/Clients
BuildArch: noarch
%description -n libldap-data
The subpackage contains a configuration file used to set system-wide defaults
to be applied with all usages of libldap.
%package contrib
Summary: OpenLDAP Contrib Modules
Group: Productivity/Networking/LDAP/Servers
Requires: openldap2 = %{version_main}-%{release}
%description contrib
Various overlays found in contrib/:
allowed Generates attributes indicating access rights
autogroup
authzid implements RFC 3829 support
datamorph store enumerated values and fixed size integers
denyop provides a quick'n'easy way to deny selected operations
lastbind writes last bind timestamp to entry
noopsrch handles no-op search control
pw-sha2 generates/validates SHA-2 password hashes
pw-pbkdf2 generates/validates PBKDF2 password hashes
smbk5pwd generates Samba3 password hashes (heimdal krb disabled)
trace traces overlay invocation
variant allows attributes/values to be shared between several entries
vc implements the verify credentials extended operation
%package doc
Summary: OpenLDAP Documentation
Group: Documentation/Other
Provides: openldap2:/usr/share/doc/packages/openldap2/drafts/README
BuildArch: noarch
%description doc
The OpenLDAP Admin Guide plus a set of OpenLDAP related IETF internet drafts.
%package client
Summary: OpenLDAP client utilities
Group: Productivity/Networking/LDAP/Clients
Requires: libldap2 = %{version_main}
%description client
OpenLDAP client utilities such as ldapadd, ldapsearch, ldapmodify.
%package devel
Summary: Libraries, Header Files and Documentation for OpenLDAP
# bug437293
Group: Development/Libraries/C and C++
#
Conflicts: openldap-devel
Requires: libldap2 = %{version_main}
Recommends: cyrus-sasl-devel
%description devel
This package provides the OpenLDAP libraries, header files, and
documentation.
%package devel-static
Summary: Static libraries for the OpenLDAP libraries
Group: Development/Libraries/C and C++
Requires: cyrus-sasl-devel
Requires: libopenssl-devel
Requires: openldap2-devel = %version
%description devel-static
This package provides the static versions of the OpenLDAP libraries
for development.
%package -n libldap2
Summary: OpenLDAP Client Libraries
Group: Productivity/Networking/LDAP/Clients
Recommends: libldap-data >= %{version_main}
%description -n libldap2
This package contains the OpenLDAP client libraries.
%prep
%setup -q -n openldap-%{version_main}
%patch3 -p1
%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
export CFLAGS="%{optflags} -Wno-format-extra-args -fno-strict-aliasing -DNDEBUG -DSLAP_SCHEMA_EXPOSE -DLDAP_COLLECTIVE_ATTRIBUTES"
export STRIP=""
%configure \
--prefix=/usr \
--sysconfdir=%{_sysconfdir} \
--libdir=%{_libdir} \
--libexecdir=%{_libdir} \
--localstatedir=%{_rundir} \
--runstatedir=%{_rundir}/slapd \
--enable-wrappers=no \
--enable-spasswd \
--enable-modules \
--enable-shared \
--enable-dynamic \
--with-tls=openssl \
--with-cyrus-sasl \
--enable-crypt \
--enable-ipv6=yes \
--enable-dynacl \
--disable-aci \
--enable-ldap=mod \
--enable-meta=mod \
--enable-monitor=mod \
--enable-asyncmeta=mod \
--disable-balancer \
--disable-wt \
--disable-perl \
--enable-sock=mod \
--disable-sql \
--enable-mdb=mod \
--enable-relay=mod \
--disable-slp \
--enable-overlays=mod \
--enable-syncprov=mod \
--enable-ppolicy=mod \
--disable-homedir \
--with-yielding-select \
--enable-argon2 \
--with-argon2=libargon2 \
--with-systemd \
|| cat config.log
make depend
# -B required to make every build give the same result - maybe from bad build deps in Makefiles?
make -B %{?_smp_mflags}
# Build selected contrib overlays
for SLAPO_NAME in allowed autogroup authzid datamorph denyop lastbind noopsrch passwd/pbkdf2 passwd/sha2 trace variant vc
do
make -B -C contrib/slapd-modules/${SLAPO_NAME} %{?_smp_mflags} "sysconfdir=%{_sysconfdir}/openldap" "libdir=%{_libdir}" "libexecdir=%{_libdir}" "mandir=%{_mandir}"
done
# slapo-smbk5pwd only for Samba password hashes
make -B -C contrib/slapd-modules/smbk5pwd %{?_smp_mflags} "sysconfdir=%{_sysconfdir}/openldap" "libdir=%{_libdir}" "libexecdir=%{_libdir}" "mandir=%{_mandir}" DEFS="-DDO_SAMBA" HEIMDAL_LIB=""
%check
%if %run_test_suite
# calculate the base port to be use in the test-suite
SLAPD_BASEPORT=10000
if [ -f /.buildenv ] ; then
. /.buildenv
SLAPD_BASEPORT=$(($SLAPD_BASEPORT + ${BUILD_INCARNATION:-0} * 10))
fi
export SLAPD_BASEPORT
%ifnarch %arm alpha
rm -f tests/scripts/test019-syncreplication-cascade
rm -f tests/scripts/test022-ppolicy
rm -f tests/scripts/test023-refint
rm -f tests/scripts/test033-glue-syncrepl
#rm -f tests/scripts/test036-meta-concurrency
#rm -f tests/scripts/test039-glue-ldap-concurrency
rm -f tests/scripts/test043-delta-syncrepl
#rm -f tests/scripts/test045-syncreplication-proxied
rm -f tests/scripts/test048-syncrepl-multiproxy
rm -f tests/scripts/test050-syncrepl-multimaster
rm -f tests/scripts/test058-syncrepl-asymmetric
make SLAPD_DEBUG=0 test
%endif
%endif
%install
mkdir -p %{buildroot}%{_libdir}/openldap
mkdir -p %{buildroot}/usr/lib/openldap
mkdir -p %{buildroot}%{_sbindir}
mkdir -p %{buildroot}%{_unitdir}
make STRIP="" DESTDIR="%{buildroot}" "sysconfdir=%{_sysconfdir}/openldap" "libdir=%{_libdir}" "libexecdir=%{_libdir}" install
# Additional symbolic link to slapd executable in /usr/sbin/
ln -s %{_libdir}/slapd %{buildroot}%{_sbindir}/slapd
# Install selected contrib overlays
for SLAPO_NAME in allowed autogroup authzid datamorph denyop lastbind noopsrch passwd/pbkdf2 passwd/sha2 smbk5pwd trace variant vc
do
make -C contrib/slapd-modules/${SLAPO_NAME} STRIP="" DESTDIR="%{buildroot}" "mandir=%{_mandir}" "sysconfdir=%{_sysconfdir}/openldap" "libdir=%{_libdir}" "libexecdir=%{_libdir}" "mandir=%{_mandir}" install
done
mkdir -p %{buildroot}%{_sysconfdir}/openldap/slapd.d
mkdir -p %{buildroot}%{_sysconfdir}/sasl2
install -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/sasl2/slapd.conf
install -m 755 -d %{buildroot}/var/lib/ldap
chmod a+x %{buildroot}%{_libdir}/liblber.so*
chmod a+x %{buildroot}%{_libdir}/libldap.so*
rm %{buildroot}%{_unitdir}/slapd.service
rm %{buildroot}%{_mandir}/man5/lloadd.conf.*
rm %{buildroot}%{_mandir}/man5/slapd-perl.*
rm %{buildroot}%{_mandir}/man5/slapd-sql.*
rm %{buildroot}%{_mandir}/man5/slapd-wt.*
rm %{buildroot}%{_mandir}/man5/slapo-homedir.*
rm %{buildroot}%{_mandir}/man8/lloadd.*
mkdir -p %{buildroot}%{_fillupdir}
# remove unneeded admin guide files
find doc/guide '(' ! -name *.html -a ! -name *.gif -a ! -name *.png -a ! -type d ')' -delete
rm -rf doc/guide/release
%define DOCDIR %{_defaultdocdir}/%{name}
install -d %{buildroot}%{DOCDIR}/adminguide \
%{buildroot}%{DOCDIR}/images \
%{buildroot}%{DOCDIR}/drafts
install -m 644 doc/guide/admin/* %{buildroot}%{DOCDIR}/adminguide
install -m 644 doc/guide/images/*.gif %{buildroot}%{DOCDIR}/images
install -m 644 doc/drafts/* %{buildroot}%{DOCDIR}/drafts
install -m 644 ANNOUNCEMENT \
COPYRIGHT \
README \
CHANGES \
%{buildroot}%{DOCDIR}
install -m 644 servers/slapd/slapd.ldif \
%{buildroot}%{DOCDIR}/slapd.ldif.default
rm -f %{buildroot}%{_sysconfdir}/openldap/schema/README
rm -f %{buildroot}%{_sysconfdir}/openldap/slapd.ldif*
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcslapd
rm -f %{buildroot}%{_libdir}/openldap/*.a
rm -f %{buildroot}%{_mandir}/man5/slapd-bdb.5
rm -f %{buildroot}%{_mandir}/man5/slapd-hdb.5
rm -f %{buildroot}%{_mandir}/man5/slapd-dnssrv.5
rm -f %{buildroot}%{_mandir}/man5/slapd-ndb.5
rm -f %{buildroot}%{_mandir}/man5/slapd-null.5
rm -f %{buildroot}%{_mandir}/man5/slapd-passwd.5
rm -f %{buildroot}%{_mandir}/man5/slapd-shell.5
rm -f %{buildroot}%{_mandir}/man5/slapd-tcl.5
# Remove *.la files, libtool does not handle this correct
rm -f %{buildroot}%{_libdir}/lib*.la
# Provide a libldap_r for backwards-compatibility with OpenLDAP < 2.5.
ln -fs libldap.so "%{buildroot}%{_libdir}/libldap_r.so"
#gcc -shared -o "%{buildroot}%{_libdir}/libldap_r.so.2" -Wl,--no-as-needed \
# -Wl,-soname -Wl,libldap.so.2 -L "%{buildroot}%{_libdir}" -lldap
%pre
%post
%post -n libldap2 -p /sbin/ldconfig
%postun -n libldap2 -p /sbin/ldconfig
%preun
%postun
%files
%defattr(-,root,root)
%config %{_sysconfdir}/openldap/schema/*.schema
%config %{_sysconfdir}/openldap/schema/*.ldif
%dir %{_sysconfdir}/sasl2
%config(noreplace) %{_sysconfdir}/sasl2/slapd.conf
%config(noreplace) %attr(640, root, ldap) %{_sysconfdir}/openldap/slapd.conf
%config %attr(640, root, ldap) %{_sysconfdir}/openldap/slapd.conf.default
%dir %{_libdir}/openldap
%dir %{_sysconfdir}/openldap
%dir %attr(0770, ldap, ldap) %{_sysconfdir}/openldap/slapd.d
%dir %{_sysconfdir}/openldap/schema
%{_sbindir}/slap*
%{_sbindir}/rcslapd
%{_libdir}/openldap/back_ldap*
%{_libdir}/openldap/back_mdb*
%{_libdir}/openldap/back_relay*
%{_libdir}/openldap/accesslog*
%{_libdir}/openldap/argon2*
%{_libdir}/openldap/auditlog*
%{_libdir}/openldap/autoca*
%{_libdir}/openldap/collect*
%{_libdir}/openldap/constraint*
%{_libdir}/openldap/dds*
%{_libdir}/openldap/deref*
%{_libdir}/openldap/dyngroup*
%{_libdir}/openldap/dynlist*
%{_libdir}/openldap/memberof*
%{_libdir}/openldap/otp*
%{_libdir}/openldap/pcache*
%{_libdir}/openldap/ppolicy*
%{_libdir}/openldap/remoteauth*
%{_libdir}/openldap/refint*
%{_libdir}/openldap/retcode*
%{_libdir}/openldap/rwm*
%{_libdir}/openldap/seqmod*
%{_libdir}/openldap/sssvlv*
%{_libdir}/openldap/syncprov*
%{_libdir}/openldap/translucent*
%{_libdir}/openldap/unique*
%{_libdir}/openldap/valsort*
%{_libdir}/slapd
%dir %attr(0750, ldap, ldap) %{_sharedstatedir}/ldap
%ghost %attr(0750, ldap, ldap) %{_rundir}
%doc %{_mandir}/man8/sl*
%doc %{_mandir}/man5/slapd.*
%doc %{_mandir}/man5/slapd-config.*
%doc %{_mandir}/man5/slapd-ldap.*
%doc %{_mandir}/man5/slapd-ldif.*
%doc %{_mandir}/man5/slapd-mdb.*
%doc %{_mandir}/man5/slapd-monitor.*
%doc %{_mandir}/man5/slapd-relay.*
%doc %{_mandir}/man5/slapo-accesslog*
%doc %{_mandir}/man5/slapo-auditlog*
%doc %{_mandir}/man5/slapo-autoca*
%doc %{_mandir}/man5/slapo-chain*
%doc %{_mandir}/man5/slapo-collect*
%doc %{_mandir}/man5/slapo-constraint*
%doc %{_mandir}/man5/slapo-dds*
%doc %{_mandir}/man5/slapo-deref*
%doc %{_mandir}/man5/slapo-dyngroup*
%doc %{_mandir}/man5/slapo-dynlist*
%doc %{_mandir}/man5/slapo-memberof*
%doc %{_mandir}/man5/slapo-otp*
%doc %{_mandir}/man5/slapo-pbind*
%doc %{_mandir}/man5/slapo-pcache*
%doc %{_mandir}/man5/slapo-ppolicy*
%doc %{_mandir}/man5/slapo-refint*
%doc %{_mandir}/man5/slapo-remoteauth*
%doc %{_mandir}/man5/slapo-retcode*
%doc %{_mandir}/man5/slapo-rwm*
%doc %{_mandir}/man5/slapo-sssvlv*
%doc %{_mandir}/man5/slapo-syncprov*
%doc %{_mandir}/man5/slapo-translucent*
%doc %{_mandir}/man5/slapo-unique*
%doc %{_mandir}/man5/slapo-valsort*
%doc %{_mandir}/man5/slappw-argon2*
%dir %{DOCDIR}
%doc %{DOCDIR}/ANNOUNCEMENT
%doc %{DOCDIR}/COPYRIGHT
%license LICENSE
%doc %{DOCDIR}/README*
%doc %{DOCDIR}/CHANGES
%doc %{DOCDIR}/slapd.ldif.default
%files back-sock
%defattr(-,root,root)
%{_libdir}/openldap/back_sock*
%doc %{_mandir}/man5/slapd-sock.*
%doc %{_mandir}/man5/slapo-sock.*
%files back-meta
%defattr(-,root,root)
%{_libdir}/openldap/back_meta*
%doc %{_mandir}/man5/slapd-meta.*
%files back-asyncmeta
%defattr(-,root,root)
%{_libdir}/openldap/back_asyncmeta*
%doc %{_mandir}/man5/slapd-asyncmeta.*
%files -n libldap-data
%defattr(-,root,root)
%config(noreplace) %{_sysconfdir}/openldap/ldap.conf
%doc %{_mandir}/man5/ldap.conf*
%{_sysconfdir}/openldap/ldap.conf.default
%files doc
%defattr(-,root,root)
%dir %{DOCDIR}
%doc %{DOCDIR}/drafts
%doc %{DOCDIR}/adminguide
%doc %{DOCDIR}/images
%files contrib
%defattr(-,root,root)
%{_libdir}/openldap/allowed.*
%{_libdir}/openldap/authzid*
%{_libdir}/openldap/autogroup.*
%{_libdir}/openldap/datamorph.*
%{_libdir}/openldap/denyop.*
%{_libdir}/openldap/lastbind.*
%{_libdir}/openldap/noopsrch.*
%{_libdir}/openldap/pw-pbkdf2.*
%{_libdir}/openldap/pw-sha2.*
%{_libdir}/openldap/smbk5pwd.*
%{_libdir}/openldap/trace.*
%{_libdir}/openldap/variant.*
%{_libdir}/openldap/vc.*
%doc %{_mandir}/man5/slapd-pw-pbkdf2*
%doc %{_mandir}/man5/slapd-pw-sha2*
%doc %{_mandir}/man5/slapo-datamorph*
%doc %{_mandir}/man5/slapo-lastbind*
%doc %{_mandir}/man5/slapo-smbk5pwd*
%doc %{_mandir}/man5/slapo-variant*
%files client
%defattr(-,root,root)
%doc %{_mandir}/man1/ldap*
%doc %{_mandir}/man5/ldif.*
%dir %{_sysconfdir}/openldap
%{_bindir}/ldapadd
%{_bindir}/ldapcompare
%{_bindir}/ldapdelete
%{_bindir}/ldapexop
%{_bindir}/ldapmodify
%{_bindir}/ldapmodrdn
%{_bindir}/ldapsearch
%{_bindir}/ldappasswd
%{_bindir}/ldapurl
%{_bindir}/ldapvc
%{_bindir}/ldapwhoami
%files -n libldap2
%defattr(-,root,root)
%{_libdir}/liblber*.so.*
%{_libdir}/libldap*.so.*
%files devel
%defattr(-,root,root)
%doc %{_mandir}/man3/ber*
%doc %{_mandir}/man3/lber*
%doc %{_mandir}/man3/ld_errno*
%doc %{_mandir}/man3/ldap*
%{_includedir}/*.h
%{_libdir}/liblber.so
%{_libdir}/libldap*.so
%{_libdir}/pkgconfig/*.pc
%files devel-static
%defattr(-,root,root)
%_libdir/liblber.a
%_libdir/libldap*.a
%changelog