File openmpi.spec of Package openmpi

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


%define with_dapl 0

Name:           openmpi
Summary:        A powerful implementaion of MPI
License:        BSD-3-Clause
Group:          Development/Libraries/Parallel
Version:        1.6.4
Release:        0
Source0:        %{name}-%{version}.tar.bz2
#Source0:        http://www.open-mpi.org/software/ompi/v%version/downloads/%{name}-%{version}.tar.bz2
Source1:        mpivars.sh
Source2:        mpivars.csh
Source3:        baselibs.conf
Patch0:         remove-assembler-for-armv5.diff
Url:            http://www.open-mpi.org/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  Modules
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gcc-fortran
BuildRequires:  mpi-selector
%if %{with_dapl}
BuildRequires:  compat-dapl-devel
BuildRequires:  libibumad-devel
BuildRequires:  libibverbs-devel
%endif
# List loosely based on files available in openmpi-1.4.4/opal/asm/generated/
ExclusiveArch:  %alpha %arm x86_64 %ix86 ia64 mips mips64 ppc ppc64 %sparc
%ifarch x86_64
BuildRequires:  numactl
%endif
Requires:       mpi-selector
Requires:       openmpi-devel
Requires(preun): mpi-selector
%define _prefix /usr/%_lib/mpi/gcc/%name

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


%package devel
Summary:        A powerful implementaion of MPI
Group:          Development/Libraries/Parallel
Requires:       %{name} = %{version}
Requires:       libstdc++-devel
%if %{with_dapl}
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 tools necessary to compile, link, and run
Open MPI jobs.


%prep
%setup -q
%ifarch armv5el armv5tel
%patch0
%endif

%build
%configure \
	--disable-static \
%if %{with_dapl}
	--with-udapl \
%endif
	--with-devel-headers
make %{?_smp_mflags}

%install
%makeinstall
# make and install mpivars files
sed -e 's,prefix,%_prefix,g' -e 's,libdir,%_prefix/%_lib,g' %{S:1} \
    > $RPM_BUILD_ROOT%_bindir/mpivars.sh
sed -e 's,prefix,%_prefix,g' -e 's,libdir,%_prefix/%_lib,g' %{S:2} \
    > $RPM_BUILD_ROOT%_bindir/mpivars.csh
for input in `find $RPM_BUILD_ROOT/%_prefix/share/man -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 "$RPM_BUILD_ROOT/$link" && continue
		rm -f "$input"
		ln -sf "$link.gz" "$input.gz"
	else
		gzip -nf9 "$input"
	fi
	ls -l "$input.gz"
done

rm -f %buildroot/%_libdir/libotf.la

mkdir -p ${RPM_BUILD_ROOT}/usr/share/modules/gnu-openmpi
%fdupes %{buildroot}%{_mandir} %{buildroot}%{_datadir}

cat << EOF > ${RPM_BUILD_ROOT}/usr/share/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 /usr/%_lib/mpi/gcc/openmpi/bin
prepend-path INCLUDE /usr/%_lib/mpi/gcc/openmpi/include
prepend-path INCLUDE /usr/%_lib/mpi/gcc/openmpi/lib64
prepend-path MANPATH /usr/%_lib/mpi/gcc/openmpi/share/man
prepend-path LD_LIBRARY_PATH /usr/%_lib/mpi/gcc/openmpi/%_lib

EOF

cat << EOF > ${RPM_BUILD_ROOT}/usr/share/modules/gnu-openmpi/.version
#%Module1.0
set ModulesVersion "%version"

EOF

%post
/sbin/ldconfig
/usr/bin/mpi-selector \
        --register %{name}-%{version} \
        --source-dir %{_bindir} \
        --yes
if [ "`/usr/bin/mpi-selector --system --query`" = '' ]; then
  /usr/bin/mpi-selector \
	--system \
	--set %{name}-%{version}
fi

%preun
/usr/bin/mpi-selector --unregister %{name}-%{version} --yes

%postun
/sbin/ldconfig

%files
%defattr(-, root, root)
%dir %_prefix
%dir %_prefix/bin
%dir %_prefix/%_lib
%dir %_prefix/share
%dir %_prefix/share/man
%dir %_prefix/share/man/man1
%dir %_prefix/include
%config %_sysconfdir/*

%_bindir/*
%_mandir/man1/*
%_libdir/*.so.*
%_libdir/*.mod
%_datadir/%name
/usr/share/modules/gnu-openmpi/
%dir /usr/%_lib/mpi
%dir /usr/%_lib/mpi/gcc

%files devel
%defattr(-,root,root)
%dir %_prefix/share/man/man3
%dir %_prefix/share/man/man7
%_libdir/*.la
%_libdir/*.a
%_libdir/*.so
%_libdir/openmpi
%_mandir/man3/*
%_mandir/man7/*
%_includedir/*
%doc %_prefix/share/vampirtrace
%_libdir/pkgconfig


%changelog
openSUSE Build Service is sponsored by