File suitesparse.spec of Package suitesparse

#
# spec file for package suitesparse
#
# 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/
#

Name:               suitesparse
Summary:            A collection of sparse matrix libraries
Version:            4.0.0
Release:            0
Group:              Development/Libraries/Parallel
License:            GPL-2.0+ and LGPL-2.1+
Url:                http://www.cise.ufl.edu/research/sparse/SuiteSparse
Source:             SuiteSparse-%{version}.tar.gz
Source2:            %{name}-rpmlintrc
BuildRoot:          %{_tmppath}/%{name}-%{version}-build
BuildRequires:      blas-devel
BuildRequires:      gcc-c++
BuildRequires:      gcc-fortran
BuildRequires:      lapack-devel
%define amdver      2.3.0
%define amdso       2_3_0
%define btfver      1.2.0
%define btfso       1_2_0
%define camdver     2.3.0
%define camdso      2_3_0
%define ccolamdver  2.8.0
%define ccolamdso   2_8_0
%define cholmodver  2.0.0
%define cholmodso   2_0_0
%define colamdver   2.8.0
%define colamdso    2_8_0
%define csparsever  3.1.0
%define csparseso   3_1_0
%define cxsparsever 3.1.0
%define cxsparseso  3_1_0
%define kluver      1.2.0
%define kluso       1_2_0
%define ldlver      2.1.0
%define ldlso       2_1_0
%define rbiover     2.1.0
%define rbioso      2_1_0
%define spqrver     1.3.0
%define spqrso      1_3_0
%define umfpackver  5.6.0
%define umfpackso   5_6_0
%define amdlib      libamd-%{amdso}
%define btflib      libbtf-%{btfso}
%define camdlib     libcamd-%{camdso}
%define ccolamdlib  libccolamd-%{ccolamdso}
%define cholmodlib  libcholmod-%{cholmodso}
%define colamdlib   libcolamd-%{colamdso}
%define csparselib  libcsparsever-%{csparseso}
%define cxsparselib libcxsparse-%{cxsparseso}
%define klulib      libklu-%{kluso}
%define ldllib      libldl-%{ldlso}
%define rbiolib     librbio-%{rbioso}
%define spqrlib     libspqr-%{spqrso}
%define umfpacklib  libumfpack-%{umfpackso}

%description
suitesparse is a collection of libraries for computations involving sparse
matrices.

%package devel 
Summary:            Development headers for SuiteSparse
Group:              Development/Libraries/Parallel
Requires:           %{amdlib}      = %{amdver}
Requires:           %{btflib}      = %{btfver}
Requires:           %{camdlib}     = %{camdver}
Requires:           %{ccolamdlib}  = %{ccolamdver}
Requires:           %{cholmodlib}  = %{cholmodver}
Requires:           %{colamdlib}   = %{colamdver}
Requires:           %{csparselib}  = %{csparsever}
Requires:           %{cxsparselib} = %{cxsparsever}
Requires:           %{klulib}      = %{kluver}
Requires:           %{ldllib}      = %{ldlver}
Requires:           %{rbiolib}     = %{rbiover}
Requires:           %{spqrlib}     = %{spqrver}
Requires:           %{umfpacklib}  = %{umfpackver}
# make sure developers can find these packages
Provides:           suitesparse-common-devel = %{version}
Obsoletes:          suitesparse-common-devel < %{version}
Provides:           SuiteSparse_config       = %{version}
Obsoletes:          SuiteSparse_config       < %{version}
Provides:           amd-devel         = %{amdver}
Obsoletes:          amd-devel         < %{amdver}
Provides:           umfpack-devel     = %{umfpackver}
Obsoletes:          umfpack-devel     < %{umfpackver}
Provides:           libamd-devel      = %{amdver}
Obsoletes:          libamd-devel      < %{amdver}
Provides:           libbtf-devel      = %{btfver}
Obsoletes:          libbtf-devel      < %{btfver}
Provides:           libcamd-devel     = %{camdver}
Obsoletes:          libcamd-devel     < %{camdver}
Provides:           libccolamd-devel  = %{ccolamdver}
Obsoletes:          libccolamd-devel  < %{ccolamdver}
Provides:           libcholmod-devel  = %{cholmodver}
Obsoletes:          libcholmod-devel  < %{cholmodver}
Provides:           libcolamd-devel   = %{colamdver}
Obsoletes:          libcolamd-devel   < %{colamdver}
Provides:           libcsparse-devel  = %{csparsever}
Obsoletes:          libcsparse-devel  < %{csparsever}
Provides:           libcxsparse-devel = %{cxsparsever}
Obsoletes:          libcxsparse-devel < %{cxsparsever}
Provides:           libklu-devel      = %{kluver}
Obsoletes:          libklu-devel      < %{kluver}
Provides:           libldl-devel      = %{ldlver}
Obsoletes:          libldl-devel      < %{ldlver}
Provides:           librbio-devel     = %{rbiover}
Obsoletes:          librbio-devel     < %{rbiover}
Provides:           libspqr-devel     = %{spqrver}
Obsoletes:          libspqr-devel     < %{spqrver}
Provides:           libumfpack-devel  = %{umfpackver}
Obsoletes:          libumfpack-devel  < %{umfpackver}

