Пакет superlu: Specfile

%define somver 3
%define sover %somver.1.0
Name: superlu
Version: 3.1
Release: alt7
Summary: A set of subroutines to solve a sparse linear system A*X=B
License: BSD-like
Group: Sciences/Mathematics
Url: http://acts.nersc.gov/superlu/
Packager: Eugeny A. Rostovtsev (REAL) <real at altlinux.org>

Source: http://crd.lbl.gov/~xiaoye/SuperLU/superlu_3.1.tar.gz
Source1: http://www.netlib.org/clapack/what/testing/matgen/clatm1.c
Source2: http://www.netlib.org/clapack/what/testing/matgen/zlatm1.c
Source3: http://www.netlib.org/clapack/CLAPACK-3.1.1/TESTING/MATGEN/blaswrap.h

Requires: lib%name = %version-%release

BuildPreReq: gcc-fortran gcc-c++ libatlas-devel liblapack-devel
BuildPreReq: csh doxygen graphviz tetex-latex ghostscript-utils
BuildPreReq: tetex-latex-listings tetex-latex-unicode

%description
SuperLU contains a set of subroutines to solve a sparse linear system 
A*X=B. It uses Gaussian elimination with partial pivoting (GEPP). 
The columns of A may be preordered before factorization; the 
preordering for sparsity is completely separate from the factorization.
SuperLU provides functionality for both real and complex matrices, in both
single and double precision.

%package -n lib%name
Summary: Shared libraries of SuperLU
Group: System/Libraries

%description -n lib%name
SuperLU contains a set of subroutines to solve a sparse linear system 
A*X=B. It uses Gaussian elimination with partial pivoting (GEPP). 
The columns of A may be preordered before factorization; the 
preordering for sparsity is completely separate from the factorization.
SuperLU provides functionality for both real and complex matrices, in both
single and double precision.

This package contains shared libraries of SuperLU.

%package -n lib%name-devel
Summary: Development files of SuperLU
Group: Development/C
Requires: lib%name = %version-%release
Conflicts: lib%name-devel < %version-%release
Obsoletes: lib%name-devel < %version-%release

%description -n lib%name-devel
SuperLU contains a set of subroutines to solve a sparse linear system 
A*X=B. It uses Gaussian elimination with partial pivoting (GEPP). 
The columns of A may be preordered before factorization; the 
preordering for sparsity is completely separate from the factorization.
SuperLU provides functionality for both real and complex matrices, in both
single and double precision.

This package contains development files of SuperLU.

%package -n lib%name-devel-static
Summary: Static libraries of SuperLU
Group: Development/C
Requires: lib%name-devel = %version-%release
Conflicts: lib%name-devel < %version-%release

%description -n lib%name-devel-static
SuperLU contains a set of subroutines to solve a sparse linear system 
A*X=B. It uses Gaussian elimination with partial pivoting (GEPP). 
The columns of A may be preordered before factorization; the 
preordering for sparsity is completely separate from the factorization.
SuperLU provides functionality for both real and complex matrices, in both
single and double precision.

This package contains static libraries of SuperLU.

%package -n lib%name-devel-doc
Summary: Documentation for SuperLU
Group: Development/Documentation
BuildArch: noarch

%description -n lib%name-devel-doc
SuperLU contains a set of subroutines to solve a sparse linear system 
A*X=B. It uses Gaussian elimination with partial pivoting (GEPP). 
The columns of A may be preordered before factorization; the 
preordering for sparsity is completely separate from the factorization.
SuperLU provides functionality for both real and complex matrices, in both
single and double precision.

This package contains documentation for SuperLU.

%prep
%setup
install -m644 %SOURCE1 %SOURCE2 %SOURCE3 TESTING/MATGEN

%build
sed -i "s|(HOME)|$PWD|" make.inc
sed -i "s|(LIBDIR)|%_libdir|" make.inc
%make install
%make lib doc
%make testing

pushd EXAMPLE
%make_build
popd

pushd DOC/latex
%make_build
popd

pushd TESTING
%make_build
popd

%install
install -d %buildroot%_bindir
install -d %buildroot%_datadir/%name/examples
install -d %buildroot%_libdir
install -d %buildroot%_includedir
install -d %buildroot%_docdir/%name/html
install -d %buildroot%_docdir/%name/pdf
install -m644 SRC/*.h %buildroot%_includedir
install -m644 *.a %buildroot%_libdir
mv DOC/ug.pdf DOC/latex/refman.pdf %buildroot%_docdir/%name/
install -m644 DOC/latex/*.pdf %buildroot%_docdir/%name/pdf
install -m644 DOC/html/* %buildroot%_docdir/%name/html

install -m755 TESTING/?test TESTING/?test.csh %buildroot%_bindir
pushd EXAMPLE
rm -f *.o Makefile
chmod -x cg20.cua
mv README cg20.cua cmat g10 *.c %buildroot%_datadir/%name/examples/
install -m755 * %buildroot%_bindir
popd

pushd %buildroot%_bindir
for i in $(ls); do
	mv $i %name.$i
done
popd

# shared libraries

pushd %buildroot%_libdir
for i in libsuperlu_%version libtmglib; do
	if [ "$i" = "libtmglib" ]; then
		ADDLIB="-L. -lsuperlu_%version"
	fi
	ar x $i.a
	g++ -shared *.o $ADDLIB -llapack -lblas -lm \
		-Wl,-soname,$i.so.%somver -o $i.so.%sover
	ln -s $i.so.%sover $i.so.%somver
	ln -s $i.so.%somver $i.so
	rm -f *.o
done
popd

%files
%doc README
%_bindir/*
%_datadir/%name

%files -n lib%name
%_libdir/*.so.*

%files -n lib%name-devel
%_libdir/*.so
%_includedir/*

%files -n lib%name-devel-static
%_libdir/*.a

%files -n lib%name-devel-doc
%_docdir/%name

%changelog
* Sat Aug 29 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 3.1-alt7
- Added shared libraries and additional documentation

* Thu Jun 25 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 3.1-alt6
- Resolved conflicts with ctest and dapl*-utils

* Sun Jun 21 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 3.1-alt5
- Rebuild with PIC

* Fri Jun 12 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 3.1-alt4
- Added examples

* Tue May 26 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 3.1-alt3
- Resolve conflict with superlu_dist

* Tue May 19 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 3.1-alt2
- Added explicit conflict with superlu_dist

* Fri Apr 17 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 3.1-alt1
- Initial build for Sisyphus