Пакет hypre: Specfile

%define mpiimpl openmpi
%define mpidir %_libexecdir/%mpiimpl

%define somver 0
%define sover %somver.2.4
Name: hypre
Version: 2.4.0b
Release: alt7
Summary: Scalable algorithms for solving linear systems of equations
License: LGPL v2.1
Group: Sciences/Mathematics
Url: http://www.llnl.gov/casc/hypre/
Packager: Eugeny A. Rostovtsev (REAL) <real at altlinux.org>

Source: %name-%version.tar.gz
Source1: babel_files

Requires: lib%name-devel = %version-%release

BuildRequires(pre): rpm-build-compat rpm-build-python rpm-build-java /proc
BuildPreReq: gcc-fortran gcc-c++ %mpiimpl-devel /usr/bin/emacs
BuildPreReq: libatlas-devel liblapack-devel w3c-libwww-devel
BuildPreReq: babel >= 1.4.0-alt2.1
BuildPreReq: java-devel-default libchasm-devel chasm python-devel
BuildPreReq: python-module-numpy libxml2-devel python-module-libxml2
BuildPreReq: libltdl7-devel libgomp-devel

%description
The goal of the Scalable Linear Solvers project is to develop scalable
algorithms and software for solving large, sparse linear systems of equations on
parallel computers. The primary software product is Hypre, a library of high
performance preconditioners that features parallel multigrid methods for both
structured and unstructured grid problems. The problems of interest arise in the
simulation codes being developed at LLNL and elsewhere to study physical
phenomena in the defense, environmental, energy, and biological sciences.

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

%description -n lib%name
The goal of the Scalable Linear Solvers project is to develop scalable
algorithms and software for solving large, sparse linear systems of equations on
parallel computers. The primary software product is Hypre, a library of high
performance preconditioners that features parallel multigrid methods for both
structured and unstructured grid problems. The problems of interest arise in the
simulation codes being developed at LLNL and elsewhere to study physical
phenomena in the defense, environmental, energy, and biological sciences.

This package contains shared libraries of Hypre.

%package -n lib%name-devel
Summary: Development files of Hypre
Group: Development/Other
Requires: libbabel-devel libltdl7-devel libsuperlu-devel
Requires: lib%name = %version-%release
Conflicts: lib%name-devel < %version-%release
Obsoletes: lib%name-devel < %version-%release

%description -n lib%name-devel
The goal of the Scalable Linear Solvers project is to develop scalable
algorithms and software for solving large, sparse linear systems of equations on
parallel computers. The primary software product is Hypre, a library of high
performance preconditioners that features parallel multigrid methods for both
structured and unstructured grid problems. The problems of interest arise in the
simulation codes being developed at LLNL and elsewhere to study physical
phenomena in the defense, environmental, energy, and biological sciences.

This package contains development files of Hypre.

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

%description -n lib%name-devel-static
The goal of the Scalable Linear Solvers project is to develop scalable
algorithms and software for solving large, sparse linear systems of equations on
parallel computers. The primary software product is Hypre, a library of high
performance preconditioners that features parallel multigrid methods for both
structured and unstructured grid problems. The problems of interest arise in the
simulation codes being developed at LLNL and elsewhere to study physical
phenomena in the defense, environmental, energy, and biological sciences.

This package contains static libraries of Hypre.

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

%description -n lib%name-devel-doc
The goal of the Scalable Linear Solvers project is to develop scalable
algorithms and software for solving large, sparse linear systems of equations on
parallel computers. The primary software product is Hypre, a library of high
performance preconditioners that features parallel multigrid methods for both
structured and unstructured grid problems. The problems of interest arise in the
simulation codes being developed at LLNL and elsewhere to study physical
phenomena in the defense, environmental, energy, and biological sciences.

This package contains development documentation for Hepre.

%prep
%setup

%build
mpi-selector --set %mpiimpl
source /etc/profile.d/mpi-selector.sh
source %mpidir/bin/mpivars.sh
export includedir=%_includedir
export JNI_INCLUDES="%_libexecdir/jvm/java/include"
export MPIDIR=%mpidir
cd src

%add_optflags %optflags_shared
%configure \
	--without-examples \
	--with-MPI \
	--with-MPI-include=%mpidir/include \
	--with-MPI-libs="mpi_f90 mpi_f77 mpi mpi_cxx" \
	--with-MPI-lib-dirs="%mpidir/lib" \
	--with-timing \
	--with-openmp \
	--with-babel \
	--with-chasm=%prefix \
	--with-blas \
	--with-lapack \
	--with-mli \
	--with-fei \
	--with-superlu \
	CC=mpicc CXX=mpicxx F77=mpif77
sed -i 's|^\(HYPRE_INSTALL_DIR\).*|\1 = %buildroot%prefix|' \
	config/Makefile.config
sed -i 's|^\(HYPRE_LIB_INSTALL\).*|\1 = %buildroot%_libdir|' \
	config/Makefile.config
sed -i 's|^\(HYPRE_INC_INSTALL\).*|\1 = %buildroot%_includedir/%name|' \
	config/Makefile.config
mkdir -p hypre/lib
pushd FEI_mv/femli
%make_build all CC=mpicc CXX=mpicxx F77=mpif77
popd
%make_build all

%install
source %mpidir/bin/mpivars.sh
pushd src

%makeinstall_std
install -m644 hypre/lib/* %buildroot%_libdir

install -d %buildroot%_docdir/lib%name-devel-doc
rm -f ../src/docs/Makefile
cp -fR ../src/docs/* %buildroot%_docdir/lib%name-devel-doc/
rm -f %buildroot%_libdir/libsidl*
popd

# shared libraries

pushd %buildroot%_libdir
LIBS="$(ls *.a|sed 's|\.a||'|sort)"
mkdir tmp
pushd tmp
for i in $LIBS; do
	if [ "$i" != "libbHYPREClient-F" -a "$i" != "libbHYPREClient-CX" ]
	then
		ar x ../$i.a
		mpic++ -shared * -L.. $ADDLIB \
			-lsidl -llapack -llapack_atlas -lblas -lgomp \
			-Wl,-R%mpidir/lib \
			-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 *
		ADDLIB="-lHYPRE"
	fi
done
popd
rmdir tmp
popd

%files
%doc CHANGELOG COPYING.LESSER COPYRIGHT

%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/lib%name-devel-doc

%changelog
* Tue Sep 1 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 2.4.0b-alt7
- Added shared libraries

* Sun Jul 26 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 2.4.0b-alt6
- Fixed MPI check

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

* Tue May 26 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 2.4.0b-alt4
- Rebuild with OpenMPI

* Wed Apr 22 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 2.4.0b-alt3
- Move headers into hypre subdirectory

* Tue Apr 21 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 2.4.0b-alt2
- Remove files owned by other packages

* Sat Apr 18 2009 Eugeny A. Rostovtsev (REAL) <real at altlinux.org> 2.4.0b-alt1
- Initial build for Sisyphus