File mpich.spec of Package mpich

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



Name:           mpich
BuildRequires:  gcc-c++ gcc-fortran gdb libtool
BuildRequires:  fdupes
License:        SUSE-Permissive
Group:          Development/Libraries/Parallel
URL:            http://www-unix.mcs.anl.gov/mpi/mpich/
Version:        1.2.7p1
Release:        222
Summary:        A Portable Implementation of MPI
Source:         mpich-%{version}.tar.bz2
Source2:        machines.LINUX
#Source3:      permissions
Source4:        mpich-ch_p4.module
Source5:        mpich-ch_p4mpd.module
Patch:          mpich-1.2.6.dif
Patch2:         mpich-1.2.6-limits.patch
Patch3:         gcc4.dif
Patch4:         alog-bufferoverflow.patch
Patch5:         mpich-1.2.6_implicit_declarations.diff
Patch6:         mpeinstall.patch
#Patch10:      mpich-1.2.5-sysconfdir.patch
#Patch13:      mpich-1.2.5-destdir.patch
#Patch15:      patch.all
Patch10:        mpich-mpiman.patch
Patch11:        mpich-1.2.7_bsendutil2.c_uninitialized_variables.patch
Patch12:        gfortran.patch
Patch13:        mpich-1.2.7p1-iostream.dif
Patch14:        mpich-hostent.patch
Patch15:        mpich-fix_headers.diff
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Requires:       openssh, Modules
%define _mpich_root       /opt/mpich
%define gnu    1
%define absoft 0
%define intel  0
%define pgi    0
%define lahey  0
%define nag    0
%define debug    0
#
# Pick the device.  The ch_p4mpd device is recommended for clusters of
# uniprocessors; the ch_p4 device with comm=shared is appropriate for
# clusters of SMPs.
%define devices ch_p4mpd ch_p4
%define other_device_opts %{nil}
#
# Define this to +pvfs if pvfs is available.
%define other_file_systems %{nil}
%define rel 1
#
# These definitions are approximate.  They are taken in part from the
# mpich-scyld.spec file, though the choices here rely more on the MPICH
# configure to find the correct options for the compilers.  Not all have
# been tested (we don't have access to the Lahey compiler, for example).
%if %{gnu}
    %define c_compiler gcc
    %define compiler_path /usr/bin
    %define setenvs export FC=gfortran; export F77_GETARGDECL="intrinsic GETARG"
    %define fopts %{nil}
    %define extralibs %{nil}
    %define extraldopts %{nil}
%endif
%if %{intel}
    %define c_compiler icc
    %define compiler_path /opt/intel/compiler50/ia32
    %define setenvs export PATH=$PATH:%{compiler_path}/bin; export LD_LIBRARY_PATH=%{compiler_path}/lib; export FC=%{compiler_path}/bin/ifc; export F90=$FC
    %define fopts -fflags="-Vaxlib "
    %define extralibs %{nil}
    %define extraldopts -L%{compiler_path}/lib -lPEPCF90 -lIEPCF90 -lF90 %{compiler_path}/lib/libintrins.a
%endif
%if %{pgi}
    %define c_compiler pgicc
    %define compiler_path /usr/pgi/linux86
    %define setenvs export PATH=$PATH:%{compiler_path}/bin; export PGI=%{compiler_path}/..; export CC="%{compiler_path}/bin/pgcc"; export FC="/usr/pgi/linux86/bin/pgf77"; export F90="%{compiler_path}/bin/pgf90"
    %define fopts %{nil}
    %define extralibs -L%{compiler_path}/lib -lpgc
    %define extraldopts -L%{compiler_path}/lib -lpgc
%endif

%description
MPICH is a freely available, portable implementation of MPI, the
standard for message-passing libraries.

%package devel
Summary:        A Portable Implementation of MPI
Group:          Development/Libraries/Parallel
Requires:       mpich
Provides:       mpich-doc
Obsoletes:      mpich-doc

%description devel
MPICH is a freely available, portable implementation of MPI, the
Standard for message-passing libraries. This package contains manpages,
headers and libraries needed for developing MPI applications

%prep
%setup -q
%patch
%patch2
%patch3
%patch4
%patch5
%patch6
%patch10
%patch11
%patch12
%patch13
%if %suse_version > 1110
%patch14
%endif
%patch15 -p1

