File hips.spec of Package hips

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


%if 0%{?sles_version}
%define _mvapich2 1
%endif
%if 0%{?suse_version}
%define _openmpi 1
%endif

%define _mpi %{?_openmpi:openmpi} %{?_mvapich2:mvapich2}

Name:           hips
Version:        1.2
Release:        0
Summary:        Hierarchical Iterative Parallel Solver
License:        CeCILL-C
Group:          Development/Libraries/Parallel
Url:            http://hips.gforge.inria.fr/
Source0:        %{name}-%{version}b-rc5.tar.gz
Source1:        makefile.inc.gnu
Patch0:         hips-1.2b-rc4.patch
Patch1:         hips-1.2-rc5-no-return-in-non-void.patch
BuildRequires:  blas-devel
BuildRequires:  gcc-fortran
%if 0%{?_openmpi}
BuildRequires:  openmpi-devel
%endif
%if 0%{?_mvapich2}
BuildRequires:  mvapich2-devel
%endif
BuildRequires:  scotch-devel
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.

%if 0%{?_openmpi}
%package -n libhips0-openmpi
Summary:        A library for nonlinear optimization
Group:          System/Libraries

%description -n libhips0-openmpi
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.

%package -n libio0-openmpi
Summary:        A library for nonlinear optimization
Group:          System/Libraries

%description -n libio0-openmpi
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.

%package -n libspkit0-openmpi
Summary:        A library for nonlinear optimization
Group:          System/Libraries

%description -n libspkit0-openmpi
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.

%package openmpi-devel
Summary:        A library for nonlinear optimization
Group:          Development/Libraries/Parallel
Requires:       libhips0-openmpi = %{version}
Requires:       libio0-openmpi = %{version}
Requires:       libspkit0-openmpi = %{version}
Requires:       openmpi-devel

%description openmpi-devel
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.

%package test-openmpi
Summary:        Tests programms for %nane
Group:          Development/Libraries/Parallel

%description test-openmpi
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.
%endif

%if 0%{?_mvapich2}
%package -n libhips0-mvapich2
Summary:        A library for nonlinear optimization
Group:          System/Libraries

%description -n libhips0-mvapich2
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.

%package -n libio0-mvapich2
Summary:        A library for nonlinear optimization
Group:          System/Libraries

%description -n libio0-mvapich2
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.

%package -n libspkit0-mvapich2
Summary:        A library for nonlinear optimization
Group:          System/Libraries

%description -n libspkit0-mvapich2
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.

%package mvapich2-devel
Summary:        A library for nonlinear optimization
Group:          Development/Libraries/Parallel
Requires:       libhips0-mvapich2 = %{version}
Requires:       libio0-mvapich2 = %{version}
Requires:       libspkit0-mvapich2 = %{version}
Requires:       mvapich2-devel

%description mvapich2-devel
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.

%package test-mvapich2
Summary:        Tests programms for %nane
Group:          Development/Libraries/Parallel

%description test-mvapich2
HIPS (Hierarchical Iterative Parallel Solver) is a scientific library
that provides an efficient parallel iterative solver for very large
sparse linear systems.
%endif

%prep
%setup -q -n %{name}
%patch0 -p1
%patch1 -p1
cp %{S:1} makefile.inc

set -- *
for mpi in %_mpi; do
 mkdir $mpi
 cp -ap "$@" $mpi
done

%build
for mpi in %_mpi; do
cd $mpi
make %{?_smp_mflags} all \
     MPICC=%{_libdir}/mpi/gcc/$mpi/bin/mpicc \
     MPIFC=%{_libdir}/mpi/gcc/$mpi/bin/mpif90

mkdir shared_mpi
for i in libhips libio libspkit; do
cd shared_mpi
ar -x ../LIB/$i.a
%{_libdir}/mpi/gcc/$mpi/bin/mpif90 \
      -shared -z muldefs -Wl,-soname=$i.so.0 -o ../$i.so.0.0  *.o
rm *.o
cd ..
done
cd ..
done

