%define with_systemd 1
%endif
+# Detect when mlnx-ofa_kernel-devel contents exist and mofed_source to 0
+%define mofed_src_path $(echo %{?configure_args} | tr ' ' '\\n' | grep -- '--with-o2ib=' | cut -c 13-)
+%define mofed_source %(test -f %mofed_src_path/Module.symvers; echo $?)
+# Update the search path for mofed_scripts
+%if 0%{?mofed_source} > 0
+%define mofed_default_path /usr/src/ofa_kernel/
+%else
+%define mofed_default_path %{mofed_src_path}
+%endif
+
%{!?mpi_name: %global mpi_name openmpi}
Summary: Lustre File System
%endif
%if %{with lustre_modules}
%if %{with mofed}
+%if 0%{?mofed_source} > 0
BuildRequires: mlnx-ofa_kernel-devel
+%endif
+%if %{with multiple_lnds}
%if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler"
Requires: kmod-mlnx-ofa_kernel
%else
Requires: mlnx-ofa_kernel-kmp
%endif
%endif
+%endif
%if 0%{?rhel} >= 8 || "%{_vendor}" == "openEuler"
BuildRequires: kernel-rpm-macros
%endif
WITH_O2IB=""
%if %{with mofed}
- o2ib_path=$(find /usr/src/ofa_kernel/ -type d -name ofed_scripts | xargs dirname)
+ o2ib_path=$(find %{mofed_default_path} -type d -name ofed_scripts | xargs dirname)
if [ -z "$o2ib_path" ]; then
echo "ERROR: could not find OFED devel headers"
exit 1
%if 0%{?suse_version} > 1
Requires: kernel-%1
%endif
+%if 0%{?mofed_source} > 0
+BuildRequires: mlnx-ofa_kernel-devel
+%endif
+%if "%{_vendor}" == "redhat" || "%{_vendor}" == "openEuler"
+Requires: kmod-mlnx-ofa_kernel
+%else
+Requires: mlnx-ofa_kernel-kmp
+%endif
Provides: %{name}-lnet-o2iblnd = %{version}
Obsoletes: %{name}-lnet-o2iblnd < %{version}
Conflicts: %{name}-lnet-in-kernel-o2iblnd