File openmpi.spec of Package openmpi

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

# norootforbuild

%define with_dapl 0

Name:           openmpi
Summary:        A powerful implementaion of MPI
Version:        1.2.8
Release:        16
License:        BSD3c(or similar)
Group:          Development/Libraries/Parallel
Source0:        %{name}-%{version}.tar.bz2
Source1:        mpivars.sh
Source2:        mpivars.csh
Source3:        baselibs.conf
# Patch0:         openmpi-new-ehca.patch
Url:            http://www.open-mpi.org/
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
BuildRequires:  gcc-c++ gcc-fortran mpi-selector
%if %{with_dapl}
BuildRequires:  compat-dapl-devel libibumad-devel libibverbs-devel
%endif
ExcludeArch:    s390 s390x
%ifarch x86_64
BuildRequires:  numactl
%endif
Requires:       mpi-selector
PreReq:         mpi-selector
%define _prefix /usr/%_lib/mpi/gcc/%name
Patch:          openmpi-no-build-date.patch

%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
License:        BSD3c(or similar)
Group:          Development/Libraries/Parallel
Summary:        A powerful implementaion of MPI
Requires:       %{name} = %{version} libstdc++-devel
%if %{with_dapl}
Requires:       libibverbs-devel libibumad-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
%patch

%build
%configure \
%if %{with_dapl}
	--with-udapl \
%endif
	--with-devel-headers
make

%install
make DESTDIR=$RPM_BUILD_ROOT install
# 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

%clean
rm -rf ${RPM_BUILD_ROOT}

%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/share/man/man3
%dir %_prefix/include
%config %_sysconfdir/*
%_bindir/*
%_mandir/man1/*
%_libdir/*.so.*
%_libdir/*.mod
%_datadir/%name

%files devel
%defattr(-,root,root)
%_libdir/*.la
%_libdir/*.so
%_libdir/openmpi
%_mandir/man3/*
%_includedir/*

%changelog
openSUSE Build Service is sponsored by