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.
This commit is contained in:
Brian Behlendorf 2009-06-25 15:31:53 -07:00
parent 762b96f6c6
commit 31b2e0b070
2 changed files with 74 additions and 54 deletions

View File

@ -4,11 +4,13 @@ subdir-m += splat
INSTALL=/usr/bin/install
modules clean:
$(MAKE) -C @LINUX@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
modules_install:
$(MAKE) -C @LINUX@ SUBDIRS=`pwd` \
INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=addon $@
$(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
INSTALL_MOD_PATH=$(DESTDIR) \
INSTALL_MOD_DIR=addon/spl $@
find ${DESTDIR}/lib/modules/ -name 'modules.*' | xargs ${RM}
distdir:
list='$(subdir-m)'; for subdir in $$list; do \

View File

@ -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.
# 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.
# 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)
%{?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}}
# 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.
# CHAOS4:
%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)
%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
%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})
%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}}
%else
# 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
# 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
%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