%install
for mpi in %_mpi; do
cd $mpi
mkdir -p %{buildroot}%{_libdir}/mpi/gcc/$mpi/%_lib
mkdir -p %{buildroot}%{_libdir}/mpi/gcc/$mpi/bin
mkdir -p %{buildroot}%{_libdir}/mpi/gcc/$mpi/include

for i in libhips libio libspkit; do
install -m755 $i.so.0.0 %{buildroot}%{_libdir}/mpi/gcc/$mpi/%_lib
ln -s %{_libdir}/mpi/gcc/$mpi/%_lib/$i.so.0.0 \
      %{buildroot}%{_libdir}/mpi/gcc/$mpi/%_lib/$i.so.0
ln -s %{_libdir}/mpi/gcc/$mpi/%_lib/$i.so.0.0 \
      %{buildroot}%{_libdir}/mpi/gcc/$mpi/%_lib/$i.so
done
install -m644 SRC/INCLUDE/*.h %{buildroot}%{_libdir}/mpi/gcc/$mpi/include
install -m644 LIB/*.h %{buildroot}%{_libdir}/mpi/gcc/$mpi/include
install -m755 TESTS/PARALLEL/test*.ex %{buildroot}%{_libdir}/mpi/gcc/$mpi/bin/
cd ..
done

# for doc
rm -f TESTS/PARALLEL/{*.c,*.F90,makefile*}
chmod 644 TESTS/PARALLEL/Inputs*
chmod 644 TESTS/MATRICES/*.*

%if 0%{?_openmpi}
%post -n libhips0-openmpi -p /sbin/ldconfig
%postun -n libhips0-openmpi -p /sbin/ldconfig

%post -n libio0-openmpi -p /sbin/ldconfig
%postun -n libio0-openmpi -p /sbin/ldconfig

%post -n libspkit0-openmpi -p /sbin/ldconfig
%postun -n libspkit0-openmpi -p /sbin/ldconfig
%endif

%if 0%{?_mvapich2}
%post -n libhips0-mvapich2 -p /sbin/ldconfig
%postun -n libhips0-mvapich2 -p /sbin/ldconfig

%post -n libio0-mvapich2 -p /sbin/ldconfig
%postun -n libio0-mvapich2 -p /sbin/ldconfig

%post -n libspkit0-mvapich2 -p /sbin/ldconfig
%postun -n libspkit0-mvapich2 -p /sbin/ldconfig
%endif

%if 0%{?_openmpi}
%files -n libhips0-openmpi
%defattr(-,root,root,-)
%{_libdir}/mpi/gcc/openmpi/%_lib/libhips.so.*

%files -n libio0-openmpi
%defattr(-,root,root,-)
%{_libdir}/mpi/gcc/openmpi/%_lib/libio.so.*

%files -n libspkit0-openmpi
%defattr(-,root,root,-)
%{_libdir}/mpi/gcc/openmpi/%_lib/libspkit.so.*

%files openmpi-devel
%defattr(-,root,root,-)
%{_libdir}/mpi/gcc/openmpi/%_lib/*.so
%{_libdir}/mpi/gcc/openmpi/include/*

%files test-openmpi
%defattr(-,root,root,-)
%doc TESTS/MATRICES TESTS/PARALLEL
%{_libdir}/mpi/gcc/openmpi/bin/test*
%endif

%if 0%{?_mvapich2} 
%files -n libhips0-mvapich2
%defattr(-,root,root,-)
%{_libdir}/mpi/gcc/mvapich2/%_lib/libhips.so.*

%files -n libio0-mvapich2
%defattr(-,root,root,-)
%{_libdir}/mpi/gcc/mvapich2/%_lib/libio.so.*

%files -n libspkit0-mvapich2
%defattr(-,root,root,-)
%{_libdir}/mpi/gcc/mvapich2/%_lib/libspkit.so.*

%files mvapich2-devel
%defattr(-,root,root,-)
%{_libdir}/mpi/gcc/mvapich2/%_lib/*.so
%{_libdir}/mpi/gcc/mvapich2/include/*

%files test-mvapich2
%defattr(-,root,root,-)
%doc TESTS/MATRICES TESTS/PARALLEL
%{_libdir}/mpi/gcc/mvapich2/bin/test*
%endif

%changelog
openSUSE Build Service is sponsored by