%description devel
suitesparse is a collection of libraries for computations involving 
sparse matrices.

The suitesparse-devel package contains files needed for developing
applications which use the suitesparse libraries.

It also includes SuiteSparse_config, which is required by nearly all 
sparse matrix packages that I author or co-author. These include 
SuiteSparseQR, AMD, COLAMD, CCOLAMD, CHOLMOD, KLU, BTF, LDL, 
CXSparse, RBio, and UMFPACK. It is not required by CSparse, which is 
a stand-alone package. SuiteSparse_config (prior to version 4.0.0) 
was named UFconfig.

SuiteSparse_config contains a configuration file for "make" 
(SuiteSparse_config.mk) and an include file (SuiteSparse_config.h). 
Also included in SuiteSparse_config is a replacement for the 
BLAS/LAPACK xerbla routine that does not print a warning message 
(helpful if you don't want to link the entire Fortran I/O library 
into a C application).

%package devel-static
Summary:            Static version of SuiteSparse libraries
Group:              Development/Libraries/Parallel
Requires:           %{name}-devel = %{version}

%description devel-static
The suitesparse-static package contains the statically linkable
version of the suitesparse libraries.

%package -n %{amdlib}
Version:            %{amdver}
Summary:            Symmetric Approximate Minimum Degree
Group:              Development/Libraries/Parallel
License:            LGPL-2.1+

%description -n %{amdlib}
AMD is a set of routines for ordering a sparse matrix prior to 
Cholesky factorization (or for LU factorization with diagonal 
pivoting). There are versions in both C and Fortran. A MATLAB 
interface is provided.

Note that this software has nothing to do with AMD the company.

AMD is part of the SuiteSparse sparse matrix suite.

%package -n %{btflib}
Version:            %{btfver}
Summary:            Permutation to Block Triangular Form
Group:              Development/Libraries/Parallel
License:            LGPL-2.1+

%description -n %{btflib}
BTF permutes an unsymmetric matrix (square or rectangular) into its 
block upper triangular form (more precisely, it computes a Dulmage-
Mendelsohn decomposition).

BTF is part of the SuiteSparse sparse matrix suite.

%package -n %{camdlib}
Version:            %{camdver}
Summary:            Symmetric Approximate Minimum Degree
Group:              Development/Libraries/Parallel
License:            LGPL-2.1+

%description -n %{camdlib}
CAMD is a set of routines for ordering a sparse matrix prior to 
Cholesky factorization (or for LU factorization with diagonal 
pivoting). There are versions in both C and Fortran. A MATLAB 
interface is provided.

CAMD is part of the SuiteSparse sparse matrix suite.

%package -n %{ccolamdlib}
Version:            %{ccolamdver}
Summary:            Constrained Column Approximate Minimum Degree
Group:              Development/Libraries/Parallel
License:            LGPL-2.1+

%description -n %{ccolamdlib}
CCOLAMD computes an column approximate minimum degree ordering 
algorithm, (like COLAMD), but it can also be given a set of ordering
constraints. CCOLAMD is required by the CHOLMOD package.

CCOLAMD is part of the SuiteSparse sparse matrix suite.

%package -n %{cholmodlib}
Version:            %{cholmodver}
Summary:            Supernodal Sparse Cholesky Factorization and Update/Downdate
Group:              Development/Libraries/Parallel
License:            GPL-2.0+ and LGPL-2.1+

%description -n %{cholmodlib}
CHOLMOD is a set of ANSI C routines for sparse Cholesky factorization
and update/downdate. A MATLAB interface is provided.

