File mozldap.spec of Package mozldap

#
# spec file for package mozldap
#
# Copyright (c) 2009-2011 Wolfgang Rosenauer
#
# 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


Name:          mozldap
BuildRequires: gcc-c++ svrcore-devel cyrus-sasl-devel
Summary:       Mozilla LDAP C SDK
%define major  6
%define minor  0
%define submin 7
Version:       %{major}.%{minor}.%{submin}
Release:       1
License:       MPLv1.1 or GPLv2+ or LGPLv2+
URL:           http://www.mozilla.org/directory/csdk.html
Group:         System/Libraries
Source0:       ftp://ftp.mozilla.org/pub/mozilla.org/directory/c-sdk/releases/v%{version}/src/mozldap-%{version}.tar.gz
BuildRoot:     %{_tmppath}/%{name}-%{version}-build
%define libsuffix 60
%define nspr_ver %(rpm -q --queryformat '%{VERSION}' mozilla-nspr)
%define nss_ver  %(rpm -q --queryformat '%{VERSION}' mozilla-nss)
%define svrcore_ver %(rpm -q --queryformat '%{VERSION}' svrcore-devel)

%description
The Mozilla LDAP C SDK is a set of libraries that
allow applications to communicate with LDAP directory
servers.  These libraries are derived from the University
of Michigan and Netscape LDAP libraries.  They use Mozilla
NSPR and NSS for crypto.


%package tools
Summary:          Tools for the Mozilla LDAP C SDK
Group:            System/Management
Requires:         %{name} = %{version}-%{release}

%description tools
The mozldap-tools package provides the ldapsearch,
ldapmodify, and ldapdelete tools that use the
Mozilla LDAP C SDK libraries.


%package devel
Summary:       Development libraries and examples for Mozilla LDAP C SDK
License:       MPLv1.1 or GPLv2+ or LGPLv2+
Group:         Development/Libraries/Other
Requires:      %{name} = %{version}-%{release}
Requires:      pkgconfig mozilla-nspr-devel mozilla-nss-devel

%description devel
Header and Library files for doing development with the Mozilla LDAP C SDK

%prep
%setup -q

%build
cd c-sdk
%configure \
%ifarch x86_64 ppc64 ia64 s390x
    --enable-64bit \
%endif
    --with-sasl \
    --enable-clu \
    --with-system-svrcore \
    --enable-optimize \
    --disable-debug
# Enable compiler optimizations and disable debugging code
BUILD_OPT=1
export BUILD_OPT
# Generate symbolic info for debuggers
XCFLAGS="$RPM_OPT_FLAGS"
export XCFLAGS
PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
PKG_CONFIG_ALLOW_SYSTEM_CFLAGS=1
export PKG_CONFIG_ALLOW_SYSTEM_LIBS
export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS
make %{?jobs:-j%jobs} \
%ifarch x86_64 ppc64 ia64 s390x
    USE_64=1
%endif

%install
# Set up our package file
%{__mkdir_p} $RPM_BUILD_ROOT%{_libdir}/pkgconfig
%{__cat} c-sdk/mozldap.pc.in \
    | sed -e "s,%%libdir%%,%{_libdir},g" \
          -e "s,%%prefix%%,%{_prefix},g" \
          -e "s,%%major%%,%{major},g" \
          -e "s,%%minor%%,%{minor},g" \
          -e "s,%%submin%%,%{submin},g" \
          -e "s,%%libsuffix%%,%{libsuffix},g" \
          -e "s,%%bindir%%,%{_libexecdir}/%{name},g" \
          -e "s,%%exec_prefix%%,%{_prefix},g" \
          -e "s,%%includedir%%,%{_includedir}/%{name},g" \
          -e "s,%%NSPR_VERSION%%,%{nspr_ver},g" \
          -e "s,%%NSS_VERSION%%,%{nss_ver},g" \
          -e "s,%%SVRCORE_VERSION%%,%{svrcore_ver},g" \
          -e "s,%%MOZLDAP_VERSION%%,%{version},g" \
    > $RPM_BUILD_ROOT%{_libdir}/pkgconfig/%{name}.pc
# There is no make install target so we'll do it ourselves.
%{__mkdir_p} $RPM_BUILD_ROOT%{_includedir}/%{name}
%{__mkdir_p} $RPM_BUILD_ROOT%{_libdir}/%{name}
echo $(pwd)
# Copy the binary libraries we want
for file in libssldap%{libsuffix}.so libprldap%{libsuffix}.so libldap%{libsuffix}.so libldif%{libsuffix}.so
do
  %{__install} -m 755 ../dist/lib/$file $RPM_BUILD_ROOT%{_libdir}
done
# Copy the binaries we want
%{__mkdir_p} $RPM_BUILD_ROOT%{_libexecdir}/%{name}
for file in ldapsearch ldapmodify ldapdelete ldapcmp ldapcompare ldappasswd
do
  %{__install} -m 755 ../dist/bin/$file $RPM_BUILD_ROOT%{_libexecdir}/%{name}
done
# Copy the include files
for file in ../dist/public/ldap/*.h
do
  %{__install} -p -m 644 $file $RPM_BUILD_ROOT%{_includedir}/%{name}
done
# Copy the developer files
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/%{name}
cp -r c-sdk/ldap/examples $RPM_BUILD_ROOT%{_datadir}/%{name}
%{__mkdir_p} $RPM_BUILD_ROOT%{_datadir}/%{name}/etc
%{__install} -m 644 c-sdk/ldap/examples/xmplflt.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/etc
%{__install} -m 644 c-sdk/ldap/libraries/libldap/ldaptemplates.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/etc
%{__install} -m 644 c-sdk/ldap/libraries/libldap/ldapfilter.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/etc
%{__install} -m 644 c-sdk/ldap/libraries/libldap/ldapsearchprefs.conf $RPM_BUILD_ROOT%{_datadir}/%{name}/etc

%clean
%{__rm} -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)
%{_libdir}/libssldap*.so
%{_libdir}/libprldap*.so
%{_libdir}/libldap*.so
%{_libdir}/libldif*.so

%files tools
%defattr(-,root,root,-)
%dir %{_libexecdir}/%{name}
%{_libexecdir}/%{name}/ldapsearch
%{_libexecdir}/%{name}/ldapmodify
%{_libexecdir}/%{name}/ldapdelete
%{_libexecdir}/%{name}/ldapcmp
%{_libexecdir}/%{name}/ldapcompare
%{_libexecdir}/%{name}/ldappasswd

%files devel
%defattr(-,root,root,-)
%{_libdir}/pkgconfig/%{name}.pc
%{_includedir}/%{name}
%{_datadir}/%{name}

%changelog
openSUSE Build Service is sponsored by