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.
This commit is contained in:
Brian Behlendorf 2009-08-14 14:09:16 -07:00
parent 26d77c4493
commit 73358d5a1d

View File

@ -3,6 +3,13 @@
# require_kver, require_kdir, require_obj constants for us, but if it does not # 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. # 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} %if %{defined require_kver}
%define kver %{require_kver} %define kver %{require_kver}
%endif %endif
@ -15,32 +22,51 @@
%define kobj %{require_kobj} %define kobj %{require_kobj}
%endif %endif
# kdir: Full path to the kernel source headers # SLES 10, SLES 11:
# kobj: Full path to the kernel build objects %if %{defined suse_version}
# kver: Kernel version
# kpkg: Kernel package name
# kdevpkg: Kernel devel package name
# kverpkg: Kernel package version
# SLES*:
%if %{defined sles_version}
%if %{undefined kver} %if %{undefined kver}
%define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{_target_cpu} %ifarch ppc64
%define kver %((echo X; %{__cat} %{klnk}/.kernelrelease %define kverextra ppc64
2>/dev/null) | tail -1) %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 %endif
%define kpkg kernel-%{_target_cpu}
%define kdevpkg kernel-source kernel-syms %if %{undefined kverextra}
%define kverpkg %(echo %{kver} | cut -d'-' -f1-2) %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} %if %{undefined kdir}
%define kdir %{_usrsrc}/linux-%{kverpkg} %define kdir %{_usrsrc}/linux-%{kverpkg}
%endif %endif
%if %{undefined kobj} %if %{undefined kobj}
%define kobj %{kdir}-obj/%{_target_cpu}/%{_target_cpu} %define kobj %{kdir}-obj/%{_target_cpu}/%{kverextra}
%endif %endif
# CHAOS4:
%else %else
# CHAOS 4.x:
%if %{defined ch4} %if %{defined ch4}
%if %{undefined kver} %if %{undefined kver}
%define klnk %{_usrsrc}/kernels/*/include/config %define klnk %{_usrsrc}/kernels/*/include/config
@ -50,16 +76,17 @@
%define kpkg chaos-kernel %define kpkg chaos-kernel
%define kdevpkg chaos-kernel-devel %define kdevpkg chaos-kernel-devel
%define kverpkg %{kver} %define kverpkg %{kver}
%define koppkg =
%if %{undefined kdir} %if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver} %define kdir %{_usrsrc}/kernels/%{kver}
%endif %endif
%if %{undefined kobj} %if %{undefined kobj}
%define kobj %{kdir} %define kobj %{kdir}
%endif %endif
# RHEL*/Fedora:
%else %else
%if %{defined fedora} || %{defined rhel}
# RHEL 5:
%if %{defined el5}
%if %{undefined kver} %if %{undefined kver}
%define klnk %{_usrsrc}/kernels/*/include/config %define klnk %{_usrsrc}/kernels/*/include/config
%define kver %((echo X; %{__cat} %{klnk}/kernel.release %define kver %((echo X; %{__cat} %{klnk}/kernel.release
@ -67,23 +94,43 @@
%endif %endif
%define kpkg kernel %define kpkg kernel
%define kdevpkg kernel-devel %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} %if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver} %define kdir %{_usrsrc}/kernels/%{kver}
%endif %endif
%if %{undefined kobj} %if %{undefined kobj}
%define kobj %{kdir} %define kobj %{kdir}
%endif %endif
%else %else
# Unsupported distro: # Unsupported distro:
%if %{undefined kver} %if %{undefined kver}
%define kver X %define kver X
%endif %endif
%define kpkg kernel %define kpkg kernel
%define kdevpkg kernel-devel %define kdevpkg kernel-devel
%define kverpkg %{kver} %define kverpkg %{kver}
%define koppkg =
%if %{undefined kdir} %if %{undefined kdir}
%define kdir %{_usrsrc}/kernels/%{kver} %define kdir %{_usrsrc}/kernels/%{kver}
%endif %endif
@ -94,13 +141,13 @@
%endif %endif
%endif %endif
%endif %endif
%endif
# Distro agnostic: # Distro agnostic:
%define name @PACKAGE@-modules %define name @PACKAGE@-modules
%define version @VERSION@ %define version @VERSION@
%define debug_package %{nil} %define debug_package %{nil}
# The kernel version should only be appended to a binary RPM. When # The kernel version should only be appended to a binary RPM. When
# building a source RPM it must be kernel version agnostic. This means # building a source RPM it must be kernel version agnostic. This means
# the source RPM must never specify a required kernel version, but the # the source RPM must never specify a required kernel version, but the
@ -111,7 +158,7 @@
%else %else
%define relext %(echo %{kverpkg} | %{__sed} -e 's/-/_/g') %define relext %(echo %{kverpkg} | %{__sed} -e 's/-/_/g')
%define release @SPL_META_RELEASE@_%{relext} %define release @SPL_META_RELEASE@_%{relext}
%define requires %{kpkg} = %{kverpkg} %define requires %{kpkg} %{koppkg} %{kverpkg}
%endif %endif
Summary: Solaris Porting Layer Modules Summary: Solaris Porting Layer Modules