File superlu.spec of Package superlu

#
# spec file for package superlu
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2016 Christoph GrĂ¼ninger foss@grueninger.de
#
# 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:           superlu
Summary:        A general purpose library for the direct solution of sparse systems of linear equations
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
Version:        5.2.1
Release:        0
%define soname lib%{name}5
#Source:         http://crd-legacy.lbl.gov/~xiaoye/SuperLU/superlu_5.2.1.tar.gz
Source:         %{name}_%{version}-bsd.tar.gz
Source1:        superlu_ug.pdf
Source2:        README.SUSE
Source3:        baselibs.conf
# PATCH-FIX-UPSTREAM superlu-4.3-include.patch : avoid implicit declaration warnings
Patch1:         superlu-4.3-include.patch
# PATCH-FIX-UPSTREAM superlu-4.3-dont-opt-away.diff
Patch2:         superlu-4.3-dont-opt-away.diff
# PATCH-FIX-OPENSUSE superlu-5.2-remove-mc64ad.patch [bnc#796236] 
# The Harwell Subroutine Library (HSL) routine mc64ad.c have been removed
# from the original sources for legal reasons. This patch disables the inclusion of
# this routine in the library which, however, remains fully functionnal
Patch3:         superlu-5.2-remove-mc64ad.patch
Url:            http://crd.lbl.gov/~xiaoye/SuperLU/
BuildRequires:  blas-devel
BuildRequires:  cmake >= 2.8.12
BuildRequires:  fdupes
BuildRequires:  gcc-fortran
BuildRequires:  tcsh
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
SuperLU is an algorithm that uses group theory to optimize LU
decomposition of sparse matrices.

%package -n %soname
Summary:        SuperLU matrix solver
Group:          System/Libraries

%description -n %soname
SuperLU is an algorithm that uses group theory to optimize LU
decomposition of sparse matrices.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %soname = %{version}
# The standalone superlu RPM has been eliminated, and the relevant
# files are now in superlu-devel
# The last standalone superlu RPM was was v3.0
Provides:       superlu = %{version}
Obsoletes:      superlu <= 3.0

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%prep
%setup -q -n SuperLU_%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
# superlu_ug.pdf in %%doc 
cp %SOURCE1 %SOURCE2 ./

%build
# FIXME: Drop the -Denable_tests=OFF flag when MATGEN linking issues are resolved
%cmake \
  -DCMAKE_BUILD_TYPE=Release -DUSE_XSDK_DEFAULTS='TRUE' -Denable_tests=OFF

make %{?_smp_mflags}
cd ..

%install
%cmake_install

#fix permissions
chmod 644 MATLAB/*

# remove all build examples
cd EXAMPLE
make clean
rm -rf *itersol*
cd ..
mv EXAMPLE examples
cp FORTRAN/README README.fortran
%fdupes -s examples

%check
ln -s examples/ EXAMPLE
export LD_LIBRARY_PATH=%{buildroot}%{_libdir}
make testing
echo -ne "\nTest results\n"
for i in stest dtest ctest ztest; do
    cat TESTING/$i.out
done

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

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

%files -n %soname
%defattr(-,root,root,-)
%doc README MATLAB README.SUSE
%{_libdir}/*.so.*

%files devel
%defattr(-,root,root,-)
%doc DOC/html examples README.fortran superlu_ug.pdf
%{_includedir}/*.h
%{_libdir}/*.so

%changelog
openSUSE Build Service is sponsored by