mumps/mumps.spec
Egbert Eich d46eaf21c6 Accepting request 663856 from home:StefanBruens:branches:science
- Refactor spec for _multibuild, currently non-HPC flavors only.
- Setup MPI environment when building MPI flavors, fixes build on
  Tumbleweed, Leap 15.x, SLE 15.

OBS-URL: https://build.opensuse.org/request/show/663856
OBS-URL: https://build.opensuse.org/package/show/science/mumps?expand=0&rev=8
2019-01-14 16:47:01 +00:00

394 lines
12 KiB
RPMSpec

#
# spec file for package mumps
#
# 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/
#
%global flavor @BUILD_FLAVOR@
%define pname mumps
%if "%flavor" == ""
%define package_name %{pname}
ExclusiveArch: do_not_build
%endif
%if "%{flavor}" == "serial"
%define my_prefix %_prefix
%define my_bindir %_bindir
%define my_libdir %_libdir
%define my_incdir %_includedir
%define my_datadir %_datadir
# Stub MPI library
%define mumps_f77_mpilibs '-lmpiseq"
%endif
%if "%{flavor}" == "openmpi"
%define my_suffix -openmpi
%define mpi_family openmpi
%define mpiprefix %{_libdir}/mpi/gcc/%{mpi_family}
%define mumps_f77_mpilibs -lmpi_mpifh -lmpi
%endif
%if "%{flavor}" == "openmpi2"
%define my_suffix -openmpi2
%define mpi_family openmpi2
%define mpiprefix %{_libdir}/mpi/gcc/%{mpi_family}
%define mumps_f77_mpilibs -lmpi_mpifh -lmpi
%endif
%if "%{flavor}" == "mvapich2"
%define my_suffix -mvapich2
%define mpi_family mvapich2
%define mpiprefix %{_libdir}/mpi/gcc/%{mpi_family}
%define mumps_f77_mpilibs -lfmpich -lmpich
%endif
%{?mpi_family:%{bcond_without mpi}}%{!?mpi_family:%{bcond_with mpi}}
%if %{with mpi}
%define my_prefix %{mpiprefix}
%define my_bindir %{my_prefix}/bin
%define my_libdir %{my_prefix}/%{_lib}/
%define my_incdir %{my_prefix}/include/
%define my_datadir %{my_prefix}/share/
%endif
Summary: A MUltifrontal Massively Parallel Sparse direct Solver
License: SUSE-Public-Domain
Group: System/Libraries
Name: mumps%{?my_suffix}
Version: 4.9.2
Release: 0
Url: http://mumps.enseeiht.fr/
Source0: %{pname}-%{version}.tar.bz2
Source1: Makefile.ptscotch.inc
Source2: Makefile.scotch.inc
Source3: Makefile.seq.inc
Source4: Makefile.par.inc
Patch0: mumps-4.9.2-debian-shared-libseq.patch
Patch1: mumps-4.9.2-debian-shared-pord.patch
Patch2: mumps-4.9.2-debian-tests-shlibs.patch
Patch3: mumps-4.9.2-debian-shared-mumps.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: gcc-fortran
BuildRequires: libscotch-devel
%if %{with mpi}
Requires: %{pname} = %{version}
BuildRequires: %{pname}
BuildRequires: %{pname}-devel
BuildRequires: %{pname}-scotch
BuildRequires: %{pname}-scotch-devel
BuildRequires: libptscotch-%{mpi_family}-devel
BuildRequires: %{mpi_family}-devel
BuildRequires: scalapack-%{mpi_family}-devel
%endif
BuildRequires: blas-devel
BuildRequires: lapack-devel
%description
MUMPS implements a direct solver for large sparse linear systems, with a
particular focus on symmetric positive definite matrices. It can
operate on distributed matrices e.g. over a cluster. It has Fortran and
C interfaces, and can interface with ordering tools such as Scotch.
%if %{!with mpi}
This package contains the sequential library.
%else
This package contains the parallel library build with %{mpi_family}.
%endif
%package scotch
Summary: A MUltifrontal Massively Parallel Sparse direct Solver
Group: System/Libraries
Requires: mumps = %{version}
%description scotch
MUMPS implements a direct solver for large sparse linear systems, with a
particular focus on symmetric positive definite matrices. It can
operate on distributed matrices e.g. over a cluster. It has Fortran and
C interfaces, and can interface with ordering tools such as Scotch.
This package contains the sequential library with Scotch support enabled.
%package devel
Summary: Files needed for developing mumps based applications
Group: Development/Libraries/Other
Requires: blas-devel
Requires: lapack-devel
Requires: %{name} = %{version}
%if %{with mpi}
Requires: mumps-ptscotch-%{mpi_family} = %{version}
Requires: mumps-devel = %{version}
Requires: mumps-scotch-devel = %{version}
Requires: %{mpi_family}-devel
Requires: ptscotch-%{mpi_family}-devel
Requires: scalapack-%{mpi_family}-devel
%endif
%description devel
MUMPS implements a direct solver for large sparse linear systems, with a
particular focus on symmetric positive definite matrices. It can
operate on distributed matrices e.g. over a cluster. It has Fortran and
C interfaces, and can interface with ordering tools such as Scotch.
%package scotch-devel
Summary: Files needed for developing mumps based applications
Group: Development/Libraries/Other
Requires: blas-devel
Requires: lapack-devel
Requires: mumps = %{version}
Requires: mumps-devel = %{version}
Requires: mumps-scotch = %{version}
%description scotch-devel
MUMPS implements a direct solver for large sparse linear systems, with a
particular focus on symmetric positive definite matrices. It can
operate on distributed matrices e.g. over a cluster. It has Fortran and
C interfaces, and can interface with ordering tools such as Scotch.
%package -n %{pname}-ptscotch-%{mpi_family}
Summary: A MUltifrontal Massively Parallel Sparse direct Solver
Group: System/Libraries
Requires: mumps = %{version}
%description -n %{pname}-ptscotch-%{mpi_family}
MUMPS implements a direct solver for large sparse linear systems, with a
particular focus on symmetric positive definite matrices. It can
operate on distributed matrices e.g. over a cluster. It has Fortran and
C interfaces, and can interface with ordering tools such as Scotch.
This package contains the parallel library build with %{mpi_family} and with
PTScotch enabled.
%package -n %{pname}-test-%{mpi_family}
Summary: Simple test programs and examples for mumps
Group: System/Libraries
%description -n %{pname}-test-%{mpi_family}
MUMPS implements a direct solver for large sparse linear systems, with a
particular focus on symmetric positive definite matrices. It can
operate on distributed matrices e.g. over a cluster. It has Fortran and
C interfaces, and can interface with ordering tools such as Scotch.
This packages contains some test and examples programs for mumps. In addition,
matlab and scilab extensions are provided in /usr/share/doc/packages/mumps.
%prep
%setup -q -n %{pname}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%build
export SUSE_ASNEEDED=0
%if !%{with mpi}
# sequential with scotch support enabled
cp -f %{S:2} Makefile.inc
make \
MUMPS_LIBF77="-lmpiseq_scotch" \
OPTC="$RPM_OPT_FLAGS" \
PLAT="_scotch" all
cp -a lib libmumps_scotch_seq
cp -af libseq/lib* libmumps_scotch_seq
cp -af PORD/lib/libpord_scotch.so* libmumps_scotch_seq
make clean
rm -f Makefile.inc
# sequential without scotch
cp -f %{S:3} Makefile.inc
make \
MUMPS_LIBF77="-lmpiseq_seq" \
OPTC="$RPM_OPT_FLAGS" \
PLAT="_seq" all
cp -a lib libmumps_seq
cp -af libseq/lib* libmumps_seq
cp -af PORD/lib/libpord_seq.so* libmumps_seq
make clean
rm -f Makefile.inc
%endif
%if %{with mpi}
# Set LD_LIBRARY_PATH and PATH
. %{my_bindir}/mpivars.sh
# ptscotch : parallel with scotch support enabled
cp -f %{S:1} Makefile.inc
make \
MUMPS_MPI=%{mpi_family} \
FC=%{my_bindir}/mpif77 \
MUMPS_LIBF77="-L%{my_libdir} %{?mumps_f77_mpilibs}" \
OPTC="$RPM_OPT_FLAGS" \
INCPAR=-I%{my_incdir}/ \
PLAT="_ptscotch" all
cp -a lib libmumps_ptscotch_%{mpi_family}
cp -af PORD/lib/libpord_ptscotch.so* libmumps_ptscotch_%{mpi_family}/
make clean
rm -f Makefile.inc
# parallel without scotch
cp %{S:4} Makefile.inc
make \
MUMPS_MPI=%{mpi_family} \
FC=%{my_bindir}/mpif77 \
MUMPS_LIBF77="-L%{my_libdir} %{?mumps_f77_mpilibs}" \
OPTC="$RPM_OPT_FLAGS" \
PLAT="" all
# build test programs
make -C examples all
cp -a lib lib_%{mpi_family}
cp -af PORD/lib/libpord.so* lib_%{mpi_family}
cp -a examples examples_%{mpi_family}
make clean
rm -f Makefile.inc
%endif
%install
mkdir -p %{buildroot}%{my_bindir}
mkdir -p %{buildroot}%{my_libdir}
cp -P PORD/lib/*.so* %{buildroot}%{my_libdir}
%if "%{flavor}" == "serial"
mkdir -p %{buildroot}%{_includedir}/mumps
mkdir -p %{buildroot}%{_includedir}/pord
install -m 644 include/* %{buildroot}%{_includedir}/mumps
install -m 644 libseq/*.h %{buildroot}%{_includedir}/mumps
install -m 644 PORD/include/* %{buildroot}%{_includedir}/pord
%endif
%if !%{with mpi}
# install sequential libs
cp -P libmumps_seq/lib*.a %{buildroot}%{my_libdir}
cp -P libmumps_seq/lib*.so* %{buildroot}%{my_libdir}
cp -P libmumps_scotch_seq/*.a %{buildroot}%{my_libdir}
cp -P libmumps_scotch_seq/*.so* %{buildroot}%{my_libdir}
%endif
%if %{with mpi}
# install parallel libs
cp -P lib_%{mpi_family}/lib*.a %{buildroot}%{my_libdir}
cp -P lib_%{mpi_family}/lib*.so* %{buildroot}%{my_libdir}
cp -P libmumps_ptscotch_%{mpi_family}/*.a %{buildroot}%{my_libdir}
cp -P libmumps_ptscotch_%{mpi_family}/*.so* %{buildroot}%{my_libdir}
install -m 755 examples_%{mpi_family}/*simpletest %{buildroot}%{my_bindir}
install -m 755 examples_%{mpi_family}/c_example %{buildroot}%{my_bindir}
%endif
# Don't want binaries in docdir
rm -rf examples/*.o examples/*simpletest examples/c_example
# we make a symlink to the serial lib in the parallel lib prefix
# because some scientific packages don't manage different directories
# for the serial and parallel libs
%if %{with mpi}
for lib in libcmumps libdmumps libsmumps libzmumps libmumps_common libmpiseq libpord ; do
for plat in _seq _scotch ; do
for type in .a .so .so.%{version}; do
name=${lib}${plat}${type}
ln -s %{_libdir}/$name %{buildroot}%{my_libdir}/$name
done
done
done
%endif
%clean
rm -rf %{buildroot}
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
%if !%{with mpi}
%post scotch -p /sbin/ldconfig
%postun scotch -p /sbin/ldconfig
%else
%post -n %{pname}-ptscotch-%{mpi_family} -p /sbin/ldconfig
%postun -n %{pname}-ptscotch-%{mpi_family} -p /sbin/ldconfig
%endif
%if !%{with mpi}
%files
%license LICENSE
%doc ChangeLog README VERSION doc SCILAB MATLAB
%{_libdir}/libcmumps_seq.so.*
%{_libdir}/libdmumps_seq.so.*
%{_libdir}/libsmumps_seq.so.*
%{_libdir}/libzmumps_seq.so.*
%{_libdir}/libmumps_common_seq.so.*
%{_libdir}/libmpiseq_seq.so.*
%{_libdir}/libpord_seq.so.*
%files scotch
%{_libdir}/libcmumps_scotch.so.*
%{_libdir}/libdmumps_scotch.so.*
%{_libdir}/libsmumps_scotch.so.*
%{_libdir}/libzmumps_scotch.so.*
%{_libdir}/libmumps_common_scotch.so.*
%{_libdir}/libmpiseq_scotch.so.*
%{_libdir}/libpord_scotch.so.*
%files devel
%{_includedir}/mumps
%{_includedir}/pord
%{_libdir}/*_seq.so
%{_libdir}/*_seq.a
%files scotch-devel
%{_libdir}/*_scotch.so
%{_libdir}/*_scotch.a
%endif
%if %{with mpi}
%files -n %{pname}-%{mpi_family}
%{my_libdir}/libcmumps.so.*
%{my_libdir}/libdmumps.so.*
%{my_libdir}/libsmumps.so.*
%{my_libdir}/libzmumps.so.*
%{my_libdir}/libmumps_common.so.*
%{my_libdir}/libpord.so.*
# compat symlinks
%{my_libdir}/lib*_seq.so.*
%{my_libdir}/lib*_scotch.so.*
%files -n %{pname}-ptscotch-%{mpi_family}
%{my_libdir}/libcmumps_ptscotch.so.*
%{my_libdir}/libdmumps_ptscotch.so.*
%{my_libdir}/libsmumps_ptscotch.so.*
%{my_libdir}/libzmumps_ptscotch.so.*
%{my_libdir}/libmumps_common_ptscotch.so.*
%{my_libdir}/libpord_ptscotch.so.*
%files -n %{pname}-%{mpi_family}-devel
%{my_libdir}/*.so
%{my_libdir}/*.a
%files -n %{pname}-test-%{mpi_family}
%doc examples
%{my_bindir}/*
%endif
%changelog