The performance of CHOLMOD was compared with 10 other codes in a 
paper by Nick Gould, Yifan Hu, and Jennifer Scott. see also their raw
data. Comparing BCSLIB-EXT, CHOLMOD, MA57, MUMPS, Oblio, PARDISO, 
SPOOLES, SPRSBLKLLT, TAUCS, UMFPACK, and WSMP, on 87 large symmetric 
positive definite matrices, they found CHOLMOD to be fastest for 42 
of the 87 matrices. Its run time is either fastest or within 10% of 
the fastest for 73 out of 87 matrices. Considering just the larger 
matrices, it is either the fastest or within 10% of the fastest for 
40 out of 42 matrices. It uses the least amount of memory (or within 
10% of the least) for 35 of the 42 larger matrices. Jennifer Scott 
and Yifan Hu also discuss the design considerations for a sparse 
direct code. 

CHOLMOD is part of the SuiteSparse sparse matrix suite.

%package -n %{colamdlib}
Version:            %{colamdver}
Summary:            Column Approximate Minimum Degree
Group:              Development/Libraries/Parallel
License:            LGPL-2.1+

%description -n %{colamdlib}
The COLAMD column approximate minimum degree ordering algorithm
computes a permutation vector P such that the LU factorization of
A (:,P) tends to be sparser than that of A. The Cholesky
factorization of (A (:,P))'*(A (:,P)) will also tend to be sparser
than that of A'*A. SYMAMD is a symmetric minimum degree ordering 
method based on COLAMD, available as a MATLAB-callable function. It
constructs a matrix M such that M'*M has the same pattern as A, and
then uses COLAMD to compute a column ordering of M. Colamd and symamd
tend to be faster and generate better orderings than their MATLAB
counterparts, colmmd and symmmd. 

COLAMD is part of the SuiteSparse sparse matrix suite.

%package -n %{csparselib}
Version:            %{csparsever}
Summary:            Instructional Sparse Matrix Package
Group:              Development/Libraries/Parallel
License:            LGPL-2.1+

%description -n %{csparselib}
CSparse is a small yet feature-rich sparse matrix package written
specifically for a book. The purpose of the package is to demonstrate
a wide range of sparse matrix algorithms in as concise a code as
possible. CSparse is about 2,200 lines long (excluding its MATLAB
interface, demo codes, and test codes), yet it contains algorithms 
(either asympotical optimal or fast in practice) for all of the 
following functions described below. A MATLAB interface is included. 

Note that the LU and Cholesky factorization algorithms are not as
fast as UMFPACK or CHOLMOD. Other functions have comparable
performance as their MATLAB equivalents (some are faster). 

