Skip to content

Commit

Permalink
Accept kernel source dir(s) specified by ./configure
Browse files Browse the repository at this point in the history
This adds ability to set the location of the kernel via defines
when building from the spec files.  This is useful when building
against a kernel installed in a non-standard location.

Signed-off-by: Turbo Fredriksson <turbo@bayour.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1874
  • Loading branch information
FransUrbo authored and behlendorf committed Jun 5, 2014
1 parent 8b974ba commit 69c7bdb
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 13 deletions.
2 changes: 1 addition & 1 deletion config/zfs-build.m4
Expand Up @@ -141,7 +141,7 @@ AC_DEFUN([ZFS_AC_RPM], [
RPM_DEFINE_COMMON='--define "$(DEBUG_ZFS) 1" --define "$(DEBUG_DMU_TX) 1"'
RPM_DEFINE_UTIL=
RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)"'
RPM_DEFINE_KMOD='--define "kernels $(LINUX_VERSION)" --define "require_spldir $(SPL)" --define "require_splobj $(SPL_OBJ)" --define "ksrc $(LINUX)" --define "kobj $(LINUX_OBJ)"'
RPM_DEFINE_DKMS=
SRPM_DEFINE_COMMON='--define "build_src_rpm 1"'
Expand Down
43 changes: 31 additions & 12 deletions 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

Expand Down Expand Up @@ -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} \
Expand Down

0 comments on commit 69c7bdb

Please sign in to comment.