File libdlm.spec of Package libdlm

#
# spec file for package libdlm
#
# 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/
#

# norootforbuild

%if 0%{?suse_version}
%define _libexecdir %{_libdir}
%endif
%define with_extra_warnings   	0
%define with_debugging  	0
%define without_fatal_warnings 	1
%if 0%{?fedora_version} || 0%{?centos_version} || 0%{?rhel_version}
%define pkg_group System Environment/Daemons
%else
%define pkg_group Productivity/Clustering/HA
%endif

Name:           libdlm
Summary:        Application interface to the kernel's distributed lock manager
Version:        3.00.01
Release:        5
License:        GPLv2 ; GPLv2+ ; LGPLv2.1+
Url:            http://sources.redhat.com/cluster/wiki
Group:          Productivity/Clustering/HA
Source:         libdlm.tar.bz2
Patch1:         upstream-submissions.diff
Patch2:         sles-specific.diff
Patch3:         bnc-634240_reset-fs_notified.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
AutoReqProv:    on
Requires:       pacemaker
BuildRequires:  glib2-devel kernel-source >= 2.6.26 libcorosync-devel libopenais-devel libpacemaker-devel libxml2-devel

%description
Libraries and tools that allows applications, particularly filesystems
like OCFS2, to interface with the in-kernel distributed lock manager.



Authors:
--------
    A. J. Lewis <alewis@redhat.com>
    Abhijith Das <adas@redhat.com>
    Adam Manthei <amanthei@redhat.com>
    Alasdair G. Kergon <agk@redhat.com>
    Andrew Price <andy@andrewprice.me.uk>
    Benjamin Marzinski <bmarzins@redhat.com>
    Bob Peterson <rpeterso@redhat.com>
    Chris Feist <cfeist@redhat.com>
    Christine Caulfield <ccaulfie@redhat.com>
    Daniel Phillips <phillips@redhat.com>
    David Teigland <teigland@redhat.com>
    Fabio M. Di Nitto <fdinitto@redhat.com>
    James Parsons <jparsons@redhat.com>
    Joel Becker <joel.becker@oracle.com>
    Jonathan Brassow <jbrassow@redhat.com>
    Ken Preslan <kpreslan@redhat.com>
    Lon Hohberger <lhh@redhat.com>
    Marc - A. Dahlhaus <mad@wol.de>
    Marek Grac <mgrac@redhat.com>
    Mark Hlawatschek <hlawatschek@atix.de>
    Michael Conrad Tadpol Tilstra <mtilstra@redhat.com>
    Patrick Caulfield <pcaulfie@redhat.com>
    Robert Peterson <rpeterso@redhat.com>
    Ross Vandegrift <ross@kallisti.us>
    Ryan McCabe <rmccabe@redhat.com>
    Ryan O'Hara <rohara@redhat.com>
    Stanko Kupcevic <kupcevic@redhat.com>
    Steven Whitehouse <swhiteho@redhat.com>
    Wendy Cheng <wcheng@redhat.com>
    jparsons <jparsons@redhat.com>

%package -n     libdlm3
Summary:        Application interface to the kernel's distributed lock manager
License:        GPLv2 ; GPLv2+ ; LGPLv2.1+
Group:          Productivity/Clustering/HA
Obsoletes:      libdlm2
Conflicts:      libdlm2

%description -n libdlm3
Libraries and tools that allows applications, particularly filesystems
like OCFS2, to interface with the in-kernel distributed lock manager.