Documentation is very terse in the code; it is fully documented in
the book. Some indication of how to call the C functions in CSparse
is given by the CSparse/MATLAB/*.m help files. 

CSparse is part of the SuiteSparse sparse matrix suite.

%package -n %{cxsparselib}
Version:            %{cxsparsever}
Summary:            An extended version of CSparse
Group:              Development/Libraries/Parallel
License:            LGPL-2.1+

%description -n %{cxsparselib}
CXSparse is an extended version of CSparse, with support for double
or complex matrices, with int or long integers.

CXSparse is part of the SuiteSparse sparse matrix suite.

%package -n %{klulib}
Version:            %{kluver}
Summary:            Sparse LU Factorization, for Circuit Simulation
Group:              Development/Libraries/Parallel
License:            LGPL-2.1+

%description -n %{klulib}
KLU is a sparse LU factorization algorithm well-suited for use in
circuit simulation. It was highlighted in the May 2007 issue of SIAM
News, Sparse Matrix Algorithm Drives SPICE Performance Gains. It is
the "fast sparse-matrix solver" mentioned in the article.

KLU is part of the SuiteSparse sparse matrix suite.

%package -n %{ldllib}
Version:            %{ldlver}
Summary:            A Simple LDL^T Factorization
Group:              Development/Libraries/Parallel
License:            LGPL-2.1+

%description -n %{ldllib}
LDL is a set of concise routines for factorizing symmetric positive-
definite sparse matrices, with some applicability to symmetric 
indefinite matrices. Its primary purpose is to illustrate much of the
basic theory of sparse matrix algorithms in as concise a code as 
possible, including an elegant new method of sparse symmetric 
factorization that computes the factorization row-by-row but stores 
it column-by-column. The entire symbolic and numeric factorization 
consists of a total of only 49 lines of code. The package is written 
in C, and includes a MATLAB interface. 

LDL is part of the SuiteSparse sparse matrix suite.

%package -n %{rbiolib}
Version:            %{rbiover}
Summary:            MATLAB Toolbox for Reading/Writing Sparse Matrices
Group:              Development/Libraries/Parallel
License:            GPL-2.0+

%description -n %{rbiolib}
RBio is a MATLAB toolbox for reading/writing sparse matrices in the 
Rutherford/Boeing format, and for reading/writing problems in the UF 
Sparse Matrix Collection from/to a set of files in a directory. 
Version 2.0+ is written in C. 

RBio is part of the SuiteSparse sparse matrix suite.

%package -n %{spqrlib}
Version:            %{spqrver}
Summary:            Multifrontal Sparse QR
Group:              Development/Libraries/Parallel
License:            GPL-2.0+

%description -n %{spqrlib}
SuiteSparseQR is an implementation of the multifrontal sparse QR 
factorization method. Parallelism is exploited both in the BLAS and 
across different frontal matrices using Intel's Threading Building 
Blocks, a shared-memory programming model for modern multicore 
architectures. It can obtain a substantial fraction of the 
theoretical peak performance of a multicore computer. The package is 
written in C++ with user interfaces for MATLAB, C, and C++. 

SuiteSparseQR is part of the SuiteSparse sparse matrix suite.

%package -n %{umfpacklib}
Version:            %{umfpackver}
Summary:            Sparse Multifrontal LU Factorization
Group:              Development/Libraries/Parallel
License:            GPL-2.0+

%description -n %{umfpacklib}
UMFPACK is a set of routines for solving unsymmetric sparse linear 
systems, Ax=b, using the Unsymmetric MultiFrontal method. Written in 
ANSI/ISO C, with a MATLAB (Version 6.0 and later) interface. Appears 
as a built-in routine (for lu, backslash, and forward slash) in M
ATLAB. Includes a MATLAB interface, a C-callable interface, and a 
Fortran-callable interface. Note that "UMFPACK" is pronounced in two 
syllables, "Umph Pack". It is not "You Em Ef Pack". 

UMFPACK is part of the SuiteSparse sparse matrix suite.

%prep
%setup -q -n SuiteSparse
sed 's/^CHOLMOD_CONFIG =.*/CHOLMOD_CONFIG = -DNPARTITION/' -i SuiteSparse_config/SuiteSparse_config.mk
sed 's/^\(METIS =\).*//' -i SuiteSparse_config/SuiteSparse_config.mk

# bnc#751746
rm -rf MATLAB_Tools/Factorize/Doc/factorize_article.pdf
rm -rf SPQR/Doc/algo_spqr.pdf
rm -rf SPQR/Doc/spqr.pdf

%build
for dir in AMD BTF CAMD CCOLAMD CHOLMOD COLAMD CSparse CXSparse KLU LDL RBio SPQR UMFPACK; do
    pushd $dir
      ver=$(grep -E "^VERSION =" Makefile | sed "s:VERSION = ::")
      pushd Lib
        make CFLAGS="%{optflags} -fPIC"
        dir_l=$(echo "$dir" | tr "[A-Z]" "[a-z]")
        gcc -shared -Wl,-soname -Wl,"lib${dir_l}-$ver.so" -o "lib${dir_l}-$ver.so" *.o -lm
        ln -s "lib${dir_l}-$ver.so" "lib${dir_l}.so"
      popd
    popd
done
# specialities
# -- CHOLMOD
pushd CHOLMOD
  cp Cholesky/License.txt Doc/Cholesky_License.txt
  cp Core/License.txt Doc/Core_License.txt
  cp MatrixOps/License.txt Doc/MatrixOps_License.txt
  cp Partition/License.txt Doc/Partition_License.txt
  cp Supernodal/License.txt Doc/Supernodal_License.txt
popd

