summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2009-08-14 16:22:20 -0700
committerBrian Behlendorf <[email protected]>2009-08-14 16:22:20 -0700
commit6857a2e5a07a5970443ecccef09b31d3ee0fe8ef (patch)
tree733acabb199f810b501b73ffce2b6416953dfebb
parent503a1a983c4e1fae1198373e440c429d0ec68627 (diff)
Various spec file tweaks to handle rpm building of several distros.
Supported and tested distros now include SLES10, SLES11, Chaos 4.x, RHEL5, and Fedora 11. This update was mainly to address rebuildable kernel module rpms, and correct rpm dependencies for each distro.
-rw-r--r--zfs-modules.spec.in133
1 files changed, 90 insertions, 43 deletions
diff --git a/zfs-modules.spec.in b/zfs-modules.spec.in
index 0af1a01bd..09956b3ab 100644
--- a/zfs-modules.spec.in
+++ b/zfs-modules.spec.in
@@ -3,6 +3,13 @@
# 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.
+# 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
+
%if %{defined require_kver}
%define kver %{require_kver}
%endif
@@ -15,51 +22,51 @@
%define kobj %{require_kobj}
%endif
-# 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 10, SLES 11:
+%if %{defined suse_version}
+ %if %{undefined kver}
+ %ifarch ppc64
+ %define kverextra ppc64
+ %else
+ %define kverextra default
+ %endif
-%if %{defined require_splver}
-%define splver %{require_splver}
-%endif
+ %if %{suse_version} >= 1100
+ %define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{kverextra}
+ %define krelease %{klnk}/include/config/kernel.release
+ %else
+ %define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{kverextra}
+ %define krelease %{klnk}/.kernelrelease
+ %endif
-%if %{defined require_spldir}
-%define spldir %{require_spldir}
-%endif
+ %define kver %((echo X; %{__cat} %{krelease} 2>/dev/null)|tail -1)
+ %endif
-%if %{defined require_splobj}
-%define splobj %{require_splobj}
-%endif
+ %if %{undefined kverextra}
+ %define kverextra %(echo %{kver} | cut -f3 -d'-')
+ %endif
-# spldir: Full path to the spl source headers
-# splobj: Full path to the spl build objects
-# splver: Spl version
-# splpkg: Spl package name
-# spldevpkg: Spl devel package name
-# splverpkg: Spl package version
+ %define kpkg kernel-%{kverextra}
+ %define kdevpkg kernel-source
+ %define kverpkg %(echo %{kver} | %{__sed} -e 's/-%{kverextra}//g')
-# SLES*:
-%if %{defined sles_version}
- %if %{undefined kver}
- %define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{_target_cpu}
- %define kver %((echo X; %{__cat} %{klnk}/.kernelrelease
- 2>/dev/null) | tail -1)
+ # The kernel and rpm versions do not strictly match under SLES11
+ # e.g. kernel version 2.6.27.19-5 != rpm version 2.6.27.19-5.1
+ %if %{suse_version} >= 1100
+ %define koppkg >=
+ %else
+ %define koppkg =
%endif
- %define kpkg kernel-%{_target_cpu}
- %define kdevpkg kernel-source kernel-syms
- %define kverpkg %(echo %{kver} | cut -d'-' -f1-2)
+
%if %{undefined kdir}
%define kdir %{_usrsrc}/linux-%{kverpkg}
%endif
%if %{undefined kobj}
- %define kobj %{kdir}-obj/%{_target_cpu}/%{_target_cpu}
+ %define kobj %{kdir}-obj/%{_target_cpu}/%{kverextra}
%endif
-
-# CHAOS4:
%else
+
+# CHAOS 4.x:
%if %{defined ch4}
%if %{undefined kver}
%define klnk %{_usrsrc}/kernels/*/include/config
@@ -69,16 +76,36 @@
%define kpkg chaos-kernel
%define kdevpkg chaos-kernel-devel
%define kverpkg %{kver}
+ %define koppkg =
%if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver}
%endif
%if %{undefined kobj}
%define kobj %{kdir}
%endif
+%else
-# RHEL*/Fedora:
+# RHEL 5:
+%if %{defined el5}
+ %if %{undefined kver}
+ %define klnk %{_usrsrc}/kernels/*/include/config
+ %define kver %((echo X; %{__cat} %{klnk}/kernel.release
+ 2>/dev/null) | tail -1)
+ %endif
+ %define kpkg kernel
+ %define kdevpkg kernel-devel
+ %define kverpkg %{kver}
+ %define koppkg =
+ %if %{undefined kdir}
+ %define kdir %{_usrsrc}/kernels/%{kver}-%{_target_cpu}
+ %endif
+ %if %{undefined kobj}
+ %define kobj %{kdir}
+ %endif
%else
-%if %{defined fedora} || %{defined rhel}
+
+# Fedora 11:
+%if %{defined fedora}
%if %{undefined kver}
%define klnk %{_usrsrc}/kernels/*/include/config
%define kver %((echo X; %{__cat} %{klnk}/kernel.release
@@ -86,23 +113,24 @@
%endif
%define kpkg kernel
%define kdevpkg kernel-devel
- %define kverpkg %(echo %{kver} | cut -d'.' -f1-7)
+ %define kverpkg %(echo %{kver} | %{__sed} -e 's/.%{_target_cpu}//g')
+ %define koppkg =
%if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver}
%endif
%if %{undefined kobj}
%define kobj %{kdir}
%endif
-
%else
# Unsupported distro:
%if %{undefined kver}
- %define kver X
+ %define kver X
%endif
- %define kpkg kernel
- %define kdevpkg kernel-devel
- %define kverpkg %{kver}
+ %define kpkg kernel
+ %define kdevpkg kernel-devel
+ %define kverpkg %{kver}
+ %define koppkg =
%if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver}
%endif
@@ -113,8 +141,27 @@
%endif
%endif
%endif
+%endif
+
+# spldir: Full path to the spl source headers
+# splobj: Full path to the spl build objects
+# splver: Spl version
+# splpkg: Spl package name
+# spldevpkg: Spl devel package name
+# splverpkg: Spl package version
+
+%if %{defined require_splver}
+%define splver %{require_splver}
+%endif
+
+%if %{defined require_spldir}
+%define spldir %{require_spldir}
+%endif
+
+%if %{defined require_splobj}
+%define splobj %{require_splobj}
+%endif
-# SPL package dependencies
%if %{undefined splver}
%define spllnk %{_usrsrc}/spl-*/%{kver}
%define splver %((echo X; %{__cat} %{spllnk}/spl.release
@@ -148,7 +195,7 @@
%else
%define relext %(echo %{kverpkg} | %{__sed} -e 's/-/_/g')
%define release @ZFS_META_RELEASE@_%{relext}
-%define krequires %{kpkg} = %{kverpkg}
+%define krequires %{kpkg} %{koppkg} %{kverpkg}
%define splrequires %{splpkg} = %{splverpkg}
%endif