File libdlm.spec of Package libdlm.openSUSE_12.3_Update

#
# spec file for package libdlm
#
# Copyright (c) 2013 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/
#


%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
License:        GPL-2.0 and GPL-2.0+ and LGPL-2.1+
Group:          Productivity/Clustering/HA
Version:        3.00.01
Release:        0
Url:            http://sources.redhat.com/cluster/wiki
Source:         libdlm.tar.bz2
Patch0:         libdlm-pacemaker.patch
Patch1:         libdlm-gcc47.patch
Patch2:         bnc777137-fix-plock-dev_write-no-op.patch
Patch3:         bnc798263-fix-opensuse123-compile-error.patch
Patch4:         use-symlink-in-udev-rules.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       pacemaker
BuildRequires:  glib2-devel
BuildRequires:  kernel-source >= 2.6.26
BuildRequires:  libcorosync-devel
BuildRequires:  libopenais-devel
BuildRequires:  libpacemaker-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel

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

%package -n     libdlm3
Summary:        Application interface to the kernel's distributed lock manager
License:        GPL-2.0 and GPL-2.0+ and LGPL-2.1+
Group:          Productivity/Clustering/HA
Obsoletes:      libdlm2
Conflicts:      libdlm2

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

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

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

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

%build
modified="$(sed -n '/^----/n;s/ - .*$//;p;q' "%{_sourcedir}/%{name}.changes")"
DATE="\"$(date -d "${modified}" "+%%b %%e %%Y")\""
TIME="\"$(date -d "${modified}" "+%%R")\""
find . -name '*.[ch]' -exec sed -i "s/__DATE__/${DATE}/g;s/__TIME__/${TIME}/g" {} +

# 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
openSUSE Build Service is sponsored by