File evoldap2-client.spec of Package evoldap2-client

#
# spec file for package evoldap2-client
#
# Copyright (c) 2011 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/
#



Name:           evoldap2-client
BuildRequires:  cyrus-sasl-devel db-devel openslp-devel openssl-devel tcpd-devel
BuildRequires:  libtool
%if %sles_version == 9
BuildRequires:  -pwdutils
%endif
%if %sles_version == 10
BuildRequires:  -db-devel -pwdutils libdb-4_5-devel
%endif
Version:        2.4.12
Release:        8
Url:            http://www.openldap.org
License:        BSD-3-Clause
Group:          Productivity/Networking/LDAP/Clients
Conflicts:      openldap-client
Summary:        NTLM patched OpenLDAP library for Evolution
AutoReqProv:    off
Source:         openldap-%{version}.tar.bz2
Source1:        openldap-rc.tgz
Source2:        addonschema.tar.gz
Source3:        DB_CONFIG
Source4:        sasl-slapd.conf
Source5:        README.update
Source99:       baselibs.conf
Source100:      openldap-2.3.37.tar.bz2
Patch:          openldap2.dif
Patch1:         secpatch.dif
Patch2:         slapd_conf.dif
Patch3:         ldap_conf.dif
Patch4:         ldapi_url.dif
Patch5:         openldap-ntlm.diff
Patch6:         libldap-gethostbyname_r.dif
Patch7:         pie-compile.dif
Patch9:         openldap2-add-gnu-source.diff
Patch11:        slapd-bconfig-del-db.dif
Patch13:        slapd-bdb-stop-checkpoint.dif
Patch14:        slapo-collect-include.dif
Patch15:        fix-build-issues.patch
Patch100:       openldap-2.3.37.dif
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
OpenLDAP Client Utilities

This package contains the NTLM patched OpenLDAP client utilities for
Evolution



%package      -n evoldap2-devel
License:        BSD-3-Clause
Summary:        Libraries, Header Files and Documentation for NTLM patched OpenLDAP
AutoReqProv:    off
Conflicts:      openldap-devel
Requires:       libevoldap-2_4-2 = %{version}  cyrus-sasl-devel openssl-devel
Group:          Productivity/Networking/News/Clients

%description -n evoldap2-devel
This package provides the NTLM patched OpenLDAP libraries, header
files, and documentation.



%package      -n libevoldap-2_4-2
License:        BSD-3-Clause
Summary:        NTLM patched OpenLDAP Client Libraries
AutoReqProv:    off
Group:          Productivity/Networking/LDAP/Clients

%description -n libevoldap-2_4-2
This package contains the NTLM patched OpenLDAP client libraries.



%prep
%setup -q -n openldap-%{version} -a1 -a2 -b100
%patch
%patch1
%patch2
%patch3
%patch4
%patch5
%patch6
%if %suse_version > 920
%patch7
%endif
%patch9 -p1
%patch11
%patch13
%patch14 -p1
%patch15
cp %{SOURCE5} .
cd ../openldap-2.3.37
%patch100

%build
%{?suse_update_config:%{suse_update_config -f build}}
autoreconf -fiv
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing -DLDAP_DEPRECATED -DLDAP_CONNECTIONLESS -DSLAP_CONFIG_DELETE"
%configure --prefix=%{_libdir}/evoldap \
        --exec-prefix=%{_libdir}/evoldap \
        --sysconfdir=%{_libdir}/evoldap/etc \
        --localstatedir=/var/run/slapd \
        --libexecdir=%{_libdir}/evoldap/lib \
        --libdir=%{_libdir}/evoldap/lib \
        --mandir=%{_libdir}/evoldap/man \
        --bindir=%{_libdir}/evoldap/bin \
        --sbindir=%{_libdir}/evoldap/sbin \
        --datadir=%{_libdir}/evoldap/share \
        --includedir=%{_libdir}/evoldap/include \
        --enable-wrappers \
        --enable-aclgroups \
        --enable-spasswd \
        --enable-modules \
        --enable-shared \
        --enable-dynamic \
        --with-tls \
        --with-cyrus-sasl \
        --enable-crypt \
        --enable-ipv6=yes \
        --disable-slapd \
        --enable-lmpasswd \
        --with-yielding-select \
		--disable-static \
		--with-pic
