File sparskit.spec of Package sparskit

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


%define major 2
%define minor 0
%define libname libskit%{major}_%{minor}

Name:           sparskit
Version:        2.0.0
Release:        0
Summary:        A basic tool-kit for sparse matrix computations
License:        LGPL-2.1
Group:          Development/Libraries/C and C++
Url:            http://www-users.cs.umn.edu/~saad/software/SPARSKIT/sparskit.html
Source:         http://www-users.cs.umn.edu/~saad/software/SPARSKIT/SPARSKIT2.tar.gz
# PATCH-FEATURE-OPENSUSE sparskit2-cmake.patch : cmaking sparskit thanks to debian
Patch0:         sparskit2-cmake.patch
# PATCH-FIX-UPSTREAM sparskit-2.0.0-undefined-symbol.patch : add undefined symbols thanks to debian
Patch1:         sparskit-2.0.0-undefined-symbol.patch
BuildRequires:  blas-devel
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
SPARSKIT is a package of FORTRAN subroutines for working with sparse matrices.
It includes general sparse matrix manipulation routines as well as a few
iterative solvers.

%package -n %libname
Summary:        SPARSKIT Shared Library
Group:          Development/Libraries/C and C++

%description -n %libname
SPARSKIT is a package of FORTRAN subroutines for working with sparse matrices.
It includes general sparse matrix manipulation routines as well as a few
iterative solvers.

%package devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++

%description devel
SPARSKIT is a package of FORTRAN subroutines for working with sparse matrices.
It includes general sparse matrix manipulation routines as well as a few
iterative solvers.

%package devel-static
Summary:        Static library files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name}-devel = %{version}

%description devel-static
SPARSKIT is a package of FORTRAN subroutines for working with sparse matrices.
It includes general sparse matrix manipulation routines as well as a few
iterative solvers.

%prep
%setup -n SPARSKIT2
%patch0 -p1
%patch1 -p1
mkdir -p static shared

%build
cd static
cmake -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
      -DCMAKE_SKIP_RPATH:BOOL=ON \
      -DCMAKE_SHARED_LINKER_FLAGS="-z muldefs" \
      -DBUILD_SHARED_LIBS:BOOL=OFF \
      -DBUILD_TESTING:BOOL=ON \
      ..
make %{?_smp_mflags}
cd ..

cd shared
cmake -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
      -DCMAKE_SKIP_RPATH:BOOL=ON \
      -DCMAKE_SHARED_LINKER_FLAGS="-z muldefs" \
      -DBUILD_SHARED_LIBS:BOOL=ON \
      -DBUILD_TESTING:BOOL=OFF \
      ..
make %{?_smp_mflags}
cd ..

%install
mkdir -p %{buildroot}%{_libdir}
install -D -m 0644 static/libskit.a %{buildroot}%{_libdir}/libskit.a
install -D -m 0755 shared/libskit.so.%{version} %{buildroot}%{_libdir}/libskit.so.%{version}
ln -s libskit.so.%{version} $RPM_BUILD_ROOT/%{_libdir}/libskit.so.%{major}.%{minor}
ln -s libskit.so.%{version} $RPM_BUILD_ROOT/%{_libdir}/libskit.so

%check
./static/ITSOL/riters.ex

%post -n %libname -p /sbin/ldconfig

%postun -n %libname -p /sbin/ldconfig

%files -n %libname
%defattr(-,root,root,-)
%{_libdir}/libskit.so.%{version}
%{_libdir}/libskit.so.%{major}.%{minor}

%files devel
%defattr(-,root,root)
%doc README DOC/QUICK_REF DOC/paper.pdf
%{_libdir}/libskit.so

%files devel-static
%defattr(-,root,root)
%{_libdir}/libskit.a

%changelog
openSUSE Build Service is sponsored by