Lint cleanups, update to use alternatives instead of a custom version of
the same thing.
This commit is contained in:
parent
95fb784f43
commit
b637e0aa21
150
openmpi.spec
150
openmpi.spec
@ -1,20 +1,18 @@
|
||||
Name: openmpi
|
||||
Version: 1.1
|
||||
Release: 1%{?dist}
|
||||
Release: 2%{?dist}
|
||||
Summary: Open Message Passing Interface
|
||||
|
||||
Group: Development/Libraries
|
||||
License: BSD
|
||||
URL: http://www.open-mpi.org/
|
||||
Source0: http://www.open-mpi.org/software/ompi/v1.1/downloads/%{name}-%{version}.tar.bz2
|
||||
Source1: relpath.sh
|
||||
Source2: openmpi.pc.in
|
||||
Source3: mpi_alternatives.in
|
||||
Source4: openmpi.module.in
|
||||
Source1: openmpi.pc.in
|
||||
Source2: openmpi.module.in
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
BuildRequires: gcc-gfortran, autoconf, automake, libtool
|
||||
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
|
||||
|
||||
%package devel
|
||||
@ -53,7 +51,6 @@ XFFLAGS="$RPM_OPT_FLAGS -fPIC"
|
||||
--includedir=%{_includedir}/%{name} \
|
||||
--libdir=%{_libdir}/%{name} \
|
||||
--datadir=%{_datadir}/%{name}/help \
|
||||
--mandir=%{_datadir}/%{name}/man \
|
||||
--with-openib=/usr \
|
||||
LDFLAGS='-Wl,-z,noexecstack' \
|
||||
CFLAGS="$CFLAGS $XCFLAGS" \
|
||||
@ -64,7 +61,6 @@ XFFLAGS="$RPM_OPT_FLAGS -fPIC"
|
||||
--includedir=%{_includedir}/%{name} \
|
||||
--libdir=%{_libdir}/%{name} \
|
||||
--datadir=%{_datadir}/%{name}/help \
|
||||
--mandir=%{_datadir}/%{name}/man \
|
||||
LDFLAGS='-Wl,-z,noexecstack' \
|
||||
CFLAGS="$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
|
||||
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
|
||||
rm -rf ${RPM_BUILD_ROOT}
|
||||
make install DESTDIR=${RPM_BUILD_ROOT}
|
||||
#
|
||||
# Resolve LAM clashes and create %{_datadir}/openmpi/{bin,lib,include} :
|
||||
. %SOURCE1
|
||||
# ^- provides "relpath" function
|
||||
rpath=`relpath ${RPM_BUILD_ROOT}/%{_bindir} ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin`;
|
||||
mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/bin;
|
||||
mkdir -p ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/man;
|
||||
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;
|
||||
# Links: (mpiCC,mpicxx)->mpicc, (mpiexec,mpirun)->orterun
|
||||
# Clashes with LAM: mpic++ mpicc mpif77 mpif90 mpiexec mpirun
|
||||
rm -f ${RPM_BUILD_ROOT}/%{_bindir}/{mpiCC,mpicxx,mpiexec,mpirun}
|
||||
(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
|
||||
|
||||
# The three installed man pages are all identical and could be hard links.
|
||||
# Doesn't really matter though, since we are using alternatives to do
|
||||
# master and slave linking, remove the man page that goes with the common
|
||||
# name and link to the uncommon man page via alternatives.
|
||||
rm ${RPM_BUILD_ROOT}%{_mandir}/man1/mpiexec.1
|
||||
rm ${RPM_BUILD_ROOT}%{_mandir}/man1/mpirun.1
|
||||
|
||||
# Remove the symlinks from common names to the unique name in /usr/bin too
|
||||
rm ${RPM_BUILD_ROOT}%{_bindir}/mpi*
|
||||
# Remove the unnecessary compiler common names
|
||||
rm ${RPM_BUILD_ROOT}%{_bindir}/*{cc,c++,CC}
|
||||
|
||||
# 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:
|
||||
touch ${RPM_BUILD_ROOT}/%{_sysconfdir}/ld.so.conf.d/mpi.conf
|
||||
# We don't like .la files
|
||||
find ${RPM_BUILD_ROOT}%{_libdir} -name \*.la | xargs rm
|
||||
touch ${RPM_BUILD_ROOT}%{_sysconfdir}/ld.so.conf.d/mpi.conf
|
||||
echo %{_libdir}/%{name} > ${RPM_BUILD_ROOT}%{_libdir}/%{name}/%{name}.ld.conf
|
||||
# Make the pkgconfig files
|
||||
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;
|
||||
# Make the alternatives utility script:
|
||||
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
|
||||
:;
|
||||
sed 's#@VERSION@#'%{version}'#;s#@LIBDIR@#'%{_libdir}/%{name}'#;s#@INCLUDEDIR@#'%{_includedir}/%{name}'#' < %SOURCE1 > ${RPM_BUILD_ROOT}/%{_libdir}/pkgconfig/%{name}.pc;
|
||||
sed 's#@DATADIR@#'%{_datadir}/%{name}'#;s#@NAME@#'%{name}'#' < %SOURCE2 > ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/%{name}.module
|
||||
|
||||
%clean
|
||||
rm -rf ${RPM_BUILD_ROOT}
|
||||
[ ! -z "${RPM_BUILD_ROOT}" ] && rm -rf ${RPM_BUILD_ROOT}
|
||||
|
||||
%post
|
||||
if [ "$1" -ge 1 ]; then
|
||||
if [ ! -e %{_sysconfdir}/ld.so.conf.d/mpi.conf ]; then
|
||||
# handle the case where openmpi is installed without lam:
|
||||
ln -s %{_datadir}/%{name}/ld.conf %{_sysconfdir}/ld.so.conf.d/mpi.conf;
|
||||
fi;
|
||||
alternatives --install %{_sysconfdir}/ld.so.conf.d/mpi.conf mpi \
|
||||
%{_libdir}/openmpi/openmpi.ld.conf 10 \
|
||||
--slave %{_bindir}/mpirun mpi-run %{_bindir}/orterun \
|
||||
--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;
|
||||
/sbin/ldconfig
|
||||
|
||||
%preun
|
||||
if [ "$1" -ge 1 ]; then
|
||||
alternatives --remove mpi %{_libdir}/openmpi/openmpi.ld.conf
|
||||
fi
|
||||
|
||||
%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
|
||||
%defattr(-,root,root,-)
|
||||
%doc LICENSE README
|
||||
%ghost %{_sysconfdir}/ld.so.conf.d/mpi.conf
|
||||
%config(noreplace) %{_sysconfdir}/openmpi-*
|
||||
%{_bindir}/orte*
|
||||
#%{_bindir}/*run
|
||||
%{_bindir}/*exec
|
||||
%{_bindir}/*info
|
||||
%{_sbindir}/mpi_alternatives
|
||||
%{_bindir}/orteconsole
|
||||
%{_bindir}/orted
|
||||
%{_bindir}/orteprobe
|
||||
%{_bindir}/orterun
|
||||
%{_bindir}/ompi_info
|
||||
%{_bindir}/openmpi
|
||||
%dir %{_libdir}/%{name}
|
||||
%dir %{_libdir}/%{name}/%{name}
|
||||
%{_libdir}/%{name}/*.so.*
|
||||
%{_libdir}/%{name}/%{name}/*.so
|
||||
%{_libdir}/%{name}/*.mod
|
||||
%{_datadir}/%{name}/bin
|
||||
%{_datadir}/%{name}/lib
|
||||
%{_datadir}/%{name}/man
|
||||
%{_datadir}/%{name}/help
|
||||
%{_datadir}/%{name}/%{name}.module
|
||||
%{_datadir}/%{name}/ld.conf
|
||||
#%{_libdir}/%{name}/*.mod
|
||||
%{_libdir}/%{name}/*.conf
|
||||
%{_mandir}/man1/*
|
||||
%{_datadir}/%{name}
|
||||
|
||||
%files devel
|
||||
%defattr(-,root,root,-)
|
||||
%{_bindir}/*
|
||||
%exclude %{_bindir}/orte*
|
||||
%exclude %{_bindir}/*run
|
||||
%exclude %{_bindir}/*exec
|
||||
%exclude %{_bindir}/*info
|
||||
%{_includedir}/*
|
||||
%dir %{_libdir}/%{name}
|
||||
%{_bindir}/opal_wrapper
|
||||
%dir %{_includedir}/%{name}
|
||||
%{_includedir}/%{name}/*
|
||||
%{_libdir}/%{name}/*.so
|
||||
%{_libdir}/%{name}/*.a
|
||||
%{_libdir}/%{name}/*.la
|
||||
%{_libdir}/%{name}/%{name}/*.la
|
||||
%{_libdir}/pkgconfig/%{name}.pc
|
||||
%{_datadir}/%{name}/include
|
||||
|
||||
|
||||
%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
|
||||
- Upgrade to 1.1
|
||||
- Build with Infiniband support via openib
|
||||
|
Loading…
Reference in New Issue
Block a user