File dmapi.spec of Package dmapi

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


Name:           dmapi
%define lname	libdm0
BuildRequires:  e2fsprogs-devel
BuildRequires:  xfsprogs-devel
Version:        2.2.12
Release:        0
Url:            http://oss.sgi.com/projects/xfs/
Summary:        Data Management API Runtime Environment
License:        GPL-2.0+
Group:          Development/Libraries/C and C++
Source0:        dmapi-%{version}.tar.bz2
Patch0:         dmapi-docdir.diff
Patch1:         no-getdents-aarch64.diff
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
Requires:       %lname = %version
Summary:        DMAPI Libraries and Header Files
Group:          Development/Libraries/C and C++

%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

%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"
/usr/bin/make install
/usr/bin/make install-dev
# remove devel stuff from /lib
rm $RPM_BUILD_ROOT/%_lib/libdm.{so,a,la}
rm $RPM_BUILD_ROOT/%_libdir/libdm.so
pushd $RPM_BUILD_ROOT%_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 $RPM_BUILD_ROOT

%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)
/usr/include/xfs
%_libdir/libdm.a
%_libdir/libdm.so
%_libdir/libdm.la
/usr/share/man/man3/*

%changelog
openSUSE Build Service is sponsored by