Whamcloud - gitweb
LU-15699 build: without mpi build fails
[fs/lustre-release.git] / lustre.spec.in
index 8f0686b..1cb88fa 100644 (file)
@@ -370,8 +370,8 @@ BuildRequires: openmpi-devel
 %else
 BuildRequires: openmpi2-devel
 %endif
-%endif
-%endif
+%endif # openmpi
+%endif # mpi
 
 %description tests
 This package contains a set of test binaries and scripts that are intended
@@ -481,8 +481,14 @@ fi
 # kmod tools/scripts require "name" directory with kernel modules
 %define eval_configure %(echo '%configure' | sed -e 's#\./configure#eval ./configure#' -e 's/--\\(build\\|host\\|target\\)=[^ ][^ ]* //g')
 
-%{?_openmpi_load}
+%if %{with mpi}
+%if %{mpi_name} == "mpich"
 %{?_mpich_load}
+%endif
+%if %{mpi_name} == "openmpi"
+%{?_openmpi_load}
+%endif
+%endif # mpi
 
 %if %{with mofed}
        o2ib_path=$(find /usr/src/ofa_kernel/ -type d -name ofed_scripts | xargs dirname)
@@ -526,9 +532,25 @@ fi
 
 make %{?_smp_mflags} -s %{?make_args}
 
+%if %{with mpi}
+%if %{mpi_name} == "mpich"
+%{?_mpich_unload}
+%endif
+%if %{mpi_name} == "openmpi"
+%{?_openmpi_unload}
+%endif
+%endif # mpi
+
 %install
-%{?_openmpi_load}
+
+%if %{with mpi}
+%if %{mpi_name} == "mpich"
 %{?_mpich_load}
+%endif
+%if %{mpi_name} == "openmpi"
+%{?_openmpi_load}
+%endif
+%endif # mpi
 
 make install DESTDIR=$RPM_BUILD_ROOT
 
@@ -558,6 +580,15 @@ mv $basemodpath/fs/kinode.ko $RPM_BUILD_ROOT%{_libdir}/lustre/tests/kernel/
 %endif
 %endif
 
+%if %{without mpi}
+if [ -d $RPM_BUILD_ROOT%{_libdir}/openmpi ] ; then
+       rm -fr $RPM_BUILD_ROOT%{_libdir}/openmpi
+fi
+if [ -d $RPM_BUILD_ROOT%{_libdir}/mpich ] ; then
+       rm -fr $RPM_BUILD_ROOT%{_libdir}/mpich
+fi
+%endif
+
 :> lustre.files
 
 %if %{with servers} && %{with lustre_utils}
@@ -630,6 +661,14 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/liblustreapi.la
 
 %if %{with lustre_tests}
 :> lustre-tests.files
+%if %{with mpi}
+%if %{mpi_name} == "mpich"
+%{?_mpich_load}
+%endif
+%if %{mpi_name} == "openmpi"
+%{?_openmpi_load}
+%endif
+%endif # mpi
 echo '%{_libdir}/lustre/tests/*' >>lustre-tests.files
 echo '%{_bindir}/mcreate' >>lustre-tests.files
 echo '%{_bindir}/munlink' >>lustre-tests.files