File openmpi.spec of Package openmpi

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


##########################################################################
# NOTE: If you modified openmpi.spec and/or openmpi.changes please run   #
#       pre_checkin.sh in this directory before submitting the package.  #
#       This will create the -testsuite spec and changes.                #
##########################################################################

%define with_openib 1

Name:           openmpi
Version:        1.8.1
Release:        0
Summary:        A powerful implementaion of MPI
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
Source1:        mpivars.sh
Source2:        mpivars.csh
Source3:        baselibs.conf
Source4:        openmpi-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
BuildRequires:  mpi-selector
%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
Requires:       mpi-selector
Requires(preun): mpi-selector
%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
%if "%{name}" == "openmpi-testsuite"
This package contains the test log in the documentation directory
%else
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 RPM contains all the tools necessary to compile, link, and run
Open MPI jobs.
%endif

%package        libs
Summary:        OpenMPI runtime libraries
Group:          System/Libraries

%description libs
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 subpackage contains the OpenMPI shared libraries.

%package        devel
Summary:        SDK for openMPI
Group:          Development/Libraries/Parallel
Requires:       libstdc++-devel
Requires:       openmpi = %{version}
%if %{with_openib}
Requires:       libibumad-devel
Requires:       libibverbs-devel
%endif

%description devel
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 RPM contains all the wrappers necessary to compile, link, and run
Open MPI jobs.

%package        devel-static
Summary:        Static openMPI libraries
Group:          Development/Libraries/Parallel
Requires:       %{name}-devel = %{version}

%description devel-static
This RPM contains the static library files, which are packaged separately from
the dynamic library and headers.

%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

%if "%{name}" == "openmpi-testsuite"
%check
make check

%install
%else
%install

make install DESTDIR="%buildroot"
# make and install mpivars files
sed -e 's,prefix,%{mpi_prefix},g' -e 's,libdir,%{mpi_libdir},g' %{SOURCE1} \
    > %{buildroot}%{mpi_bindir}/mpivars.sh
sed -e 's,prefix,%{mpi_prefix},g' -e 's,libdir,%{mpi_libdir},g' %{SOURCE2} \
    > %{buildroot}%{mpi_bindir}/mpivars.csh
for input in `find %{buildroot}/%{mpi_mandir} -type f` ; do
	if test -f "$input.gz"; then
		#echo "Remove old file $input.gz"
		rm -f "$input.gz"
	fi
	if test -L "$input"; then
		link=`perl -e 'print readlink($ARGV[0]);' -- "$input"`
		test -d "$link" && continue
		test -d "%{buildroot}/$link" && continue
		rm -f "$input"
		ln -sf "$link.gz" "$input.gz"
	else
		gzip -nf9 "$input"
	fi
	ls -l "$input.gz"
done

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
popd

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