%install
mkdir -p %{buildroot}%{_includedir}/%{name}
mkdir -p %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_docdir}/%{name}
mkdir -p %{buildroot}%{_docdir}/%{name}-devel
cp -a SuiteSparse_config/SuiteSparse_config.h %{buildroot}%{_includedir}/%{name}
cp -a README.txt %{buildroot}%{_docdir}/%{name}
for dir in AMD BTF CAMD CCOLAMD CHOLMOD COLAMD CSparse CXSparse KLU LDL RBio SPQR UMFPACK; do
    pushd $dir
      ver=$(grep -E "^VERSION =" Makefile | sed "s:VERSION = ::")
      cp -a Lib/*.a Lib/*.so* %{buildroot}/%{_libdir}
      cp -a Include/*.h %{buildroot}%{_includedir}/%{name}
      mkdir %{buildroot}%{_docdir}/%{name}/$dir-$ver
      mkdir %{buildroot}%{_docdir}/%{name}-devel/$dir
      cp -a README.txt Doc/{License,ChangeLog,*.txt} %{buildroot}%{_docdir}/%{name}/$dir-$ver > /dev/null 2>&1 | true
      cp -a $dir/Doc/*.pdf %{buildroot}%{_docdir}/%{name}-devel/$dir > /dev/null 2>&1 | true
    popd
done

%post   -n %{amdlib} -p /sbin/ldconfig
%postun -n %{amdlib} -p /sbin/ldconfig

%post   -n %{btflib} -p /sbin/ldconfig
%postun -n %{btflib} -p /sbin/ldconfig

%post   -n %{camdlib} -p /sbin/ldconfig
%postun -n %{camdlib} -p /sbin/ldconfig

%post   -n %{ccolamdlib} -p /sbin/ldconfig
%postun -n %{ccolamdlib} -p /sbin/ldconfig

%post   -n %{cholmodlib} -p /sbin/ldconfig
%postun -n %{cholmodlib} -p /sbin/ldconfig

%post   -n %{colamdlib} -p /sbin/ldconfig
%postun -n %{colamdlib} -p /sbin/ldconfig

%post   -n %{csparselib} -p /sbin/ldconfig
%postun -n %{csparselib} -p /sbin/ldconfig

%post   -n %{cxsparselib} -p /sbin/ldconfig
%postun -n %{cxsparselib} -p /sbin/ldconfig

%post   -n %{klulib} -p /sbin/ldconfig
%postun -n %{klulib} -p /sbin/ldconfig

%post   -n %{ldllib} -p /sbin/ldconfig
%postun -n %{ldllib} -p /sbin/ldconfig

%post   -n %{rbiolib} -p /sbin/ldconfig
%postun -n %{rbiolib} -p /sbin/ldconfig

%post   -n %{spqrlib} -p /sbin/ldconfig
%postun -n %{spqrlib} -p /sbin/ldconfig

%post   -n %{umfpacklib} -p /sbin/ldconfig
%postun -n %{umfpacklib} -p /sbin/ldconfig

%files devel
%defattr(-,root,root)
%{_includedir}/%{name}
%{_libdir}/lib*.so
%exclude %{_libdir}/lib*-*.so
%{_docdir}/%{name}-devel
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/README.txt

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

%files -n %{amdlib}
%defattr(-, root, root)
%{_libdir}/libamd-%{amdver}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/AMD-%{amdver}

%files -n %{btflib}
%defattr(-, root, root)
%{_libdir}/libbtf-%{btfver}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/BTF-%{btfver}

%files -n %{camdlib}
%defattr(-, root, root)
%{_libdir}/libcamd-%{camdver}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/CAMD-%{camdver}

%files -n %{ccolamdlib}
%defattr(-, root, root)
%{_libdir}/libccolamd-%{ccolamdver}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/CCOLAMD-%{ccolamdver}

%files -n %{cholmodlib}
%defattr(-, root, root)
%{_libdir}/libcholmod-%{cholmodver}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/CHOLMOD-%{cholmodver}

%files -n %{colamdlib}
%defattr(-, root, root)
%{_libdir}/libcolamd-%{colamdver}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/COLAMD-%{colamdver}

%files -n %{csparselib}
%defattr(-, root, root)
%{_libdir}/libcsparse-%{csparsever}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/CSparse-%{csparsever}

%files -n %{cxsparselib}
%defattr(-, root, root)
%{_libdir}/libcxsparse-%{cxsparsever}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/CXSparse-%{cxsparsever}

%files -n %{klulib}
%defattr(-, root, root)
%{_libdir}/libklu-%{kluver}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/KLU-%{kluver}

%files -n %{ldllib}
%defattr(-, root, root)
%{_libdir}/libldl-%{ldlver}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/LDL-%{ldlver}

%files -n %{rbiolib}
%defattr(-, root, root)
%{_libdir}/librbio-%{rbiover}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/RBio-%{rbiover}

%files -n %{spqrlib}
%defattr(-, root, root)
%{_libdir}/libspqr-%{spqrver}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/SPQR-%{spqrver}

%files -n %{umfpacklib}
%defattr(-, root, root)
%{_libdir}/libumfpack-%{umfpackver}.so
%dir %{_docdir}/%{name}
%{_docdir}/%{name}/UMFPACK-%{umfpackver}

%changelog