openldap2/openldap2-client.spec

544 lines
17 KiB
RPMSpec
Raw Normal View History

#
# spec file for package openldap2 (Version 2.4.23)
#
# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# 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 http://bugs.opensuse.org/
#
# norootforbuild
%define run_test_suite 1
Name: openldap2-client
BuildRequires: cyrus-sasl-devel libopenssl-devel
%if %sles_version == 9 || %sles_version == 10
BuildRequires: -libopenssl-devel -pwdutils openssl-devel
%endif
Version: 2.4.23
Release: 3
Url: http://www.openldap.org
License: BSD3c(or similar) ; openldap 2.8
%if "%{name}" == "openldap2"
BuildRequires: db-devel openslp-devel tcpd-devel unixODBC-devel
%if %sles_version == 9 || %sles_version == 10
BuildRequires: -db-devel libdb-4_5-devel
%endif
Group: Productivity/Networking/LDAP/Servers
Conflicts: openldap
Requires: libldap-2_4-2 = %{version}
PreReq: %insserv_prereq %fillup_prereq /usr/sbin/useradd /usr/sbin/groupadd /usr/bin/grep
Summary: The OpenLDAP Server
%else
Group: Productivity/Networking/LDAP/Clients
Conflicts: openldap-client
Requires: libldap-2_4-2 = %{version}
Summary: The OpenLDAP commandline client tools
%endif
AutoReqProv: on
Source: openldap-%{version}.tar.bz2
Source1: openldap-rc.tgz
Source2: addonschema.tar.gz
Source3: DB_CONFIG
Source4: sasl-slapd.conf
Source5: README.update
Source6: schema2ldif
Source100: openldap-2.3.37.tar.bz2
Patch1: 0001-build-adjustments.dif
Patch2: 0002-slapd.conf.dif
Patch3: 0003-LDAPI-socket-location.dif
Patch4: 0004-libldap-use-gethostbyname_r.dif
Patch5: 0005-pie-compile.dif
Patch6: 0006-assorted-fixes-for-back-config-DELETE-support.dif
Patch7: 0007-No-Build-date-and-time-in-binaries.dif
Patch8: 0008-Recover-on-DB-version-change.dif
Patch100: openldap-2.3.37.dif
Patch200: slapd_getaddrinfo_dupl.dif
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if "%{name}" == "openldap2"
%description
The Lightweight Directory Access Protocol (LDAP) is used to access
online directory services. It runs directly over TCP and can be used to
access a stand-alone LDAP directory service or to access a directory
service that has an X.500 back-end.
Authors:
--------
The OpenLDAP Project <project@openldap.org>
%package -n openldap2-back-perl
License: BSD3c(or similar) ; openldap 2.8
Summary: OpenLDAP Perl Back-End
Requires: openldap2 = %{version} perl = %{perl_version}
AutoReqProv: on
Group: Productivity/Networking/LDAP/Servers
%description -n openldap2-back-perl
The OpenLDAP Perl back-end allows you to execute Perl code specific to
different LDAP operations.
Authors:
--------
The OpenLDAP Project <project@openldap.org>
%package -n openldap2-back-meta
License: BSD3c(or similar) ; openldap 2.8
Summary: OpenLDAP Meta Back-End
Requires: openldap2 = %{version}
AutoReqProv: on
Group: Productivity/Networking/LDAP/Servers
Provides: openldap2:/usr/share/man/man5/slapd-meta.5.gz
%description -n openldap2-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).
Authors:
--------
The OpenLDAP Project <project@openldap.org>
%package -n openldap2-back-sql
License: BSD3c(or similar) ; openldap 2.8
Summary: OpenLDAP SQL Back-End
Requires: openldap2 = %{version}
AutoReqProv: on
Group: Productivity/Networking/LDAP/Servers
%description -n openldap2-back-sql
The primary purpose of this OpenLDAP backend is to present information
stored in a Relational (SQL) Database as an LDAP subtree without the need
to do any programming.
Authors:
--------
The OpenLDAP Project <project@openldap.org>
%package -n openldap2-doc
License: BSD3c(or similar) ; openldap 2.8
Summary: OpenLDAP Documentation
Group: Documentation/Other
AutoReqProv: on
Provides: openldap2:/usr/share/doc/packages/openldap2/drafts/README
%if 0%{?suse_version} > 1110
BuildArch: noarch
%endif
%description -n openldap2-doc
The OpenLDAP Admin Guide plus a set of OpenLDAP related IETF internet drafts
Authors:
--------
The OpenLDAP Project <project@openldap.org>
%else
%description
This package contains the OpenLDAP client utilities.
Authors:
--------
The OpenLDAP Project <project@openldap.org>
%package -n openldap2-devel
License: BSD3c(or similar) ; openldap 2.8
Summary: Libraries, Header Files and Documentation for OpenLDAP
AutoReqProv: on
# bug437293
%ifarch ppc64
Obsoletes: openldap2-devel-64bit
%endif
#
Conflicts: openldap-devel
%if %suse_version >= 1110
Requires: libldap-2_4-2 = %{version} cyrus-sasl-devel libopenssl-devel
%else
Requires: libldap-2_4-2 = %{version} cyrus-sasl-devel openssl-devel
%endif
Group: Development/Libraries/C and C++
%description -n openldap2-devel
This package provides the OpenLDAP libraries, header files, and
documentation.
Authors:
--------
The OpenLDAP Project <project@openldap.org>
%package -n libldap-2_4-2
License: BSD3c(or similar) ; openldap 2.8
Summary: OpenLDAP Client Libraries
AutoReqProv: on
Group: Productivity/Networking/LDAP/Clients
%description -n libldap-2_4-2
This package contains the OpenLDAP client libraries.
Authors:
--------
The OpenLDAP Project <project@openldap.org>
%endif
%prep
%setup -q -n openldap-%{version} -a1 -a2 -b100
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%if %suse_version > 920
%patch5 -p1
%endif
%patch6 -p1
%patch7 -p1
%patch8 -p1
%if %suse_version == 1100
%patch200 -p1
%endif
cp %{SOURCE5} .
cd ../openldap-2.3.37
%patch100
%build
%{?suse_update_config:%{suse_update_config -f build}}
libtoolize --force
autoreconf
export CFLAGS="$RPM_OPT_FLAGS -Wno-format-extra-args -fno-strict-aliasing -DLDAP_DEPRECATED -DLDAP_CONNECTIONLESS -DSLAP_CONFIG_DELETE"
export STRIP=""
%configure \
--localstatedir=/var/run/slapd \
--libexecdir=/usr/lib/openldap \
--enable-wrappers \
--enable-spasswd \
--enable-modules \
--enable-shared \
--enable-dynamic \
--with-tls \
--with-cyrus-sasl \
--enable-crypt \
--enable-ipv6=yes \
%if "%{name}" == "openldap2"
--enable-aci \
--enable-bdb \
--enable-hdb \
--enable-rewrite \
--enable-ldap=yes \
--enable-meta=mod \
--enable-monitor=yes \
--enable-perl=mod \
--enable-sql=mod \
--enable-slp \
--enable-overlays=yes \
%else
--disable-slapd \
%endif
--enable-lmpasswd \
--with-yielding-select
make depend
make %{?jobs:-j%jobs}
%if "%{name}" == "openldap2"
%if %suse_version < 1130
# build a static slapcat binary from the OpenLDAP 2.3 release
# to be able to update existing databases
cd ../openldap-2.3.37
%{?suse_update_config:%{suse_update_config -f build}}
libtoolize --force
#aclocal -I build
autoreconf
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -DLDAP_DEPRECATED"
./configure --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc \
--localstatedir=/var/run/slapd --libexecdir=/usr/lib/openldap \
--libdir=%{_libdir} --mandir=%{_mandir} --enable-aci \
--enable-hdb --enable-bdb --enable-ldbm --enable-crypt \
--enable-ipv6=no \
--enable-ldap --enable-monitor --enable-meta --enable-rewrite \
--enable-dynamic=no --enable-shared=no
make depend
make %{?jobs:-j%jobs}
%endif
%endif
%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 $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/usr/sbin
make STRIP="" DESTDIR=$RPM_BUILD_ROOT install
install -m 755 rc.ldap $RPM_BUILD_ROOT/etc/init.d/ldap
ln -sf ../../etc/init.d/ldap $RPM_BUILD_ROOT/usr/sbin/rcldap
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/openldap/slapd.d
mkdir -p $RPM_BUILD_ROOT/%{_sysconfdir}/sasl2
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_sysconfdir}/sasl2/slapd.conf
install -m 755 -d $RPM_BUILD_ROOT/var/lib/ldap
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/liblber.so*
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap_r.so*
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/libldap.so*
install -m 755 %{SOURCE6} $RPM_BUILD_ROOT/usr/sbin/schema2ldif
%if "%{name}" == "openldap2"
%define DOCDIR %{_defaultdocdir}/%{name}
mkdir -p $RPM_BUILD_ROOT/var/adm/fillup-templates
install -m 644 sysconfig.openldap $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.openldap
install -m 644 *.schema $RPM_BUILD_ROOT/etc/openldap/schema
install -m 644 %{SOURCE3} $RPM_BUILD_ROOT/var/lib/ldap/DB_CONFIG
install -m 644 $RPM_BUILD_ROOT/etc/openldap/DB_CONFIG.example $RPM_BUILD_ROOT/var/lib/ldap/DB_CONFIG.example
install -d $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services/
install -m 644 SuSEfirewall2.openldap $RPM_BUILD_ROOT/etc/sysconfig/SuSEfirewall2.d/services/openldap
rm -f `find doc/guide ! -name *.html -a ! -name *.gif -a ! -name *.png -a ! -type d`
rm -rf doc/guide/release
install -d $RPM_BUILD_ROOT/%{DOCDIR}/adminguide \
$RPM_BUILD_ROOT/%{DOCDIR}/images \
$RPM_BUILD_ROOT/%{DOCDIR}/drafts
install -m 644 doc/guide/admin/* $RPM_BUILD_ROOT/%{DOCDIR}/adminguide
install -m 644 doc/guide/images/*.gif $RPM_BUILD_ROOT/%{DOCDIR}/images
install -m 644 doc/drafts/* $RPM_BUILD_ROOT/%{DOCDIR}/drafts
install -m 644 ANNOUNCEMENT COPYRIGHT INSTALL LICENSE README CHANGES README.update $RPM_BUILD_ROOT/%{DOCDIR}
rm -f $RPM_BUILD_ROOT/etc/openldap/DB_CONFIG.example
rm -f $RPM_BUILD_ROOT/etc/openldap/schema/README
rm -f $RPM_BUILD_ROOT/var/run/slapd/openldap-data/DB_CONFIG.example
mv servers/slapd/back-sql/rdbms_depend servers/slapd/back-sql/examples
%if %suse_version < 1130
# install 2.3 slapcat
install -m 755 ../openldap-2.3.37/servers/slapd/slapcat $RPM_BUILD_ROOT/usr/sbin/openldap-2.3-slapcat
%endif
%endif
rm -f $RPM_BUILD_ROOT/usr/lib/openldap/modules/*.a
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-dnssrv.5
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-ndb.5
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-null.5
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-passwd.5
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-shell.5
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-sock.5
rm -f $RPM_BUILD_ROOT/usr/share/man/man5/slapd-tcl.5
# Remove *.la files, libtool does not handle this correct
rm -f $RPM_BUILD_ROOT%{_libdir}/lib*.la
#put filelists into files
cat >openldap2.filelist <<EOF
/var/adm/fillup-templates/sysconfig.openldap
%config /etc/init.d/ldap
%config /etc/sysconfig/SuSEfirewall2.d/services/openldap
/usr/sbin/rcldap
/usr/sbin/slap*
%dir /etc/openldap
%dir %attr(0770, ldap, ldap) /etc/openldap/slapd.d
%dir /etc/openldap/schema
%config /etc/openldap/schema/*.schema
%config /etc/openldap/schema/*.ldif
%config(noreplace) %attr(640, root, ldap) /etc/openldap/slapd.conf
%config(noreplace) %attr(640, ldap, ldap) /var/lib/ldap/DB_CONFIG
%config /var/lib/ldap/DB_CONFIG.example
%attr(640, root, ldap) /%{_sysconfdir}/openldap/slapd.conf.default
%config(noreplace) /etc/sasl2/slapd.conf
%dir /usr/lib/openldap
%dir /usr/lib/openldap/modules
/usr/lib/openldap/slapd
%dir %attr(0700, ldap, ldap) /var/lib/ldap
%dir %attr(0755, ldap, ldap) %ghost /var/run/slapd
%doc %{_mandir}/man8/sl*
%doc %{_mandir}/man5/slapd.*
%doc %{_mandir}/man5/slapd-bdb.*
%doc %{_mandir}/man5/slapd-config.*
%doc %{_mandir}/man5/slapd-hdb.*
%doc %{_mandir}/man5/slapd-ldbm.*
%doc %{_mandir}/man5/slapd-ldap.*
%doc %{_mandir}/man5/slapd-ldif.*
%doc %{_mandir}/man5/slapd-monitor.*
%doc %{_mandir}/man5/slapd-relay.*
%doc %{_mandir}/man5/slapo-*
%doc %{DOCDIR}/ANNOUNCEMENT
%doc %{DOCDIR}/COPYRIGHT
%doc %{DOCDIR}/INSTALL
%doc %{DOCDIR}/LICENSE
%doc %{DOCDIR}/README
%doc %{DOCDIR}/CHANGES
%doc %{DOCDIR}/README.update
EOF
%if %suse_version < 1130
cat >>openldap2.filelist <<EOF
/usr/sbin/openldap-2.3-slapcat
EOF
%endif
#
cat > openldap2-client.filelist <<EOF
%dir /etc/openldap
%config(noreplace) /etc/openldap/ldap.conf
/etc/openldap/ldap.conf.default
/usr/bin/ldapadd
/usr/bin/ldapcompare
/usr/bin/ldapdelete
/usr/bin/ldapexop
/usr/bin/ldapmodify
/usr/bin/ldapmodrdn
/usr/bin/ldapsearch
/usr/bin/ldappasswd
/usr/bin/ldapurl
/usr/bin/ldapwhoami
/usr/sbin/schema2ldif
%doc %{_mandir}/man1/ldap*
%doc %{_mandir}/man5/ldap.conf*
%doc %{_mandir}/man5/ldif.*
EOF
cat > libldap.filelist <<EOF
%{_libdir}/liblber*.so.*
%{_libdir}/libldap*.so.*
EOF
cat > openldap2-devel.filelist <<EOF
/usr/include/lber.h
/usr/include/lber_types.h
/usr/include/ldap*.h
/usr/include/slapi-plugin.h
%{_libdir}/liblber.a
%{_libdir}/liblber.so
%{_libdir}/libldap*.a
%{_libdir}/libldap*.so
%doc %{_mandir}/man3/ber*
%doc %{_mandir}/man3/lber*
%doc %{_mandir}/man3/ld_errno*
%doc %{_mandir}/man3/ldap*
EOF
cat > openldap2-back-perl.filelist <<EOF
/usr/lib/openldap/modules/back_perl*
%doc %{_mandir}/man5/slapd-perl.*
EOF
cat > openldap2-back-meta.filelist <<EOF
/usr/lib/openldap/modules/back_meta*
%doc %{_mandir}/man5/slapd-meta.*
EOF
cat > openldap2-back-sql.filelist <<EOF
/usr/lib/openldap/modules/back_sql*
%doc %{_mandir}/man5/slapd-sql.*
%doc servers/slapd/back-sql/examples
%doc servers/slapd/back-sql/docs/bugs
%doc servers/slapd/back-sql/docs/install
EOF
cat >openldap2-doc.filelist <<EOF
%doc %{DOCDIR}/drafts
%doc %{DOCDIR}/adminguide
%doc %{DOCDIR}/images
EOF
#remove files from other spec file
%if "%{name}" == "openldap2"
cat openldap2-client.filelist libldap.filelist openldap2-devel.filelist |
%else
cat openldap2.filelist openldap2-back-perl.filelist \
openldap2-back-meta.filelist openldap2-back-sql.filelist \
openldap2-doc.filelist |
%endif
grep -v "%dir " |sed -e "s|^.* ||" |grep "^/" |while read name ; do
rm -rf $RPM_BUILD_ROOT$name
done
%if "%{name}" == "openldap2"
%pre
/usr/sbin/groupadd -g 70 -o -r ldap 2> /dev/null || :
/usr/sbin/useradd -r -o -g ldap -u 76 -s /bin/bash -c "User for OpenLDAP" -d \
/var/lib/ldap ldap 2> /dev/null || :
# try to figure out if a db update is needed
if [ ${1:-0} -gt 1 ] && [ -f /usr/lib/openldap/slapd ] &&
/usr/bin/strings /usr/lib/openldap/slapd | \
grep "slapd 2.3" 2>&1 > /dev/null;
then
# create a backup of the schema shipped with 2.3
# at least core.schema changed between 2.3 and 2.4
TEMPDIR=`mktemp -d /etc/openldap/schema.backup.XXXXXX`
echo "Schema backup created in $TEMPDIR"
cp -p --remove-destination /etc/openldap/schema/* $TEMPDIR
echo $TEMPDIR > /etc/openldap/UPDATE_NEEDED ;
fi
%post
if [ ${1:-0} -gt 1 ] && [ -f %{_libdir}/sasl2/slapd.conf ] ; then
cp /etc/sasl2/slapd.conf /etc/sasl2/slapd.conf.rpmnew
cp %{_libdir}/sasl2/slapd.conf /etc/sasl2/slapd.conf
fi
%{fillup_and_insserv -n openldap ldap}
%{remove_and_set -n openldap OPENLDAP_RUN_DB_RECOVER}
%preun
%stop_on_removal ldap
%postun
%restart_on_update ldap
%insserv_cleanup
%files -f openldap2.filelist
%defattr(-,root,root)
%files -n openldap2-back-perl -f openldap2-back-perl.filelist
%defattr(-,root,root)
%files -n openldap2-back-meta -f openldap2-back-meta.filelist
%defattr(-,root,root)
%files -n openldap2-back-sql -f openldap2-back-sql.filelist
%defattr(-,root,root)
%files -n openldap2-doc -f openldap2-doc.filelist
%defattr(-,root,root)
%else
%post -n libldap-2_4-2 -p /sbin/ldconfig
%postun -n libldap-2_4-2 -p /sbin/ldconfig
%files -f openldap2-client.filelist
%defattr(-,root,root)
%files -n libldap-2_4-2 -f libldap.filelist
%defattr(-,root,root)
%files -n openldap2-devel -f openldap2-devel.filelist
%defattr(-,root,root)
%endif
%changelog