Lint cleanups, update to use alternatives instead of a custom version of

the same thing.
This commit is contained in:
Doug Ledford 2006-08-08 00:19:17 +00:00
parent 95fb784f43
commit b637e0aa21
2 changed files with 71 additions and 82 deletions

View File

@ -1,20 +1,18 @@
Name: openmpi Name: openmpi
Version: 1.1 Version: 1.1
Release: 1%{?dist} Release: 2%{?dist}
Summary: Open Message Passing Interface Summary: Open Message Passing Interface
Group: Development/Libraries Group: Development/Libraries
License: BSD License: BSD
URL: http://www.open-mpi.org/ URL: http://www.open-mpi.org/
Source0: http://www.open-mpi.org/software/ompi/v1.1/downloads/%{name}-%{version}.tar.bz2 Source0: http://www.open-mpi.org/software/ompi/v1.1/downloads/%{name}-%{version}.tar.bz2
Source1: relpath.sh Source1: openmpi.pc.in
Source2: openmpi.pc.in Source2: openmpi.module.in
Source3: mpi_alternatives.in
Source4: openmpi.module.in
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: gcc-gfortran, autoconf, automake, libtool BuildRequires: gcc-gfortran, autoconf, automake, libtool
BuildRequires: libibverbs-devel, opensm-devel, libsysfs-devel BuildRequires: libibverbs-devel, opensm-devel, libsysfs-devel
Requires(post): /sbin/ldconfig Requires(post): /sbin/ldconfig, /usr/sbin/alternatives
ExclusiveArch: i386 x86_64 ia64 ppc ppc64 ExclusiveArch: i386 x86_64 ia64 ppc ppc64
%package devel %package devel
@ -53,7 +51,6 @@ XFFLAGS="$RPM_OPT_FLAGS -fPIC"
--includedir=%{_includedir}/%{name} \ --includedir=%{_includedir}/%{name} \
--libdir=%{_libdir}/%{name} \ --libdir=%{_libdir}/%{name} \
--datadir=%{_datadir}/%{name}/help \ --datadir=%{_datadir}/%{name}/help \
--mandir=%{_datadir}/%{name}/man \
--with-openib=/usr \ --with-openib=/usr \
LDFLAGS='-Wl,-z,noexecstack' \ LDFLAGS='-Wl,-z,noexecstack' \
CFLAGS="$CFLAGS $XCFLAGS" \ CFLAGS="$CFLAGS $XCFLAGS" \
@ -64,7 +61,6 @@ XFFLAGS="$RPM_OPT_FLAGS -fPIC"
--includedir=%{_includedir}/%{name} \ --includedir=%{_includedir}/%{name} \
--libdir=%{_libdir}/%{name} \ --libdir=%{_libdir}/%{name} \
--datadir=%{_datadir}/%{name}/help \ --datadir=%{_datadir}/%{name}/help \
--mandir=%{_datadir}/%{name}/man \
LDFLAGS='-Wl,-z,noexecstack' \ LDFLAGS='-Wl,-z,noexecstack' \
CFLAGS="$CFLAGS $XCFLAGS" \ CFLAGS="$CFLAGS $XCFLAGS" \
CXXFLAGS="$CFLAGS $XCFLAGS" \ CXXFLAGS="$CFLAGS $XCFLAGS" \
@ -73,114 +69,108 @@ XFFLAGS="$RPM_OPT_FLAGS -fPIC"
# ${datadir}/openmpi will be used ONLY for the english help*.txt files # ${datadir}/openmpi will be used ONLY for the english help*.txt files
make %{?_smp_mflags} make %{?_smp_mflags}
%{?!OMbinpfx: %define OMbinpfx om-} # prefix for OpenMPI binaries that clash with LAM
%{?!LAMbinpfx: %define LAMbinpfx lam-} # prefix for LAM binaries that clash with OpenMPI
%install %install
rm -rf ${RPM_BUILD_ROOT} rm -rf ${RPM_BUILD_ROOT}
make install DESTDIR=${RPM_BUILD_ROOT} make install DESTDIR=${RPM_BUILD_ROOT}
#
# Resolve LAM clashes and create %{_datadir}/openmpi/{bin,lib,include} : # The three installed man pages are all identical and could be hard links.
. %SOURCE1 # Doesn't really matter though, since we are using alternatives to do
# ^- provides "relpath" function # master and slave linking, remove the man page that goes with the common
rpath=`relpath ${RPM_BUILD_ROOT}/%{_bindir} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin`; # name and link to the uncommon man page via alternatives.
mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin; rm ${RPM_BUILD_ROOT}%{_mandir}/man1/mpiexec.1
mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/man; rm ${RPM_BUILD_ROOT}%{_mandir}/man1/mpirun.1
ln -s `relpath ${RPM_BUILD_ROOT}/%{_libdir}/%{name} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}` ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/lib;
ln -s `relpath ${RPM_BUILD_ROOT}/%{_includedir}/%{name} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}` ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/include; # Remove the symlinks from common names to the unique name in /usr/bin too
# Links: (mpiCC,mpicxx)->mpicc, (mpiexec,mpirun)->orterun rm ${RPM_BUILD_ROOT}%{_bindir}/mpi*
# Clashes with LAM: mpic++ mpicc mpif77 mpif90 mpiexec mpirun # Remove the unnecessary compiler common names
rm -f ${RPM_BUILD_ROOT}/%{_bindir}/{mpiCC,mpicxx,mpiexec,mpirun} rm ${RPM_BUILD_ROOT}%{_bindir}/*{cc,c++,CC}
(cd ${RPM_BUILD_ROOT}/%{_bindir}; ls) | egrep -v '^(mpic\+\+|mpicc|mpif77|mpif90)$' |
while read b; do
ln -s ${rpath}/${b} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/${b};
done;
for b in mpic++ mpicc mpif77 mpif90; do
mv ${RPM_BUILD_ROOT}/%{_bindir}/$b ${RPM_BUILD_ROOT}/%{_bindir}/%{OMbinpfx}$b;
ln -s ${rpath}/%{OMbinpfx}$b ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/$b;
done
ln -s ./%{OMbinpfx}mpif90 ${RPM_BUILD_ROOT}/%{_bindir}/mpif90
ln -s ${rpath}/%{OMbinpfx}mpic++ ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/mpiCC
ln -s ./%{OMbinpfx}mpic++ ${RPM_BUILD_ROOT}/%{_bindir}/%{OMbinpfx}mpiCC
ln -s ${rpath}/%{OMbinpfx}mpic++ ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/mpicxx
ln -s ./%{OMbinpfx}mpic++ ${RPM_BUILD_ROOT}/%{_bindir}/%{OMbinpfx}mpicxx
ln -s ${rpath}/orterun ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/mpirun
ln -s ./orterun ${RPM_BUILD_ROOT}/%{_bindir}/%{OMbinpfx}mpirun
ln -s ${rpath}/orterun ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin/mpiexec
ln -s ./orterun ${RPM_BUILD_ROOT}/%{_bindir}/%{OMbinpfx}mpiexec
mkdir -p ${RPM_BUILD_ROOT}/%{_sysconfdir}/ld.so.conf.d
# Create ld.so config file for selection with mpi_alternatives: # Create ld.so config file for selection with mpi_alternatives:
echo %{_libdir}/%{name} > ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/ld.conf mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/ld.so.conf.d
# Create ghost mpi.conf ld.so config file: # Create ghost mpi.conf ld.so config file:
touch ${RPM_BUILD_ROOT}/%{_sysconfdir}/ld.so.conf.d/mpi.conf touch ${RPM_BUILD_ROOT}%{_sysconfdir}/ld.so.conf.d/mpi.conf
# We don't like .la files echo %{_libdir}/%{name} > ${RPM_BUILD_ROOT}%{_libdir}/%{name}/%{name}.ld.conf
find ${RPM_BUILD_ROOT}%{_libdir} -name \*.la | xargs rm
# Make the pkgconfig files # Make the pkgconfig files
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/pkgconfig; mkdir -p ${RPM_BUILD_ROOT}%{_libdir}/pkgconfig;
sed 's#@VERSION@#'%{version}'#;s#@LIBDIR@#'%{_libdir}/%{name}'#;s#@INCLUDEDIR@#'%{_includedir}/%{name}'#' < %SOURCE2 > ${RPM_BUILD_ROOT}/%{_libdir}/pkgconfig/%{name}.pc; sed 's#@VERSION@#'%{version}'#;s#@LIBDIR@#'%{_libdir}/%{name}'#;s#@INCLUDEDIR@#'%{_includedir}/%{name}'#' < %SOURCE1 > ${RPM_BUILD_ROOT}/%{_libdir}/pkgconfig/%{name}.pc;
# Make the alternatives utility script: sed 's#@DATADIR@#'%{_datadir}/%{name}'#;s#@NAME@#'%{name}'#' < %SOURCE2 > ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/%{name}.module
mkdir -p ${RPM_BUILD_ROOT}/%{_sbindir}
sed 's#@BINDIR@#'%{_bindir}'#;s#@OMBINPFX@#'%{OMbinpfx}'#;s#@LAMBINPFX@#'%{LAMbinpfx}'#;s#@DATADIR@#'%{_datadir}'#;s#@SYSCONFDIR@#'%{_sysconfdir}'#' < %SOURCE3 > ${RPM_BUILD_ROOT}/%{_sbindir}/mpi_alternatives;
chmod +x ${RPM_BUILD_ROOT}/%{_sbindir}/mpi_alternatives;
sed 's#@DATADIR@#'%{_datadir}/%{name}'#;s#@NAME@#'%{name}'#' < %SOURCE4 > ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/%{name}.module
:;
%clean %clean
rm -rf ${RPM_BUILD_ROOT} [ ! -z "${RPM_BUILD_ROOT}" ] && rm -rf ${RPM_BUILD_ROOT}
%post %post
if [ "$1" -ge 1 ]; then if [ "$1" -ge 1 ]; then
if [ ! -e %{_sysconfdir}/ld.so.conf.d/mpi.conf ]; then alternatives --install %{_sysconfdir}/ld.so.conf.d/mpi.conf mpi \
# handle the case where openmpi is installed without lam: %{_libdir}/openmpi/openmpi.ld.conf 10 \
ln -s %{_datadir}/%{name}/ld.conf %{_sysconfdir}/ld.so.conf.d/mpi.conf; --slave %{_bindir}/mpirun mpi-run %{_bindir}/orterun \
fi; --slave %{_bindir}/mpiexec mpi-exec %{_bindir}/orterun \
--slave %{_mandir}/man1/mpirun.1.gz mpi-run-man \
%{_mandir}/man1/orterun.1.gz \
--slave %{_mandir}/man1/mpiexec.1.gz mpi-exec-man \
%{_mandir}/man1/orterun.1.gz
fi; fi;
/sbin/ldconfig /sbin/ldconfig
%preun
if [ "$1" -ge 1 ]; then
alternatives --remove mpi %{_libdir}/openmpi/openmpi.ld.conf
fi
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
%post devel -p /sbin/ldconfig %post devel
if [ "$1" -ge 1 ]; then
alternatives --install %{_bindir}/mpicc mpicc \
%{_bindir}/opal_wrapper 10 \
--slave %{_bindir}/mpic++ mpic++ %{_bindir}/opal_wrapper \
--slave %{_bindir}/mpiCC mpiCC %{_bindir}/opal_wrapper \
--slave %{_bindir}/mpicxx mpicxx %{_bindir}/opal_wrapper \
--slave %{_bindir}/mpif77 mpif77 %{_bindir}/opal_wrapper \
--slave %{_bindir}/mpif90 mpif90 %{_bindir}/opal_wrapper
fi
%postun devel -p /sbin/ldconfig %preun devel
if [ "$1" -ge 1 ]; then
alternatives --remove mpicc %{_bindir}/opal_wrapper
fi
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc LICENSE README %doc LICENSE README
%ghost %{_sysconfdir}/ld.so.conf.d/mpi.conf %ghost %{_sysconfdir}/ld.so.conf.d/mpi.conf
%config(noreplace) %{_sysconfdir}/openmpi-* %config(noreplace) %{_sysconfdir}/openmpi-*
%{_bindir}/orte* %{_bindir}/orteconsole
#%{_bindir}/*run %{_bindir}/orted
%{_bindir}/*exec %{_bindir}/orteprobe
%{_bindir}/*info %{_bindir}/orterun
%{_sbindir}/mpi_alternatives %{_bindir}/ompi_info
%{_bindir}/openmpi
%dir %{_libdir}/%{name} %dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/%{name} %dir %{_libdir}/%{name}/%{name}
%{_libdir}/%{name}/*.so.* %{_libdir}/%{name}/*.so.*
%{_libdir}/%{name}/%{name}/*.so %{_libdir}/%{name}/%{name}/*.so
%{_libdir}/%{name}/*.mod #%{_libdir}/%{name}/*.mod
%{_datadir}/%{name}/bin %{_libdir}/%{name}/*.conf
%{_datadir}/%{name}/lib %{_mandir}/man1/*
%{_datadir}/%{name}/man %{_datadir}/%{name}
%{_datadir}/%{name}/help
%{_datadir}/%{name}/%{name}.module
%{_datadir}/%{name}/ld.conf
%files devel %files devel
%defattr(-,root,root,-) %defattr(-,root,root,-)
%{_bindir}/* %{_bindir}/opal_wrapper
%exclude %{_bindir}/orte* %dir %{_includedir}/%{name}
%exclude %{_bindir}/*run %{_includedir}/%{name}/*
%exclude %{_bindir}/*exec
%exclude %{_bindir}/*info
%{_includedir}/*
%dir %{_libdir}/%{name}
%{_libdir}/%{name}/*.so %{_libdir}/%{name}/*.so
%{_libdir}/%{name}/*.a %{_libdir}/%{name}/*.la
%{_libdir}/%{name}/%{name}/*.la
%{_libdir}/pkgconfig/%{name}.pc %{_libdir}/pkgconfig/%{name}.pc
%{_datadir}/%{name}/include
%changelog %changelog
* Mon Aug 7 2006 Doug Ledford <dledford@redhat.com> - 1.1-2
- Various lint cleanups
- Switch to using the standard alternatives mechanism instead of a home
grown one
* Wed Aug 2 2006 Doug Ledford <dledford@redhat.com> - 1.1-1 * Wed Aug 2 2006 Doug Ledford <dledford@redhat.com> - 1.1-1
- Upgrade to 1.1 - Upgrade to 1.1
- Build with Infiniband support via openib - Build with Infiniband support via openib

View File

@ -1,2 +1 @@
fd32861d643f9fe539a01d0d5b836f41 openmpi-1.0.2.tar.bz2
821af8bbb7a8e85ec707cb4c3b6bcbf6 openmpi-1.1.tar.bz2 821af8bbb7a8e85ec707cb4c3b6bcbf6 openmpi-1.1.tar.bz2