%build
%setenvs
# update
DIRS=$(find -type d)
%{?suse_update_config:%{suse_update_config -f $DIRS}}
[ -f configure.in ] && libtoolize --copy --force;
autoreconf --force --install
# configure options
for device in %{devices}; do
 	INST=$(echo $device| sed -e "s@_@-@")
	test -d image_$device || mkdir image_$device; cd image_$device 
     CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
	../configure \
		-rsh=/usr/bin/ssh \
		--enable-c++ \
		-cflags="$RPM_OPT_FLAGS -fno-strict-aliasing -Impid/mpd/ -Iinclude" \
		--with-common-prefix=/opt/mpich \
		--libdir=/opt/mpich/$INST/%_lib \
		--includedir=/opt/mpich/include \
		-mpe_opts="--libdir=/opt/mpich/$INST/%_lib" \
		--with-romio=--with-file-system=nfs+ufs%{other_file_systems} \
%if %{debug}
		--enable-devdebug \
		--enable-debug \
%endif
		--with-device=$device  \
		-prefix=/opt/mpich/$INST \
		--enable-sharedlib
		# parallel build fails
		make -j1
		cd ../
done

%install
install -d $RPM_BUILD_ROOT/var/log/mpich
# install the normal version.
for device in %{devices}; do
	INST=$(echo $device| sed -e "s@_@-@");
	(cd image_$device && \
		DESTDIR=$RPM_BUILD_ROOT make install MPIINSTALL_OPTS="-manpath=%{_mpich_root}/man -datapath=%{_mpich_root}/share" -libdir=%{_mpich_root}/%_lib
	)
