From 73358d5a1dc6278fd20eed0a9872c0b1572caacc Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 14 Aug 2009 14:09:16 -0700 Subject: [PATCH] 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. --- spl-modules.spec.in | 105 ++++++++++++++++++++++++++++++++------------ 1 file changed, 76 insertions(+), 29 deletions(-) diff --git a/spl-modules.spec.in b/spl-modules.spec.in index e18a3bfbc..7740d9422 100644 --- a/spl-modules.spec.in +++ b/spl-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,32 +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*: -%if %{defined sles_version} +# SLES 10, SLES 11: +%if %{defined suse_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) + %ifarch ppc64 + %define kverextra ppc64 + %else + %define kverextra default + %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 + + %define kver %((echo X; %{__cat} %{krelease} 2>/dev/null)|tail -1) %endif - %define kpkg kernel-%{_target_cpu} - %define kdevpkg kernel-source kernel-syms - %define kverpkg %(echo %{kver} | cut -d'-' -f1-2) + + %if %{undefined kverextra} + %define kverextra %(echo %{kver} | cut -f3 -d'-') + %endif + + %define kpkg kernel-%{kverextra} + %define kdevpkg kernel-source + %define kverpkg %(echo %{kver} | %{__sed} -e 's/-%{kverextra}//g') + + # 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 + %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 @@ -50,16 +76,17 @@ %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 - -# RHEL*/Fedora: %else -%if %{defined fedora} || %{defined rhel} + +# RHEL 5: +%if %{defined el5} %if %{undefined kver} %define klnk %{_usrsrc}/kernels/*/include/config %define kver %((echo X; %{__cat} %{klnk}/kernel.release @@ -67,23 +94,43 @@ %endif %define kpkg kernel %define kdevpkg kernel-devel - %define kverpkg %(echo %{kver} | cut -d'.' -f1-7) + %define kverpkg %{kver} + %define koppkg = + %if %{undefined kdir} + %define kdir %{_usrsrc}/kernels/%{kver}-%{_target_cpu} + %endif + %if %{undefined kobj} + %define kobj %{kdir} + %endif +%else + +# Fedora 11: +%if %{defined fedora} + %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 %(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 @@ -94,13 +141,13 @@ %endif %endif %endif +%endif # Distro agnostic: %define name @PACKAGE@-modules %define version @VERSION@ %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. This means # the source RPM must never specify a required kernel version, but the @@ -111,7 +158,7 @@ %else %define relext %(echo %{kverpkg} | %{__sed} -e 's/-/_/g') %define release @SPL_META_RELEASE@_%{relext} -%define requires %{kpkg} = %{kverpkg} +%define requires %{kpkg} %{koppkg} %{kverpkg} %endif Summary: Solaris Porting Layer Modules