From dfe1d27e0f98afa81e3c4b9f2fa51e4517fbe34a Mon Sep 17 00:00:00 2001 From: Doug Ledford Date: Fri, 13 Oct 2006 12:59:39 +0000 Subject: [PATCH] Don't need the buildreqs where we don't have openib --- openmpi.module.in | 7 ++- openmpi.pc.in | 6 +-- openmpi.spec | 133 ++++++++++++++++++++++++++++++++++------------ 3 files changed, 106 insertions(+), 40 deletions(-) diff --git a/openmpi.module.in b/openmpi.module.in index edb2c93..c846f3c 100644 --- a/openmpi.module.in +++ b/openmpi.module.in @@ -3,7 +3,6 @@ # OpenMPI module for use with 'environment-modules' package: # prepend-path PATH @DATADIR@/@NAME@/bin -prepend-path LD_LIBRARY_PATH @DATADIR@/@NAME@/lib -prepend-path MANPATH @DATADIR@/@NAME@/man -setenv CFLAGS -I@DATADIR@/@NAME@/include -setenv LDFLAGS -L@DATADIR@/@NAME@/lib +prepend-path LD_LIBRARY_PATH @LIBDIR@/@NAME@ +setenv CFLAGS -I@INCLUDEDIR@/@NAME@ -I@INCLUDEDIR@/@NAME@/@MODE@ +setenv LDFLAGS -L@LIBDIR@/@NAME@ diff --git a/openmpi.pc.in b/openmpi.pc.in index ea4537c..59cad3f 100644 --- a/openmpi.pc.in +++ b/openmpi.pc.in @@ -1,7 +1,7 @@ # pkg-config file for openmpi -Name: openmpi +Name: @NAME@ Description: Open Message Passing Interface headers and libraries URL: http://www.open-mpi.org/ Version: @VERSION@ -Libs: -L@LIBDIR@ -lmpi -Cflags: -I@INCLUDEDIR@ +Libs: -L@LIBDIR@/@NAME@ -lmpi +Cflags: -I@INCLUDEDIR@/@NAME@ -I@INCLUDEDIR@/@NAME@/@MODE@ diff --git a/openmpi.spec b/openmpi.spec index 5d889ba..9e7d4ac 100644 --- a/openmpi.spec +++ b/openmpi.spec @@ -1,6 +1,6 @@ Name: openmpi Version: 1.1 -Release: 4%{?dist} +Release: 6%{?dist} Summary: Open Message Passing Interface Group: Development/Libraries @@ -13,8 +13,13 @@ 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, /usr/sbin/alternatives +Requires: %{name}-libs = %{version}-%{release} ExclusiveArch: i386 x86_64 ia64 ppc ppc64 +%package libs +Summary: Libraries used by openmpi programs +Group: Development/Libraries + %package devel Summary: Development files for openmpi Group: Development/Libraries @@ -29,9 +34,27 @@ compliant implementation, Open MPI offers advantages for system and software vendors, application developers, and computer science researchers. For more information, see http://www.open-mpi.org/ . +%description libs +Contains shared libraries used by openmpi applications + %description devel Contains development headers and libraries for openmpi +%ifarch i386 ppc +%define mode 32 +%else + %ifarch s390 + %define mode 31 + %else + %define mode 64 + %endif +%endif +%ifarch i386 ppc64 s390 +%define priority 10 +%else +%define priority 11 +%endif + %prep %setup -q %ifarch x86_64 @@ -43,7 +66,7 @@ XFFLAGS="$RPM_OPT_FLAGS -fPIC" #%configure \ # --includedir=%{_includedir}/%{name} \ # --libdir=%{_libdir}/%{name} \ -# --datadir=%{_datadir}/%{name}/help \ +# --datadir=%{_datadir}/%{name}/help%{mode} \ # --with-openib=/usr \ # LDFLAGS='-Wl,-z,noexecstack' \ # CFLAGS="$CFLAGS $XCFLAGS" \ @@ -53,7 +76,7 @@ XFFLAGS="$RPM_OPT_FLAGS -fPIC" %configure \ --includedir=%{_includedir}/%{name} \ --libdir=%{_libdir}/%{name} \ - --datadir=%{_datadir}/%{name}/help \ + --datadir=%{_datadir}/%{name}/help%{mode} \ LDFLAGS='-Wl,-z,noexecstack' \ CFLAGS="$CFLAGS $XCFLAGS" \ CXXFLAGS="$CFLAGS $XCFLAGS" \ @@ -79,51 +102,78 @@ rm ${RPM_BUILD_ROOT}%{_mandir}/man1/mpirun.1 rm ${RPM_BUILD_ROOT}%{_bindir}/mpi* # Remove the unnecessary compiler common names rm ${RPM_BUILD_ROOT}%{_bindir}/*{cc,c++,CC} +# Move the wrapper program to a name that denotes the mode it compiles +mv ${RPM_BUILD_ROOT}%{_bindir}/opal_wrapper{,-%{mode}} +# But, opal_wrapper needs to be called by a name that denotes the compiler +# type in order to work, so in order to leave it functional even when it isn't +# the currently selected system wide default via the alternatives program, +# make the proper symlinks from %{_datadir}/%{name}/bin to the wrapper +mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/%{name}/bin%{mode} +for i in mpicc mpic++ mpicxx mpiCC mpif77 mpif90 opalcc opalc++ opalCC ortecc ortec++ orteCC; do + ln -s %{_bindir}/opal_wrapper-%{mode} \ + ${RPM_BUILD_ROOT}%{_datadir}/%{name}/bin%{mode}/$i +done +# The fortran include file differs between 32/64bit environments, so make +# two copies +mkdir -p ${RPM_BUILD_ROOT}%{_includedir}/%{name}/%{mode} +mv ${RPM_BUILD_ROOT}%{_includedir}/%{name}/{mpif-config.h,%{mode}} +# and have the wrapper include the right one by using the wrapper-data.txt +# files for the fortran modes to signal the extra include dir +for i in ${RPM_BUILD_ROOT}%{_datadir}/%{name}/help%{mode}/openmpi/mpif{77,90}-wrapper-data.txt; do + sed -e 's#extra_includes=#extra_includes='%{mode}' #' < $i > $i.out + mv $i.out $i +done +# and we also need to force the compile mode via the wrapper-data.txt files +for i in ${RPM_BUILD_ROOT}%{_datadir}/%{name}/help%{mode}/openmpi/*wrapper-data.txt; do + sed -e 's#compiler_flags=#compiler_flags=-m'%{mode}' #' < $i > $i.out + mv $i.out $i +done 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}'#' < %SOURCE1 > ${RPM_BUILD_ROOT}/%{_libdir}/pkgconfig/%{name}.pc; -sed 's#@DATADIR@#'%{_datadir}/%{name}'#;s#@NAME@#'%{name}'#' < %SOURCE2 > ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/%{name}.module +sed 's#@NAME@#'%{name}'#;s#@VERSION@#'%{version}'#;s#@LIBDIR@#'%{_libdir}'#;s#@INCLUDEDIR@#'%{_includedir}'#;s#@MODE@#'%{mode}'#' < %SOURCE1 > ${RPM_BUILD_ROOT}/%{_libdir}/pkgconfig/%{name}.pc; +sed 's#@DATADIR@#'%{_datadir}'#;s#@NAME@#'%{name}'#;s#@LIBDIR@#'%{_libdir}'#;s#@INCLUDEDIR@#'%{_includedir}'#;s#@MODE@#'%{mode}'#' < %SOURCE2 > ${RPM_BUILD_ROOT}/%{_datadir}/%{name}/%{name}.module + %clean [ ! -z "${RPM_BUILD_ROOT}" ] && rm -rf ${RPM_BUILD_ROOT} %post -if [ "$1" -eq 1 ]; then - 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 +alternatives --install %{_bindir}/mpirun mpi-run %{_bindir}/orterun \ + %{priority} \ + --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 %preun if [ "$1" -eq 0 ]; then - alternatives --remove mpi %{_libdir}/openmpi/openmpi.ld.conf + alternatives --remove mpi-run %{_bindir}/orterun fi -%postun -p /sbin/ldconfig +%post libs +alternatives --install %{_sysconfdir}/ld.so.conf.d/mpi%{mode}.conf \ + mpilibs%{mode} %{_libdir}/openmpi/openmpi.ld.conf %{priority} +/sbin/ldconfig + +%preun libs +alternatives --remove mpilibs%{mode} %{_libdir}/openmpi/openmpi.ld.conf + +%postun libs -p /sbin/ldconfig %post devel -if [ "$1" -eq 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 +alternatives --install %{_bindir}/mpicc mpicc \ + %{_bindir}/opal_wrapper-%{mode} %{priority} \ + --slave %{_bindir}/mpic++ mpic++ %{_bindir}/opal_wrapper-%{mode} \ + --slave %{_bindir}/mpiCC mpiCC %{_bindir}/opal_wrapper-%{mode} \ + --slave %{_bindir}/mpicxx mpicxx %{_bindir}/opal_wrapper-%{mode} \ + --slave %{_bindir}/mpif77 mpif77 %{_bindir}/opal_wrapper-%{mode} \ + --slave %{_bindir}/mpif90 mpif90 %{_bindir}/opal_wrapper-%{mode} %preun devel -if [ "$1" -eq 0 ]; then - alternatives --remove mpicc %{_bindir}/opal_wrapper -fi +alternatives --remove mpicc %{_bindir}/opal_wrapper-%{mode} %postun devel -p /sbin/ldconfig @@ -137,18 +187,24 @@ fi %{_bindir}/orterun %{_bindir}/ompi_info %{_bindir}/openmpi +%{_mandir} +%{_datadir}/%{name} +%exclude %{_datadir}/%{name}/bin%{mode} +%exclude %{_datadir}/%{name}/help%{mode}/openmpi/*-wrapper-data.txt + +%files libs %dir %{_libdir}/%{name} %dir %{_libdir}/%{name}/%{name} %{_libdir}/%{name}/*.so.* %{_libdir}/%{name}/%{name}/*.so %{_libdir}/%{name}/*.conf -%{_mandir}/man1/* -%{_datadir}/%{name} %files devel %defattr(-,root,root,-) -%{_bindir}/opal_wrapper +%{_bindir}/opal_wrapper-%{mode} %dir %{_includedir}/%{name} +%{_datadir}/%{name}/bin%{mode} +%{_datadir}/%{name}/help%{mode}/openmpi/*-wrapper-data.txt %{_includedir}/%{name}/* %{_libdir}/%{name}/*.so %{_libdir}/%{name}/*.a @@ -159,6 +215,17 @@ fi %changelog +* Wed Oct 11 2006 Doug Ledford - 1.1-6 +- Bump rev to match fc6 rev +- Fixup some issue with alternatives support +- Split the 32bit and 64bit libs ld.so.conf.d files into two files so + multilib or single lib installs both work properly +- Put libs into their own package +- Add symlinks to /usr/share/openmpi/bin%{mode} so that opal_wrapper-%{mode} + can be called even if it isn't the currently selected default method in + the alternatives setup (opal_wrapper needs to be called by mpicc, mpic++, + etc. in order to determine compile mode from argv[0]). + * Sun Aug 27 2006 Doug Ledford - 1.1-4 - Make sure the post/preun scripts only add/remove alternatives on initial install and final removal, otherwise don't touch.