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 INSTALL=/usr/bin/install
modules clean: modules clean:
$(MAKE) -C @LINUX@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@ $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` @KERNELMAKE_PARAMS@ $@
modules_install: modules_install:
$(MAKE) -C @LINUX@ SUBDIRS=`pwd` \ $(MAKE) -C @LINUX_OBJ@ SUBDIRS=`pwd` \
INSTALL_MOD_PATH=$(DESTDIR) INSTALL_MOD_DIR=addon $@ INSTALL_MOD_PATH=$(DESTDIR) \
INSTALL_MOD_DIR=addon/spl $@
find ${DESTDIR}/lib/modules/ -name 'modules.*' | xargs ${RM}
distdir: distdir:
list='$(subdir-m)'; for subdir in $$list; do \ 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 # The following block is used to allow the source RPM to be rebuilt
# against arbitrary kernels. It ensure the release name is correct # against specific kernels. It is preferable that rpmbuild define the
# and the proper build/install requires are set. # 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: %define kver %{require_kver}}
# require_kver: Ideally defined to match the kernel. %{?require_kdir: %define kdir %{require_kdir}}
# !require_kver: A best guess is made. %{?require_kobj: %define kobj %{require_kobj}}
%if 0%{?require_kdir:1}
%if 0%{?require_kver:1} # kdir: Full path to the kernel source headers
%define kver %{require_kver} # kobj: Full path to the kernel build objects
%define kdir %{require_kdir} # kver: Kernel version
%else # kpkg: Kernel package name
%{!?require_kobj: %define require_kobj %{require_kdir}} # kdevpkg: Kernel devel package name
%define kdir %{require_kdir} # kverpkg: Kernel package version
%define kuts %{require_kobj}/include/linux/utsrelease.h \
%{require_kobj}/include/linux/version.h # SLES*:
%define kver %((grep UTS_RELEASE %{kuts}) | cut -f2 -d'"' | tail -1) %if %{defined sles_version}
%if %{undefined kver}
%define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{_target_cpu}
%define kver %(%{__cat} %{klnk}/.kernelrelease)
%endif %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: # CHAOS4:
# require_kver: Locate the requested kernel in default dirs.
# !require_kver: Locate the newest kernel in default dirs.
%else %else
%if 0%{?require_kver:1} %if %{defined ch4}
%define kver %{require_kver} %if %{undefined kver}
%define kdef %{_prefix}/src/kernels/%{kver} %{_prefix}/src/linux-%{kver} %define klnk %{_usrsrc}/kernels/*/include/config
%define kdir %((echo X; ls -1d %kdef 2>/dev/null)|sed -e 's/linux-//'|tail -1) %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 %else
%define kdef %{_prefix}/src/kernels/* %{_prefix}/src/linux-* %if %{defined fedora} || %{defined rhel}
%define kdir %((echo X; ls -1d %kdef 2>/dev/null)|sed -e 's/linux-//'|tail -1) %if %{undefined kver}
%define kver %(basename %{kdir}) %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
%endif %endif
# Kernel objects may not be located with the source. Assume # Distro agnostic:
# 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
%define debug_package %{nil} %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 name @PACKAGE@
%define version @VERSION@ %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 %if %{?build_src_rpm:1}0
%define release @SPL_META_RELEASE@ %define release @SPL_META_RELEASE@
%else %else
%define release @SPL_META_RELEASE@_%(echo %{kver} | sed -e 's/-/_/g') %define release @SPL_META_RELEASE@_%(echo %{kverpkg} | %{__sed} -e 's/-/_/g')
%endif %endif
%if 0%{?require_kver:1} %if 0%{?require_kver:1}
%define buildrequires %{kdev}=%{kver} %define buildrequires %{kdevpkg}=%{kverpkg}
%else %else
%define buildrequires %{kdev} %define buildrequires %{kdevpkg}
%endif %endif
Summary: Solaris Porting Layer Summary: Solaris Porting Layer
@ -77,7 +95,7 @@ License: GPL
URL: git://eris.llnl.gov/spl.git URL: git://eris.llnl.gov/spl.git
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n) BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id_u} -n)
Source: %{name}-%{version}.tar.gz Source: %{name}-%{version}.tar.gz
Requires: %{kstr} = %{kver} Requires: %{kpkg} = %{kverpkg}
BuildRequires: %{buildrequires} BuildRequires: %{buildrequires}
%description %description
@ -89,7 +107,7 @@ kstat, mutex, rwlock, taskq, thread, time, and vnode APIs.
%package devel %package devel
Summary: Solaris Porting Layer Headers and Symbols Summary: Solaris Porting Layer Headers and Symbols
Group: Development/Libraries Group: Development/Libraries
Requires: %{kstr} = %{kver} Requires: %{kpkg} = %{kverpkg}
BuildRequires: %{buildrequires} BuildRequires: %{buildrequires}
%description devel %description devel