File taucs.spec of Package taucs

#
# spec file for package taucs
#
# Copyright (c) 2022 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define libname libtaucs2

Summary:        A library of Sparce Linear Solvers
License:        MIT
Group:          Productivity/Scientific/Math
Name:           taucs
Version:        2.2
Release:        0
URL:            http://www.cs.tau.ac.il/~stoledo/taucs/
Source0:        http://www.tau.ac.il/~stoledo/taucs/2.2/%{name}.tgz
Patch0:         taucs-2.2-configurator.patch
BuildRequires:  gcc-fortran
BuildRequires:  lapack-devel
BuildRequires:  scotch-metis-devel

%description
TAUCS is a C library of sparse linear solvers.

Features: 
* Multifrontal Supernodal Cholesky Factorization
* Left-LookingSupernodal Cholesky Factorization
* Drop-Tolerance Incomplete-Cholesky Factorization
* LDL^T Factorization
* Out-of-Core, Left-Looking Supernodal Sparse Cholesky Factorization
* Out-of-Core Sparse LU with Partial
* Pivoting Factor and Solve
* Ordering Codes and Interfaces to Existing Ordering Codes
* Matrix Operations, Matrix Input/Output, Matrix Generators
* Iterative Solvers
* Vaidya's Preconditioners
* Recursive Vaidya's Preconditioners
* Multilevel-Support-Graph Preconditioners.
  
%package -n %libname
Summary:        Shared libraries for taucs
Group:          System/Libraries

%description -n %libname
Shared libraries for taucs sparce linear solver.


%package -n %libname-devel
Summary:        Development files and header for taucs
Group:          Development/Libraries/C and C++
Requires:       %libname = %{version}-%{release}
Requires:       lapack-devel
Requires:       scotch-metis-devel

%description -n %libname-devel
Development files and header for taucs sparce linear solver.


%prep
%setup -q -c -n %{name} 
%patch0 -p1 -b .configurator
sed -i -e 's|-lf77blas -lcblas -latlas|-lblas|' \
       -e 's|-lg2c||' \
     config/linux.mk

mkdir -p external/lib/linux/
ln -s %{_libdir}/libblas.so external/lib/linux/libblas.so
ln -s %{_libdir}/liblapack.so external/lib/linux/liblapack.so

%build
./configure
make OPT_FLAGS="%{optflags} -fPIC" \
     LIBBLAS=-lblas LIBLAPACK=-llapack
# build shared
mkdir shared
pushd shared
ar x ../lib/linux/libtaucs.a
gfortran -s -shared -Wl,-soname,libtaucs.so.2 -o ../libtaucs.so.2.2 *.o
popd

%install
install -D -m755 -t %{buildroot}%{_bindir} bin/linux/{direct,iter,taucs_run}
install -D -m755 -t %{buildroot}%{_libdir} libtaucs.so.2.2
ln -s lib%name.so.2.2 %{buildroot}%{_libdir}/lib%name.so.2
ln -s lib%name.so.2 %{buildroot}%{_libdir}/lib%name.so

install -d %{buildroot}%{_includedir}
install -p -m644 src/*.h build/linux/*.h %{buildroot}%{_includedir}

# One the test_linsolve test program fail to build on i586
# so we enable the %%check section for x86_64 only
%ifnarch %{ix86}
%check
export LD_LIBRARY_PATH=%{_buildroot}%{_libdir}
./testscript
# print test results and search for any failure
cat testscript.log
grep "FAILED" testscript.log && echo "Some tests have failed !"
%endif

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

%files
%doc CGAL-README.TXT doc/%{name}.pdf
%{_bindir}/*

%files -n %libname
%{_libdir}/*.so.*

%files -n %libname-devel
%{_includedir}/*.h
%{_libdir}/*.so

%changelog
openSUSE Build Service is sponsored by