cat << EOF > %{buildroot}%{_datadir}/modules/gnu-openmpi/%{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

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

EOF
%endif

%post
/usr/bin/mpi-selector \
        --register %{name}-%{version} \
        --source-dir %{mpi_bindir} \
        --yes
/usr/bin/mpi-selector \
	--system \
	--set %{name}-%{version} \
	--yes

%preun
/usr/bin/mpi-selector --unregister %{name}-%{version} --yes
/usr/bin/mpi-selector --system --query
if [ ! -z "`/usr/bin/mpi-selector --system --query`" ]; then
    /usr/bin/mpi-selector --system --unset --yes %{name}-%{version}
fi

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

%if "%{name}" == "openmpi"

%files
%defattr(-, root, root)
%doc NEWS README AUTHORS LICENSE
%dir %{_libdir}/mpi
%dir %{_libdir}/mpi/gcc
%dir %{mpi_prefix}
%dir %{mpi_bindir}
%dir %{mpi_libdir}
%dir %{mpi_datadir}
%dir %{mpi_mandir}
#
%config %{_sysconfdir}/openmpi-default-hostfile
%config %{_sysconfdir}/openmpi-mca-params.conf
#
%dir /usr/share/modules/gnu-openmpi
/usr/share/modules/gnu-openmpi/.version
/usr/share/modules/gnu-openmpi/1.8.1
#
%dir %{mpi_datadir}/openmpi/amca-param-sets
%dir %{mpi_datadir}/openmpi/doc
%{mpi_datadir}/openmpi/amca-param-sets/btl-openib-benchmark
%{mpi_datadir}/openmpi/amca-param-sets/example.conf
%{mpi_datadir}/openmpi/doc/COPYRIGHT-ptmalloc2.txt
#
%{mpi_bindir}/mpirun
%{mpi_bindir}/mpivars.csh
%{mpi_bindir}/mpivars.sh
%{mpi_bindir}/ompi-clean
%{mpi_bindir}/ompi-ps
%{mpi_bindir}/ompi-server
%{mpi_bindir}/ompi-top
%{mpi_bindir}/ompi_info
%{mpi_bindir}/orte-clean
%{mpi_bindir}/orte-info
%{mpi_bindir}/orte-ps
%{mpi_bindir}/orte-server
%{mpi_bindir}/orte-top
%{mpi_bindir}/orted
%{mpi_bindir}/orterun
%{mpi_bindir}/oshmem_info
%{mpi_bindir}/oshrun
%{mpi_bindir}/shmemrun
#
%dir %{mpi_mandir}/man1
%{mpi_mandir}/man1/oshmem_info.1.gz
%{mpi_mandir}/man1/orte-clean.1.gz
%{mpi_mandir}/man1/orte-info.1.gz
%{mpi_mandir}/man1/orte-ps.1.gz
%{mpi_mandir}/man1/orte-server.1.gz
%{mpi_mandir}/man1/orte-top.1.gz
%{mpi_mandir}/man1/orted.1.gz
%{mpi_mandir}/man1/orterun.1.gz
%{mpi_mandir}/man1/mpirun.1.gz
%{mpi_mandir}/man1/ompi-clean.1.gz
%{mpi_mandir}/man1/ompi-ps.1.gz
%{mpi_mandir}/man1/ompi-server.1.gz
%{mpi_mandir}/man1/ompi-top.1.gz
%{mpi_mandir}/man1/ompi_info.1.gz
%{mpi_mandir}/man7
#
%dir %{mpi_datadir}/openmpi
%{mpi_datadir}/openmpi/help-dash-host.txt
%{mpi_datadir}/openmpi/help-db-base.txt
%{mpi_datadir}/openmpi/help-errmgr-base.txt
%{mpi_datadir}/openmpi/help-ess-base.txt
%{mpi_datadir}/openmpi/help-hostfile.txt
%{mpi_datadir}/openmpi/help-mca-base.txt
%{mpi_datadir}/openmpi/help-mca-bml-r2.txt
%{mpi_datadir}/openmpi/help-mca-coll-base.txt
%{mpi_datadir}/openmpi/help-mca-op-base.txt
%{mpi_datadir}/openmpi/help-mca-var.txt
%{mpi_datadir}/openmpi/help-mpi-api.txt
%{mpi_datadir}/openmpi/help-mpi-btl-base.txt
%{mpi_datadir}/openmpi/help-mpi-btl-openib-cpc-base.txt
%{mpi_datadir}/openmpi/help-mpi-btl-openib.txt
%{mpi_datadir}/openmpi/help-mpi-btl-sm.txt
%{mpi_datadir}/openmpi/help-mpi-btl-tcp.txt
%{mpi_datadir}/openmpi/help-mpi-btl-vader.txt
%{mpi_datadir}/openmpi/help-mpi-coll-sm.txt
%{mpi_datadir}/openmpi/help-mpi-common-sm.txt
%{mpi_datadir}/openmpi/help-mpi-errors.txt
%{mpi_datadir}/openmpi/help-mpi-pml-bfo.txt
%{mpi_datadir}/openmpi/help-mpi-pml-ob1.txt
%{mpi_datadir}/openmpi/help-mpi-runtime.txt
%{mpi_datadir}/openmpi/help-mpool-base.txt
%ifarch %ix86 x86_64
%{mpi_datadir}/openmpi/help-mtl-psm.txt
%endif
%{mpi_datadir}/openmpi/help-ompi-common-verbs.txt
%{mpi_datadir}/openmpi/help-ompi-crcp-base.txt
%{mpi_datadir}/openmpi/help-ompi-dpm-base.txt
%{mpi_datadir}/openmpi/help-ompi-dpm-orte.txt
%{mpi_datadir}/openmpi/help-ompi-pubsub-orte.txt
%{mpi_datadir}/openmpi/help-oob-base.txt
%{mpi_datadir}/openmpi/help-oob-tcp.txt
%{mpi_datadir}/openmpi/help-opal-compress-base.txt
%{mpi_datadir}/openmpi/help-opal-compress-bzip.txt
%{mpi_datadir}/openmpi/help-opal-compress-gzip.txt
%{mpi_datadir}/openmpi/help-opal-crs-base.txt
%{mpi_datadir}/openmpi/help-opal-crs-none.txt
%{mpi_datadir}/openmpi/help-opal-hwloc-base.txt
%{mpi_datadir}/openmpi/help-opal-memory-linux.txt
%{mpi_datadir}/openmpi/help-opal-runtime.txt
%{mpi_datadir}/openmpi/help-opal-shmem-mmap.txt
%{mpi_datadir}/openmpi/help-opal-shmem-posix.txt
%{mpi_datadir}/openmpi/help-opal-shmem-sysv.txt
%{mpi_datadir}/openmpi/help-opal-util.txt
%{mpi_datadir}/openmpi/help-opal-wrapper.txt
%{mpi_datadir}/openmpi/help-opal_info.txt
%{mpi_datadir}/openmpi/help-orte-clean.txt
%{mpi_datadir}/openmpi/help-orte-filem-base.txt
%{mpi_datadir}/openmpi/help-orte-filem-raw.txt
%{mpi_datadir}/openmpi/help-orte-info.txt
%{mpi_datadir}/openmpi/help-orte-odls-base.txt
%{mpi_datadir}/openmpi/help-orte-odls-default.txt
%{mpi_datadir}/openmpi/help-orte-ps.txt
%{mpi_datadir}/openmpi/help-orte-rmaps-base.txt
%{mpi_datadir}/openmpi/help-orte-rmaps-lama.txt
%{mpi_datadir}/openmpi/help-orte-rmaps-md.txt
%{mpi_datadir}/openmpi/help-orte-rmaps-ppr.txt
%{mpi_datadir}/openmpi/help-orte-rmaps-resilient.txt
%{mpi_datadir}/openmpi/help-orte-rmaps-rr.txt
%{mpi_datadir}/openmpi/help-orte-rmaps-seq.txt
%{mpi_datadir}/openmpi/help-orte-runtime.txt
%{mpi_datadir}/openmpi/help-orte-server.txt
%{mpi_datadir}/openmpi/help-orte-snapc-base.txt
%{mpi_datadir}/openmpi/help-orte-sstore-base.txt
%{mpi_datadir}/openmpi/help-orte-top.txt
%{mpi_datadir}/openmpi/help-orted.txt
%{mpi_datadir}/openmpi/help-orterun.txt
%{mpi_datadir}/openmpi/help-oshmem-sshmem-mmap.txt
%{mpi_datadir}/openmpi/help-oshmem-sshmem-sysv.txt
%{mpi_datadir}/openmpi/help-plm-base.txt
%{mpi_datadir}/openmpi/help-plm-rsh.txt
%{mpi_datadir}/openmpi/help-plm-slurm.txt
%{mpi_datadir}/openmpi/help-ras-base.txt
%{mpi_datadir}/openmpi/help-ras-simulator.txt
%{mpi_datadir}/openmpi/help-ras-slurm.txt
%{mpi_datadir}/openmpi/help-regex.txt
%{mpi_datadir}/openmpi/help-rmaps_rank_file.txt
%{mpi_datadir}/openmpi/help-sec-base.txt
%{mpi_datadir}/openmpi/help-shmem-api.txt
%{mpi_datadir}/openmpi/help-shmem-mca.txt
%{mpi_datadir}/openmpi/help-shmem-runtime.txt
%{mpi_datadir}/openmpi/help-shmem-spml-yoda.txt
%{mpi_datadir}/openmpi/help-state-staged-hnp.txt
%{mpi_datadir}/openmpi/mca-btl-openib-device-params.ini
%{mpi_datadir}/openmpi/mca-coll-ml.config
%{mpi_libdir}/openmpi/*.so

%files libs
%defattr(-,root,root)
%dir %mpi_prefix/
%dir %mpi_libdir/
%mpi_libdir/*.so.*

%files devel
%defattr(-,root,root)
%doc %{mpi_datadir}/vampirtrace
%{_sysconfdir}/openmpi-totalview.tcl
#
%dir %{mpi_libdir}/pkgconfig
%dir %{mpi_libdir}/openmpi
#
%{mpi_bindir}/mpiCC
%{mpi_bindir}/mpiCC-vt
%{mpi_bindir}/mpic++
%{mpi_bindir}/mpic++-vt
%{mpi_bindir}/mpicc
%{mpi_bindir}/mpicc-vt
%{mpi_bindir}/mpicxx
%{mpi_bindir}/mpicxx-vt
%{mpi_bindir}/mpiexec
%{mpi_bindir}/mpif77
%{mpi_bindir}/mpif77-vt
%{mpi_bindir}/mpif90
%{mpi_bindir}/mpif90-vt
%{mpi_bindir}/mpifort
%{mpi_bindir}/mpifort-vt
%{mpi_bindir}/opal_wrapper
%{mpi_bindir}/opalc++
%{mpi_bindir}/opalcc
%{mpi_bindir}/opari
%{mpi_bindir}/ortecc
%{mpi_bindir}/oshcc
%{mpi_bindir}/oshfort
%{mpi_bindir}/otfaux
%{mpi_bindir}/otfconfig
%{mpi_bindir}/otfinfo
%{mpi_bindir}/otfmerge
%{mpi_bindir}/otfmerge-mpi
%{mpi_bindir}/otfprint
%{mpi_bindir}/otfprofile
%{mpi_bindir}/otfprofile-mpi
%{mpi_bindir}/otfshrink
%{mpi_bindir}/shmemcc
%{mpi_bindir}/shmemfort
%{mpi_bindir}/vtCC
%{mpi_bindir}/vtc++
%{mpi_bindir}/vtcc
%{mpi_bindir}/vtcxx
%{mpi_bindir}/vtf77
%{mpi_bindir}/vtf90
%{mpi_bindir}/vtfilter
%{mpi_bindir}/vtfilter-mpi
%{mpi_bindir}/vtfiltergen
%{mpi_bindir}/vtfiltergen-mpi
%{mpi_bindir}/vtfort
%{mpi_bindir}/vtrun
%{mpi_bindir}/vtunify
%{mpi_bindir}/vtunify-mpi
%{mpi_bindir}/vtwrapper
%{mpi_libdir}/mpi.mod
#
%{mpi_mandir}/man1/mpiCC.1
%{mpi_mandir}/man1/mpic++.1.gz
%{mpi_mandir}/man1/mpicc.1.gz
%{mpi_mandir}/man1/mpicxx.1.gz
%{mpi_mandir}/man1/mpiexec.1.gz
%{mpi_mandir}/man1/mpif77.1.gz
%{mpi_mandir}/man1/mpif90.1.gz
%{mpi_mandir}/man1/mpifort.1.gz
%{mpi_mandir}/man1/opal_wrapper.1.gz
%{mpi_mandir}/man1/opalc++.1.gz
%{mpi_mandir}/man1/opalcc.1.gz
%{mpi_mandir}/man3
#
%{mpi_datadir}/openmpi/mpiCC-vt-wrapper-data.txt
%{mpi_datadir}/openmpi/mpiCC-wrapper-data.txt
%{mpi_datadir}/openmpi/mpic++-vt-wrapper-data.txt
%{mpi_datadir}/openmpi/mpic++-wrapper-data.txt
%{mpi_datadir}/openmpi/mpicc-vt-wrapper-data.txt
%{mpi_datadir}/openmpi/mpicc-wrapper-data.txt
%{mpi_datadir}/openmpi/mpicxx-vt-wrapper-data.txt
%{mpi_datadir}/openmpi/mpicxx-wrapper-data.txt
%{mpi_datadir}/openmpi/mpif77-vt-wrapper-data.txt
%{mpi_datadir}/openmpi/mpif77-wrapper-data.txt
%{mpi_datadir}/openmpi/mpif90-vt-wrapper-data.txt
%{mpi_datadir}/openmpi/mpif90-wrapper-data.txt
%{mpi_datadir}/openmpi/mpifort-vt-wrapper-data.txt
%{mpi_datadir}/openmpi/mpifort-wrapper-data.txt
%{mpi_datadir}/openmpi/opalc++-wrapper-data.txt
%{mpi_datadir}/openmpi/opalcc-wrapper-data.txt
%{mpi_datadir}/openmpi/openmpi-valgrind.supp
%{mpi_datadir}/openmpi/ortecc-wrapper-data.txt
%{mpi_datadir}/openmpi/oshcc-wrapper-data.txt
%{mpi_datadir}/openmpi/oshfort-wrapper-data.txt
%{mpi_datadir}/openmpi/shmemcc-wrapper-data.txt
%{mpi_datadir}/openmpi/shmemfort-wrapper-data.txt
#
%{mpi_includedir}
%{mpi_libdir}/*.so
%{mpi_libdir}/pkgconfig/*.pc

%files devel-static
%defattr(-, root, root)
%{mpi_libdir}/*.la
%{mpi_libdir}/openmpi/*.la
%{mpi_libdir}/*.a
%endif

%if "%{name}" == "openmpi-testsuite"
%files
%defattr(-, root, root)
%doc test/util/test-suite.log
%endif

%changelog