File libdlm.spec of Package libdlm.2839

#
# spec file for package libdlm
#
# Copyright (c) 2016 SUSE LINUX 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
%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:        4.0.4
Release:        0
Url:            http://sources.redhat.com/cluster/wiki
Source:         libdlm-4.0.4.tar.gz
Patch1:         remove-sd-notify.patch
Patch2:         bnc#874705nodes-without-quorum.patch
Patch3:         Makefile-for-diff-arch.patch
Patch4:         0001-dlm_controld-outputs-explicit-info-about-stateful-me.patch
Patch5:         0002-dlm_controld-fix-missing-braces.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  glib2-devel
BuildRequires:  libcorosync-devel
BuildRequires:  libpacemaker-devel
BuildRequires:  libtool
BuildRequires:  libxml2-devel
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(udev)

%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
# libdlm2 (openSUSE 11.2) also contained libdlm*.so.3
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
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
###########################################################

%build
make all UDEVDIR="%{_udevrulesdir}"
###########################################################

%install
###########################################################
make DESTDIR=$RPM_BUILD_ROOT UDEVDIR="%{_udevrulesdir}" install
mkdir -p $RPM_BUILD_ROOT%{_datadir}/doc/packages/libdlm-%{version}

install -Dm 0644 init/dlm.service $RPM_BUILD_ROOT%{_unitdir}/dlm.service
install -Dm 0644 init/dlm.sysconfig $RPM_BUILD_ROOT/var/adm/fillup-templates/sysconfig.dlm

###########################################################

%post
%fillup_only -n dlm
%{?udev_rules_update}
%service_add_post dlm.service

%preun
%service_del_preun dlm.service

%pre
%service_add_pre dlm.service

%postun
%service_del_postun dlm.service

%clean
###########################################################
make clean
###########################################################

%post   -n libdlm3 -p /sbin/ldconfig
%postun -n libdlm3 -p /sbin/ldconfig

%files
###########################################################
%defattr(-,root,root)
%dir %{_datadir}/doc/packages/libdlm-%{version}
%{_udevrulesdir}/51-dlm.rules
%{_sbindir}/dlm_controld
%{_sbindir}/dlm_stonith
%{_sbindir}/dlm_tool
%{_datadir}/man/man8/*.gz
%{_datadir}/man/man3/*.gz
%{_datadir}/man/man5/*.gz
%{_datadir}/doc/packages/libdlm-%{version}
%{_unitdir}/dlm.service
/var/adm/fillup-templates/sysconfig.dlm

%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
%{_includedir}/libdlm.h
%{_includedir}/libdlmcontrol.h

%changelog