Authors: A. J. Lewis <alewis@redhat.com> Abhijith Das <adas@redhat.com>
Adam Manthei <amanthei@redhat.com> Alasdair G. Kergon <agk@redhat.com>
Andrew Price <andy@andrewprice.me.uk> Benjamin Marzinski
<bmarzins@redhat.com> Bob Peterson <rpeterso@redhat.com> Chris Feist
<cfeist@redhat.com> Christine Caulfield <ccaulfie@redhat.com> Daniel
Phillips <phillips@redhat.com> David Teigland <teigland@redhat.com>
Fabio M. Di Nitto <fdinitto@redhat.com> James Parsons
<jparsons@redhat.com> Joel Becker <joel.becker@oracle.com> Jonathan
Brassow <jbrassow@redhat.com> Ken Preslan <kpreslan@redhat.com> Lon
Hohberger <lhh@redhat.com> Marc - A. Dahlhaus <mad@wol.de> Marek Grac
<mgrac@redhat.com> Mark Hlawatschek <hlawatschek@atix.de> Michael
Conrad Tadpol Tilstra <mtilstra@redhat.com> Patrick Caulfield
<pcaulfie@redhat.com> Robert Peterson <rpeterso@redhat.com> Ross
Vandegrift <ross@kallisti.us> Ryan McCabe <rmccabe@redhat.com> Ryan
O'Hara <rohara@redhat.com> Stanko Kupcevic <kupcevic@redhat.com> Steven
Whitehouse <swhiteho@redhat.com> Wendy Cheng <wcheng@redhat.com>
jparsons <jparsons@redhat.com>



Authors:
--------
    A. J. Lewis <alewis@redhat.com>
    Abhijith Das <adas@redhat.com>
    Adam Manthei <amanthei@redhat.com>
    Alasdair G. Kergon <agk@redhat.com>
    Andrew Price <andy@andrewprice.me.uk>
    Benjamin Marzinski <bmarzins@redhat.com>
    Bob Peterson <rpeterso@redhat.com>
    Chris Feist <cfeist@redhat.com>
    Christine Caulfield <ccaulfie@redhat.com>
    Daniel Phillips <phillips@redhat.com>
    David Teigland <teigland@redhat.com>
    Fabio M. Di Nitto <fdinitto@redhat.com>
    James Parsons <jparsons@redhat.com>
    Joel Becker <joel.becker@oracle.com>
    Jonathan Brassow <jbrassow@redhat.com>
    Ken Preslan <kpreslan@redhat.com>
    Lon Hohberger <lhh@redhat.com>
    Marc - A. Dahlhaus <mad@wol.de>
    Marek Grac <mgrac@redhat.com>
    Mark Hlawatschek <hlawatschek@atix.de>
    Michael Conrad Tadpol Tilstra <mtilstra@redhat.com>
    Patrick Caulfield <pcaulfie@redhat.com>
    Robert Peterson <rpeterso@redhat.com>
    Ross Vandegrift <ross@kallisti.us>
    Ryan McCabe <rmccabe@redhat.com>
    Ryan O'Hara <rohara@redhat.com>
    Stanko Kupcevic <kupcevic@redhat.com>
    Steven Whitehouse <swhiteho@redhat.com>
    Wendy Cheng <wcheng@redhat.com>
    jparsons <jparsons@redhat.com>

%package        devel 
License:        LGPLv2.1+
Summary:        Application interface to the kernel's distributed lock manager
Group:          Development/Libraries/C and C++
Requires:       libdlm3 = %{version}

%description devel
Libraries and tools that allows applications, particularly filesystems
like OCFS2, to interface with the in-kernel distributed lock manager.



Authors:
--------
    A. J. Lewis <alewis@redhat.com>
    Abhijith Das <adas@redhat.com>
    Adam Manthei <amanthei@redhat.com>
    Alasdair G. Kergon <agk@redhat.com>
    Andrew Price <andy@andrewprice.me.uk>
    Benjamin Marzinski <bmarzins@redhat.com>
    Bob Peterson <rpeterso@redhat.com>
    Chris Feist <cfeist@redhat.com>
    Christine Caulfield <ccaulfie@redhat.com>
    Daniel Phillips <phillips@redhat.com>
    David Teigland <teigland@redhat.com>
    Fabio M. Di Nitto <fdinitto@redhat.com>
    James Parsons <jparsons@redhat.com>
    Joel Becker <joel.becker@oracle.com>
    Jonathan Brassow <jbrassow@redhat.com>
    Ken Preslan <kpreslan@redhat.com>
    Lon Hohberger <lhh@redhat.com>
    Marc - A. Dahlhaus <mad@wol.de>
    Marek Grac <mgrac@redhat.com>
    Mark Hlawatschek <hlawatschek@atix.de>
    Michael Conrad Tadpol Tilstra <mtilstra@redhat.com>
    Patrick Caulfield <pcaulfie@redhat.com>
    Robert Peterson <rpeterso@redhat.com>
    Ross Vandegrift <ross@kallisti.us>
    Ryan McCabe <rmccabe@redhat.com>
    Ryan O'Hara <rohara@redhat.com>
    Stanko Kupcevic <kupcevic@redhat.com>
    Steven Whitehouse <swhiteho@redhat.com>
    Wendy Cheng <wcheng@redhat.com>
    jparsons <jparsons@redhat.com>