done
# NOW: We have all the dirs up, and working.
install -d $RPM_BUILD_ROOT/%_defaultdocdir/mpich
cp -a $RPM_BUILD_ROOT/%{_mpich_root}/ch-p4/doc/* $RPM_BUILD_ROOT/%_defaultdocdir/mpich
cp -a $RPM_BUILD_ROOT/%{_mpich_root}/ch-p4/share/examples $RPM_BUILD_ROOT/%_defaultdocdir/mpich/
# fix things up for MPICH ... it installs files in a very ugly way
for device in %{devices} ; do 
 INST=$(echo $device| sed -e "s@_@-@")
 for A in mpiuninstall chkserv ; do rm -f $RPM_BUILD_ROOT/%{_mpich_root}/$INST/sbin/$A; done
 rm -rf $RPM_BUILD_ROOT/%{_mpich_root}/$INST/www
 cp $RPM_BUILD_ROOT/%{_mpich_root}/$INST/examples/Makefile $RPM_BUILD_ROOT/%_defaultdocdir/mpich/examples/Makefile.$INST
 rm -rf $RPM_BUILD_ROOT/%{_mpich_root}/$INST/examples
 rm -rf $RPM_BUILD_ROOT/%{_mpich_root}/$INST/share/examples
 rm -rf $RPM_BUILD_ROOT/%{_mpich_root}/$INST/doc
 rm -rf $RPM_BUILD_ROOT/%{_mpich_root}/$INST/include
 ln -sf ../include $RPM_BUILD_ROOT/%{_mpich_root}/$INST/
done
cp %{SOURCE2} $RPM_BUILD_ROOT/%{_mpich_root}/share//machines.LINUX
# fixing mpd binaries.
for bin in mpdallexit mpdbomb mpdclean mpdcleanup mpddump mpdexit mpdhelp \
    mpdkilljob mpdlistjobs mpdmandump  mpdmpexec mpdringsize mpdringtest mpdshutdown mpdtrace  mpigdb  mpirun ; do \
    ln -sf mpdcon $RPM_BUILD_ROOT/%{_mpich_root}/ch-p4mpd/bin/$bin; done
install -m 644 COPYRIGHT $RPM_BUILD_ROOT/%_defaultdocdir/mpich 
## create file lists
find $RPM_BUILD_ROOT/opt/mpich/ch-*/etc -type f -print  | sed "s@^$RPM_BUILD_ROOT@@g"  > filelist
find $RPM_BUILD_ROOT/opt/mpich/ch-*/{bin,sbin} -type f -print | sed \
"s@^$RPM_BUILD_ROOT@%attr\(755,root,root\)@g" | grep -v mpicc | grep -v mpicxx | grep -v mpif77 | grep -v mpiuninstall >> filelist
find $RPM_BUILD_ROOT/opt/mpich/ch-*/{bin,sbin} -type l -print | sed "s@^$RPM_BUILD_ROOT@@g"  >> filelist
install -d $RPM_BUILD_ROOT/usr/share/modules/modulefiles
install -m 644 %{S:4} $RPM_BUILD_ROOT/usr/share/modules/modulefiles/mpich-ch-p4
install -m 644 %{S:5} $RPM_BUILD_ROOT/usr/share/modules/modulefiles/mpich-ch-p4mpd
export manpath="$manpath /opt/mpich/man"
rm -f $RPM_BUILD_ROOT/%{_mpich_root}/{machines.LINUX,Makefile.sample}
rm -f $RPM_BUILD_ROOT/%{_mpich_root}/man/mandesc
rm -f $RPM_BUILD_ROOT/%{_mpich_root}/man/*/depcomp
#brp-compress does not look under /opt
find $RPM_BUILD_ROOT/%{_mpich_root}/man -type f -a ! -name "*gz" -print0 | xargs -0 -r gzip -9
%fdupes -s $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%files -f filelist
%defattr(-,root,root,755)
%doc doc/*.pdf COPYRIGHT KnownBugs  README 
%dir /usr/share/modules
%dir /var/log/mpich
%dir /usr/share/modules/modulefiles
/usr/share/modules/modulefiles/mpich*
%dir %{_mpich_root}
%dir %{_mpich_root}/ch-*
%dir %{_mpich_root}/ch-*/bin
%dir %{_mpich_root}/ch-*/etc
%dir %{_mpich_root}/ch-*/%_lib
%dir %{_mpich_root}/ch-*/%_lib/shared
%dir %{_mpich_root}/ch-*//sbin
%{_mpich_root}/ch-*/%_lib/*.so.*
%dir %{_mpich_root}/share
%{_mpich_root}/share/*
%dir %{_mpich_root}/man
%dir %{_mpich_root}/man/man1
%doc %{_mpich_root}/man/man1/Jumpshots.1.gz
%doc %{_mpich_root}/man/man1/MPI.1.gz
%doc %{_mpich_root}/man/man1/chp4_servs.1.gz
%doc %{_mpich_root}/man/man1/cleanipcs.1.gz
%doc %{_mpich_root}/man/man1/mpiman.1.gz
%doc %{_mpich_root}/man/man1/mpireconfig.1.gz
%doc %{_mpich_root}/man/man1/mpirun.1.gz
%doc %{_mpich_root}/man/man1/tstmachines.1.gz

%files devel
%defattr(-,root,root,755)
%dir %{_mpich_root}/man/man3
%doc %{_mpich_root}/man/man3/*.3*
%dir %{_mpich_root}/man/man4
%doc %{_mpich_root}/man/man4/*.4*
%doc %{_mpich_root}/man/man1/mpiCC.1.gz
%doc %{_mpich_root}/man/man1/mpicc.1.gz
%doc %{_mpich_root}/man/man1/mpif77.1.gz
%doc %{_mpich_root}/man/man1/mpif90.1.gz
%doc COPYRIGHT www/*
%dir %{_mpich_root}/include
%dir %{_mpich_root}/include/mpi2c++
%dir %{_mpich_root}/include/f90base
%dir %{_mpich_root}/include/f90choice
%{_mpich_root}/include/mpi2c++/*.h
%{_mpich_root}/include/*.h
%{_mpich_root}/include/f90base/*.mod
%{_mpich_root}/include/f90choice/*.mod
# sym link
%{_mpich_root}/ch-*/include
%{_mpich_root}/ch-*/%_lib/*.a
%{_mpich_root}/ch-*/%_lib/*.o
%{_mpich_root}/ch-*/%_lib/*.so
%{_mpich_root}/ch-*/%_lib/shared/*.so*
%{_mpich_root}/ch-*/bin/mpicc
%{_mpich_root}/ch-*/bin/mpicxx
%{_mpich_root}/ch-*/bin/mpif77

%changelog
openSUSE Build Service is sponsored by