summaryrefslogtreecommitdiffstats
path: root/spl.spec.in
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-06-16 10:44:59 -0700
committerBrian Behlendorf <[email protected]>2009-06-16 10:44:59 -0700
commit39a3d2a421bf067329bae352866a5d1fccbcee70 (patch)
tree326b0cb2c65c3d9150bfe4717095e046940cadce /spl.spec.in
parente554dffa6031a2cf37537fc8451f757d5ae9e46f (diff)
Packaging improvements for RHEL and SLES
- Properly honor --prefix in build system and rpm spec file. - Add '--define require_kdir' to spec file to support building rpms against kernel sources installed in non-default locations. - Add '--define require_kobj' to spec file to support building rpms against kernel object installed in non-default locations. - Stop suppressing errors in autogen.sh script. - Improved logic to detect missing kernel objects when they are not located with the source. This is the common case for SLES as well as in-tree chaos kernel builds and is done to simply support for multiple arches. - Moved spl-devel build products to /usr/src/spl-<version>, a spl symlink is created to reference the last installed version.
Diffstat (limited to 'spl.spec.in')
-rw-r--r--spl.spec.in42
1 files changed, 36 insertions, 6 deletions
diff --git a/spl.spec.in b/spl.spec.in
index cb2648509..4cd71de05 100644
--- a/spl.spec.in
+++ b/spl.spec.in
@@ -1,22 +1,52 @@
# The following block is used to allow the source RPM to be rebuilt
# against arbitrary kernels. It ensure the release name is correct
# and the proper build/install requires are set.
+
+# When require_kdir is defined we do one of two things:
+# require_kver: Ideally defined to match the kernel.
+# !require_kver: A best guess is made.
+%if 0%{?require_kdir:1}
%if 0%{?require_kver:1}
%define kver %{require_kver}
+%define kdir %{require_kdir}
+%else
+%{!?require_kobj: %define require_kobj %{require_kdir}}
+%define kdir %{require_kdir}
+%define kuts %{require_kobj}/include/linux/utsrelease.h \
+ %{require_kobj}/include/linux/version.h
+%define kver %((grep UTS_RELEASE %{kuts}) | cut -f2 -d'"' | tail -1)
+%endif
+
+# When require_kdir is not defined we do one of two things:
+# require_kver: Locate the requested kernel in default dirs.
+# !require_kver: Locate the newest kernel in default dirs.
+%else
+%if 0%{?require_kver:1}
+%define kver %{require_kver}
+%define kdef %{_prefix}/src/kernels/%{kver} %{_prefix}/src/linux-%{kver}
+%define kdir %((echo X; ls -1d %kdef 2>/dev/null)|sed -e 's/linux-//'|tail -1)
+%else
+%define kdef %{_prefix}/src/kernels/* %{_prefix}/src/linux-*
+%define kdir %((echo X; ls -1d %kdef 2>/dev/null)|sed -e 's/linux-//'|tail -1)
+%define kver %(basename %{kdir})
+%endif
+%endif
+
+# Kernel objects may not be located with the source. Assume
+# that they are but allow this to be overrided if required.
+%if 0%{?require_kobj:1}
+%define kobj %{require_kobj}
%else
-%define _kdir %((echo X; ls -1d /usr/src/kernels/* /usr/src/linux-* 2>/dev/null)|sed -e 's/linux-//' | tail -1)
-%define kver %(basename %{_kdir})
+%define kobj %{kdir}
%endif
# Each distro has its own kernel package naming convention.
%if 0%{?ch4}
%define kstr chaos-kernel
%define kdev chaos-kernel-devel
-%define kdir /usr/src/kernels/%{kver}
%else
%define kstr kernel
%define kdev kernel-devel
-%define kdir /usr/src/kernels/%{kver}
%endif
%define debug_package %{nil}
@@ -69,7 +99,7 @@ symbols needed for building additional modules which use %{name}.
%prep
%setup
%build
-%configure --with-linux=%{kdir}
+%configure --with-linux=%{kdir} --with-linux-obj=%{kobj}
make
%install
@@ -87,7 +117,7 @@ rm -rf $RPM_BUILD_ROOT
%files devel
%defattr(-,root,root)
-%{kdir}/include/spl/*
+%{_prefix}/src/*
%post
if [ -f /boot/System.map-%{kver} ]; then