%prep
###########################################################
%setup -n libdlm
%patch1 -p1
%patch2 -p1
%patch3 -p1
###########################################################

%build
# TODO: revisit -all
CFLAGS="${CFLAGS} ${RPM_OPT_FLAGS}"
# Feature-dependent CFLAGS:
%if %with_extra_warnings
# CFLAGS="${CFLAGS} -Wshadow -Wfloat-equal -Waggregate-return -Wnested-externs -Wunreachable-code -Wendif-labels -Winline"
CFLAGS="${CFLAGS} -Wfloat-equal -Wendif-labels -Winline"
%endif
%if %with_debugging
CFLAGS="${CFLAGS} -O0"
%endif
# Distribution specific settings:
%if 0%{?suse_version} > 1001
CFLAGS="${CFLAGS} -fstack-protector-all"
%endif
%if 0%{?suse_version} > 1020
CFLAGS="$CFLAGS -fgnu89-inline"
%endif
%if 0%{?fedora_version} > 6
CFLAGS="$CFLAGS -fgnu89-inline"
%endif
export CFLAGS
./autogen.sh
%configure --enable-pacemaker --disable-cman
export MAKE="make %{?jobs:-j%jobs}"
make %{?jobs:-j%jobs}
###########################################################

%install
###########################################################
make DESTDIR=$RPM_BUILD_ROOT install
mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/packages/
mv $RPM_BUILD_ROOT%{_datadir}/doc/{dlm,packages/libdlm-%{version}}
# Cleanup
[ -d $RPM_BUILD_ROOT/usr/share/libtool ] && rm -rf $RPM_BUILD_ROOT/usr/share/libtool
find $RPM_BUILD_ROOT -name '*.a' -type f -print0 | xargs -0 rm -f
find $RPM_BUILD_ROOT -name '*.la' -type f -print0 | xargs -0 rm -f
###########################################################

%clean
###########################################################
if
  [ -n "${RPM_BUILD_ROOT}" -a "${RPM_BUILD_ROOT}" != "/" ]
then
  rm -rf $RPM_BUILD_ROOT
fi
###########################################################

%post   -n libdlm3 -p /sbin/ldconfig

%postun -n libdlm3 -p /sbin/ldconfig

%files
###########################################################
%defattr(-,root,root)
%dir %{_sysconfdir}/udev
%dir %{_sysconfdir}/udev/rules.d
%dir %{_datadir}/doc/packages/libdlm-%{version}
%config %{_sysconfdir}/udev/rules.d/51-dlm.rules
%{_sbindir}/dlm_controld.pcmk
%{_sbindir}/dlm_tool
%{_datadir}/man/man8/dlm_tool.8.gz
%{_datadir}/man/man8/dlm_controld.8.gz
%{_datadir}/doc/packages/libdlm-%{version}

%files -n libdlm3
%defattr(-,root,root)
%{_libdir}/libdlm.so.*
%{_libdir}/libdlm_lt.so.*
%{_libdir}/libdlmcontrol.so.*

%files devel
###########################################################
%defattr(-,root,root)
%{_libdir}/libdlm*.so
%{_libdir}/pkgconfig/libdlm.pc
%{_libdir}/pkgconfig/libdlm_lt.pc
%{_libdir}/pkgconfig/libdlmcontrol.pc
%{_includedir}/libdlm.h
%{_includedir}/libdlmcontrol.h
%{_datadir}/man/man3/dlm_*.3.gz
%{_datadir}/man/man3/libdlm.3.gz

%changelog