File dmapi.spec of Package dmapi

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


%define lname	libdm0
Name:           dmapi
Version:        2.2.12
Release:        0
Summary:        Data Management API Runtime Environment
License:        GPL-2.0+
Group:          Development/Libraries/C and C++
Url:            http://oss.sgi.com/projects/xfs/
Source0:        ftp://oss.sgi.com/projects/xfs/cmd_tars/dmapi-%{version}.tar.gz
Source1:        ftp://oss.sgi.com/projects/xfs/cmd_tars/dmapi-%{version}.tar.gz.sig
Source2:        %{name}.keyring
Source3:        baselibs.conf
Patch0:         dmapi-docdir.diff
Patch1:         no-getdents-aarch64.diff
Patch2:         dmapi-add-missing-includes-to-handle2path.patch
BuildRequires:  e2fsprogs-devel
BuildRequires:  xfsprogs-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This package contains files required by system software using the Data
Management API. (DMAPI).  This is used to implement the interface
defined in the X/Open document:  Systems Management: Data Storage
Management (XDSM) API dated February 1997.  This interface is
implemented by the libdm library.

%package -n %{lname}
Summary:        Data Management API Runtime Environment
Group:          Development/Libraries/C and C++
Obsoletes:      dmapi < %{version}-%{release}
Provides:       dmapi = %{version}-%{release}

%description -n %{lname}
This package contains files required by system software using the Data
Management API. (DMAPI).  This is used to implement the interface
defined in the X/Open document:  Systems Management: Data Storage
Management (XDSM) API dated February 1997.  This interface is
implemented by the libdm library.

%package      devel
Summary:        DMAPI Libraries and Header Files
Group:          Development/Libraries/C and C++
Requires:       %{lname} = %{version}

%description devel
The dmapi-devel package contains the libraries and header files needed
to develop programs which make use of the Data Management API (DMAPI).
If you install dmapi-devel, you will also want to install the dmapi
(runtime) package and the xfsprogs-devel package.

%prep
%setup -q
%patch0
%patch1
%patch2 -p1

%build
export LCFLAGS="%{optflags}"
# Upstream: devel files (libdm.la) into libexecdir, what gives?
%configure --libdir=/%{_lib} --libexecdir=%{_libdir}
make %{?_smp_mflags}

%install
export DIST_ROOT="$RPM_BUILD_ROOT"
%{_bindir}/make install
%{_bindir}/make install-dev
# remove devel stuff from /lib
rm %{buildroot}/%{_lib}/libdm.{so,a,la}
rm %{buildroot}/%{_libdir}/libdm.so
pushd %{buildroot}%{_libdir}
	ls ../../%{_lib}/libdm.so.[0-9]
	ln -s ../../%{_lib}/libdm.so.[0-9] libdm.so
popd
mv "%{buildroot}/%{_defaultdocdir}/%{name}" "%{buildroot}/%{_defaultdocdir}/%{lname}";
find %{buildroot}

%post -n %{lname} -p /sbin/ldconfig

%postun -n %{lname} -p /sbin/ldconfig

%files -n %{lname}
%defattr(-,root,root,755)
/%{_lib}/libdm.so.*
%doc %{_defaultdocdir}/%{lname}

%files devel
%defattr(-,root,root,755)
%{_includedir}/xfs
%{_libdir}/libdm.a
%{_libdir}/libdm.so
%{_libdir}/libdm.la
%{_mandir}/man3/*

%changelog
openSUSE Build Service is sponsored by