aboutsummaryrefslogtreecommitdiffstats
path: root/spl.spec.in
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-06-25 15:31:53 -0700
committerBrian Behlendorf <[email protected]>2009-06-25 15:31:53 -0700
commit31b2e0b070d99681d189951557d2344dc2b63dbf (patch)
treefdaadf5b6239bfc80de88e4b382c32f030f71ea5 /spl.spec.in
parent762b96f6c6dd6feb2407bf484685b4ac70ab8fcd (diff)
Packaging Fixes
- Kernel modules should be built using the LINUX_OBJ Makefiles and not the LINUX Makefiles to ensure the proper install paths are used. - Install modules in to addon/spl/ - Ensure no additional kernel module build products are packaged. - Simplified spl.spec.in which supports RHEL, CHAOS, SLES, FEDORA.
Diffstat (limited to 'spl.spec.in')
-rw-r--r--spl.spec.in118
1 files changed, 68 insertions, 50 deletions
diff --git a/spl.spec.in b/spl.spec.in
index e67408dd7..ac4b9e78d 100644
--- a/spl.spec.in
+++ b/spl.spec.in
@@ -1,71 +1,89 @@
# 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}
+# against specific kernels. It is preferable that rpmbuild define the
+# require_kver, require_kdir, require_obj constants for us, but if it does not
+# not we attempt to determine the correct values based on your distro.
+
+%{?require_kver: %define kver %{require_kver}}
+%{?require_kdir: %define kdir %{require_kdir}}
+%{?require_kobj: %define kobj %{require_kobj}}
+
+# kdir: Full path to the kernel source headers
+# kobj: Full path to the kernel build objects
+# kver: Kernel version
+# kpkg: Kernel package name
+# kdevpkg: Kernel devel package name
+# kverpkg: Kernel package version
+
+# SLES*:
+%if %{defined sles_version}
+ %if %{undefined kver}
+ %define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{_target_cpu}
+ %define kver %(%{__cat} %{klnk}/.kernelrelease)
+ %endif
+ %define kpkg kernel-%{_target_cpu}
+ %define kdevpkg kernel-source kernel-syms
+ %define kverpkg %(echo %{kver} | cut -d'-' -f1-2)
+ %{!?kdir: %define kdir %{_usrsrc}/linux-%{kverpkg}}
+ %{!?kobj: %define kobj %{kdir}-obj/%{_target_cpu}/%{_target_cpu}}
+
+# CHAOS4:
%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.
+%if %{defined ch4}
+ %if %{undefined kver}
+ %define klnk %{_usrsrc}/kernels/*/include/config
+ %define kver %((%{__cat} %{klnk}/kernel.release) | tail -1)
+ %endif
+ %define kpkg chaos-kernel
+ %define kdevpkg chaos-kernel-devel
+ %define kverpkg %{kver}
+ %{!?kdir: %define kdir %{_usrsrc}/kernels/%{kver}}
+ %{!?kobj: %define kobj %{kdir}}
+
+# RHEL*/Fedora:
%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
+%if %{defined fedora} || %{defined rhel}
+ %if %{undefined kver}
+ %define klnk %{_usrsrc}/kernels/*/include/config
+ %define kver %((%{__cat} %{klnk}/kernel.release) | tail -1)
+ %endif
+ %define kpkg kernel
+ %define kdevpkg kernel-devel
+ %define kverpkg %(echo %{kver} | cut -d'.' -f1-7)
+ %{!?kdir: %define kdir %{_usrsrc}/kernels/%{kver}}
+ %{!?kobj: %define kobj %{kdir}}
-# 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 kobj %{kdir}
-%endif
-# Each distro has its own kernel package naming convention.
-%if 0%{?ch4}
-%define kstr chaos-kernel
-%define kdev chaos-kernel-devel
-%else
-%define kstr kernel
-%define kdev kernel-devel
+# Unsupported distro:
+%{!?kver: %define kver unknown}
+%define kpkg kernel
+%define kdevpkg kernel-devel
+%define kverpkg %{kver}
+%{!?kdir: %define kdir %{_usrsrc}/kernels/%{kver}}
+%{!?kobj: %define kobj %{kdir}}
+
+%endif
+%endif
%endif
+# Distro agnostic:
%define debug_package %{nil}
-# The kernel version should only be appended to a binary RPM.
-# When building a source RPM it must be kernel version agnostic.
%define name @PACKAGE@
%define version @VERSION@
+# The kernel version should only be appended to a binary RPM.
+# When building a source RPM it must be kernel version agnostic.
%if %{?build_src_rpm:1}0
%define release @SPL_META_RELEASE@
%else
-%define release @SPL_META_RELEASE@_%(echo %{kver} | sed -e 's/-/_/g')
+%define release @SPL_META_RELEASE@_%(echo %{kverpkg} | %{__sed} -e 's/-/_/g')
%endif
%if 0%{?require_kver:1}
-%define buildrequires %{kdev}=%{kver}
+%define buildrequires %{kdevpkg}=%{kverpkg}
%else
-%define buildrequires %{kdev}
+%define buildrequires %{kdevpkg}
%endif
Summary: Solaris Porting Layer
@@ -77,7 +95,7 @@ License: GPL
URL: git://eris.llnl.gov/spl.git
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
Source: %{name}-%{version}.tar.gz
-Requires: %{kstr} = %{kver}
+Requires: %{kpkg} = %{kverpkg}
BuildRequires: %{buildrequires}
%description
@@ -89,7 +107,7 @@ kstat, mutex, rwlock, taskq, thread, time, and vnode APIs.
%package devel
Summary: Solaris Porting Layer Headers and Symbols
Group: Development/Libraries
-Requires: %{kstr} = %{kver}
+Requires: %{kpkg} = %{kverpkg}
BuildRequires: %{buildrequires}
%description devel