summaryrefslogtreecommitdiffstats
path: root/rpm/generic
diff options
context:
space:
mode:
Diffstat (limited to 'rpm/generic')
-rw-r--r--rpm/generic/zfs-kmod.spec.in43
1 files changed, 31 insertions, 12 deletions
diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in
index 4eb25e02b..0284f6a7f 100644
--- a/rpm/generic/zfs-kmod.spec.in
+++ b/rpm/generic/zfs-kmod.spec.in
@@ -1,4 +1,33 @@
%define module @PACKAGE@
+
+%if !%{defined ksrc}
+%if 0%{?rhel}%{?fedora}
+%define ksrc ${kernel_version##*___}
+%else
+%define ksrc "$( \
+ if [ -e "/usr/src/linux-${kernel_version%%___*}" ]; then \
+ echo "/usr/src/linux-${kernel_version%%___*}"; \
+ elif [ -e "/lib/modules/${kernel_version%%___*}/source" ]; then \
+ echo "/lib/modules/${kernel_version%%___*}/source"; \
+ else \
+ echo "/lib/modules/${kernel_version%%___*}/build"; \
+ fi)"
+%endif
+%endif
+
+%if !%{defined kobj}
+%if 0%{?rhel}%{?fedora}
+%define kobj ${kernel_version##*___}
+%else
+%define kobj "$( \
+ if [ -e "/usr/src/linux-${kernel_version%%___*}" ]; then \
+ echo "/usr/src/linux-${kernel_version%%___*}"; \
+ else \
+ echo "/lib/modules/${kernel_version%%___*}/build"; \
+ fi)"
+%endif
+%endif
+
#define repo rpmfusion
#define repo chaos
@@ -125,18 +154,8 @@ for kernel_version in %{?kernel_versions}; do
cd _kmod_build_${kernel_version%%___*}
%configure \
--with-config=kernel \
-%if 0%{?rhel}%{?fedora}
- --with-linux="${kernel_version##*___}" \
- --with-linux-obj="${kernel_version##*___}" \
-%else
- --with-linux="$( \
- if [ -e "/lib/modules/${kernel_version%%___*}/source" ]; then \
- echo "/lib/modules/${kernel_version%%___*}/source"; \
- else \
- echo "/lib/modules/${kernel_version%%___*}/build"; \
- fi)" \
- --with-linux-obj="/lib/modules/${kernel_version%%___*}/build" \
-%endif
+ --with-linux=%{ksrc} \
+ --with-linux-obj=%{kobj} \
--with-spl="%{spldir}" \
--with-spl-obj="%{splobj}" \
%{debug} \