File openmpi-compat.spec of Package openmpi-compat

#
# spec file for package openmpi
#
# Copyright (c) 2015 SUSE LINUX 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/
#

%define with_openib 1

Name:           openmpi-compat
Version:        1.8.1
Release:        0
Summary:        OpenMPI runtime libraries
License:        BSD-3-Clause
Group:          Development/Libraries/Parallel
Url:            http://www.open-mpi.org/
Source0:        http://www.open-mpi.org/software/ompi/v1.8/downloads/openmpi-%{version}.tar.bz2
Source3:        baselibs.conf
Source4:        openmpi-compat-rpmlintrc
Patch1:         openmpi-no_date_and_time.patch
Patch2:         openmpi-no_network_in_build.patch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  Modules
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  libtool
%if %{with_openib}
BuildRequires:  libibumad-devel
BuildRequires:  libibverbs-devel
%endif
%ifarch x86_64
BuildRequires:  numactl
%endif
%ifarch %{ix86} x86_64
BuildRequires:  infinipath-psm-devel
%endif

%define mpi_prefix %{_libdir}/mpi/gcc/openmpi

%define mpi_bindir %{mpi_prefix}/bin
%define mpi_libdir %{mpi_prefix}/%{_lib}
%define mpi_datadir %{mpi_prefix}/share
%define mpi_includedir %{mpi_prefix}/include
%define mpi_mandir %{mpi_prefix}/share/man

%description
Open MPI is a project combining technologies and resources from several
other projects (FT-MPI, LA-MPI, LAM/MPI, and PACX-MPI) in order to
build the best MPI library available.

This package contains only the OpenMPI runtime libraries.

%prep
%setup -q -n openmpi-%{version}
%patch1
%patch2

%build
./autogen.sh
%configure --prefix="%{mpi_prefix}" \
           --exec-prefix="%{mpi_prefix}" \
           --bindir="%{mpi_bindir}" \
           --datadir="%{mpi_datadir}" \
           --includedir="%{mpi_includedir}" \
           --libdir="%{mpi_libdir}" \
           --mandir="%{mpi_mandir}" \
           --disable-static  \
           --enable-builtin-atomics \
%if %{with_openib}
	   --with-verbs \
%endif
%ifarch %{ix86} x86_64
	   --with-psm \
%endif
           --with-devel-headers
make %{?_smp_mflags} V=1

%install

make install DESTDIR="%buildroot"

pushd %{buildroot}%{mpi_libdir}
rm libopen-trace-format.la
rm libotfaux.la

for f in libvt\*.la; do
    sed -i 's%%-L.*.libs %%%%g' $f
done
# Remove all libs that have the same major version as those in openmpi-libs
# and thus would clash
rm -f libmca_common_sm.so.4* libmpi_cxx.so.1* libompitrace.so.0* libopen-trace-format.so.1* \
   libotfaux.so.0* libvt-hyb.so.0* libvt-mpi-unify.so.0* libvt-mpi.so.0* libvt-mt.so.0* \
   libvt.so.0*

mkdir tmp
mv openmpi/{mca_osc_rdma.so,mca_rmaps_lama.so} tmp/
rm -rf openmpi/*
mv tmp/*.so openmpi/
rm -r tmp
popd

mkdir -p %{buildroot}%{_datadir}/modules/gnu-openmpi/%{version}
%fdupes %{buildroot}%{mpi_mandir} %{buildroot}%{mpi_datadir}

cat << EOF > %{buildroot}%{_datadir}/modules/gnu-openmpi/%{version}/.version
#%%Module
proc ModulesHelp { } {
        global dotversion
        puts stderr "\tLoads the gnu - openmpi %{version}  Environment"
}

module-whatis  "Loads the gnu openmpi %{version} Environment."
conflict gnu-openmpi
prepend-path PATH %{mpi_bindir}
prepend-path INCLUDE %{mpi_includedir}
prepend-path INCLUDE %{mpi_libdir}/lib64
prepend-path MANPATH %{mpi_mandir}
prepend-path LD_LIBRARY_PATH %{mpi_libdir}

EOF

mkdir -p %{buildroot}%{mpi_prefix}/share/%{version}/modules/gnu-openmpi
cat << EOF > %{buildroot}%{mpi_prefix}/share/%{version}/modules/gnu-openmpi/.version
#%%Module1.0
set ModulesVersion "%{version}"

EOF

rm -rf %{buildroot}/etc %{buildroot}%{mpi_bindir} %{buildroot}%{mpi_datadir} %{buildroot}%{mpi_includedir} %{buildroot}%{mpi_mandir}
rm -rf %{buildroot}%{mpi_libdir}/*.{{,l}a,so} %{buildroot}%{mpi_libdir}/pkgconfig

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%defattr(-,root,root)
%dir %mpi_prefix/
%dir %mpi_libdir/
%dir %{_libdir}/mpi
%dir %{_libdir}/mpi/gcc
%mpi_libdir/openmpi
%mpi_libdir/*.so.*
%mpi_libdir/
%{_datadir}/modules

%changelog
openSUSE Build Service is sponsored by