make depend %{?_smp_mflags}
make %{?_smp_mflags}

%check
# 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/test023-refint
rm -f tests/scripts/test022-ppolicy
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
make SLAPD_DEBUG=0 test
%endif

%install
mkdir -p $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/evoldap/sbin
make 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/%{_libdir}/evoldap/sbin/rcldap
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/evoldap/etc/openldap/slapd.d
mkdir -p $RPM_BUILD_ROOT/%{_libdir}/evoldap/etc/sasl2
install -m 644 %{SOURCE4} $RPM_BUILD_ROOT/%{_libdir}/evoldap/etc/sasl2/slapd.conf
install -m 755 -d $RPM_BUILD_ROOT/var/lib/ldap
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/evoldap/lib/liblber.so*
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/evoldap/lib/libldap_r.so*
chmod a+x $RPM_BUILD_ROOT/%{_libdir}/evoldap/lib/libldap.so*
rm -f $RPM_BUILD_ROOT/%{_libdir}/evoldap/lib/openldap/modules/*.a
rm -f $RPM_BUILD_ROOT/%{_libdir}/evoldap/man/man5/slapd-dnssrv.5
rm -f $RPM_BUILD_ROOT/%{_libdir}/evoldap/man/man5/slapd-ndb.5
rm -f $RPM_BUILD_ROOT/%{_libdir}/evoldap/man/man5/slapd-null.5
rm -f $RPM_BUILD_ROOT/%{_libdir}/evoldap/man/man5/slapd-passwd.5
rm -f $RPM_BUILD_ROOT/%{_libdir}/evoldap/man/man5/slapd-shell.5
rm -f $RPM_BUILD_ROOT/%{_libdir}/evoldap/man/man5/slapd-sock.5
rm -f $RPM_BUILD_ROOT/%{_libdir}/evoldap/man/man5/slapd-sql.5
rm -f $RPM_BUILD_ROOT/%{_libdir}/evoldap/man/man5/slapd-tcl.5
# Remove *.la files, libtool does not handle this correct
rm -f  $RPM_BUILD_ROOT%{_libdir}/evoldap/lib/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
%{_libdir}/evoldap/sbin/rcldap
%{_libdir}/evoldap/sbin/slap*
%{_libdir}/evoldap/sbin/openldap-2.3-slapcat
%dir %{_libdir}/evoldap/etc/openldap
%dir %attr(0770, ldap, ldap) %{_libdir}/evoldap/etc/openldap/slapd.d
%dir %{_libdir}/evoldap/etc/openldap/schema
%config %{_libdir}/evoldap/etc/openldap/schema/*.schema
%config %{_libdir}/evoldap/etc/openldap/schema/*.ldif
%config(noreplace) %attr(640, root, ldap) %{_libdir}/evoldap/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) %{_libdir}/evoldap/etc/openldap/slapd.conf.default
%config(noreplace) %{_libdir}/evoldap/etc/sasl2/slapd.conf
%dir %{_libdir}/evoldap
%dir %{_libdir}/evoldap/modules
%{_libdir}/evoldap/slapd
%dir %attr(0700, ldap, ldap) /var/lib/ldap
%dir %attr(0700, ldap, ldap) /var/run/slapd
%doc %{_libdir}/evoldap/man/man8/sl*
%doc %{_libdir}/evoldap/man/man5/slapd.*
%doc %{_libdir}/evoldap/man/man5/slapd-bdb.*
%doc %{_libdir}/evoldap/man/man5/slapd-config.*
%doc %{_libdir}/evoldap/man/man5/slapd-hdb.*
%doc %{_libdir}/evoldap/man/man5/slapd-ldbm.*
%doc %{_libdir}/evoldap/man/man5/slapd-ldap.*
%doc %{_libdir}/evoldap/man/man5/slapd-ldif.*
%doc %{_libdir}/evoldap/man/man5/slapd-monitor.*
%doc %{_libdir}/evoldap/man/man5/slapd-relay.*
%doc %{_libdir}/evoldap/man/man5/slapo-*
%doc ANNOUNCEMENT COPYRIGHT INSTALL LICENSE README CHANGES
%doc doc/drafts doc/guide
%doc README.update
EOF
#
cat > openldap2-client.filelist <<EOF
%dir %{_libdir}/evoldap/etc/openldap
%config(noreplace) %{_libdir}/evoldap/etc/openldap/ldap.conf
%{_libdir}/evoldap/etc/openldap/ldap.conf.default
%{_libdir}/evoldap/bin/ldapadd
%{_libdir}/evoldap/bin/ldapcompare
%{_libdir}/evoldap/bin/ldapdelete
%{_libdir}/evoldap/bin/ldapexop
%{_libdir}/evoldap/bin/ldapmodify
%{_libdir}/evoldap/bin/ldapmodrdn
%{_libdir}/evoldap/bin/ldapsearch
%{_libdir}/evoldap/bin/ldappasswd
%{_libdir}/evoldap/bin/ldapwhoami
%doc %{_libdir}/evoldap/man/man1/ldap*
%doc %{_libdir}/evoldap/man/man5/ldap.conf*
%doc %{_libdir}/evoldap/man/man5/ldif.*
EOF
cat > libldap.filelist <<EOF
%{_libdir}/evoldap/lib/liblber*.so.*
%{_libdir}/evoldap/lib/libldap*.so.*
EOF
cat > openldap2-devel.filelist <<EOF
%{_libdir}/evoldap/include/lber.h
%{_libdir}/evoldap/include/lber_types.h
%{_libdir}/evoldap/include/ldap*.h
%{_libdir}/evoldap/include/slapi-plugin.h
%{_libdir}/evoldap/lib/liblber.so
%{_libdir}/evoldap/lib/libldap*.so
%doc %{_libdir}/evoldap/man/man3/ber*
%doc %{_libdir}/evoldap/man/man3/lber*
%doc %{_libdir}/evoldap/man/man3/ld_errno*
%doc %{_libdir}/evoldap/man/man3/ldap*
EOF
cat > openldap2-back-perl.filelist <<EOF
%{_libdir}/evoldap/modules/back_perl*
%doc %{_libdir}/evoldap/man/man5/slapd-perl.*
EOF
cat > openldap2-back-meta.filelist <<EOF
%{_libdir}/evoldap/modules/back_meta*
%doc %{_libdir}/evoldap/man/man5/slapd-meta.*
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 |
%endif
  grep -v "%dir " |sed -e "s|^.* ||" |grep "^/" |while read name ; do
    rm -rf $RPM_BUILD_ROOT$name
  done
#%{__mkdir_p} $RPM_BUILD_ROOT/etc/ld.so.conf.d/
#echo %{_libdir}/evoldap/lib > $RPM_BUILD_ROOT/etc/ld.so.conf.d/evoldap.conf
/sbin/ldconfig -n $RPM_BUILD_ROOT/%{_libdir}/evoldap/lib

%post -n libevoldap-2_4-2 -p /sbin/ldconfig

%postun -n libevoldap-2_4-2 -p /sbin/ldconfig

%files -f openldap2-client.filelist
%defattr(-,root,root)
%dir %{_libdir}/evoldap/bin
%dir %{_libdir}/evoldap/etc
%dir %{_libdir}/evoldap/man
%dir %{_libdir}/evoldap/man/man?

%files -n libevoldap-2_4-2 -f libldap.filelist
%defattr(-,root,root)
#%config /etc/ld.so.conf.d/evoldap.conf
%dir %{_libdir}/evoldap
%dir %{_libdir}/evoldap/lib

%files -n evoldap2-devel -f openldap2-devel.filelist
%defattr(-,root,root)
%dir %{_libdir}/evoldap/include

%changelog