mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 18:11:00 +03:00
2e0e7e6976
- Allow checking for exported symbols in both Module.symvers and Module.symvers. My stock SLES kernel ships an objects directory with Module.symvers, yet produces a Module.symvers in the local build directory.
135 lines
3.8 KiB
RPMSpec
135 lines
3.8 KiB
RPMSpec
# 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.
|
|
|
|
# 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)
|
|
%endif
|
|
|
|
# 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.
|
|
%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)
|
|
%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})
|
|
%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
|
|
|
|
%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@
|
|
|
|
%if %{?build_src_rpm:1}0
|
|
%define release @SPL_META_RELEASE@
|
|
%else
|
|
%define release @SPL_META_RELEASE@_%(echo %{kver} | sed -e 's/-/_/g')
|
|
%endif
|
|
|
|
%if 0%{?require_kver:1}
|
|
%define buildrequires %{kdev}=%{kver}
|
|
%else
|
|
%define buildrequires %{kdev}
|
|
%endif
|
|
|
|
Summary: Solaris Porting Layer
|
|
Group: Utilities/System
|
|
Name: %{name}
|
|
Version: %{version}
|
|
Release: %{release}
|
|
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}
|
|
BuildRequires: %{buildrequires}
|
|
|
|
%description
|
|
The %{name} package contains kernel modules and support utilities for
|
|
emulating Solaris style primatives in the linux kernel. These include,
|
|
but are not limited too, atomic, condvar, debug, error, memory, kobject,
|
|
kstat, mutex, rwlock, taskq, thread, time, and vnode APIs.
|
|
|
|
%package devel
|
|
Summary: Solaris Porting Layer Headers and Symbols
|
|
Group: Development/Libraries
|
|
Requires: %{kstr} = %{kver}
|
|
BuildRequires: %{buildrequires}
|
|
|
|
%description devel
|
|
The %{name}-devel package contains the header files and Module{s}.symvers
|
|
symbols needed for building additional modules which use %{name}.
|
|
|
|
%prep
|
|
%setup
|
|
%build
|
|
%configure --with-linux=%{kdir} --with-linux-obj=%{kobj}
|
|
make
|
|
|
|
%install
|
|
rm -rf $RPM_BUILD_ROOT
|
|
make DESTDIR=$RPM_BUILD_ROOT install
|
|
|
|
%clean
|
|
rm -rf $RPM_BUILD_ROOT
|
|
|
|
%files
|
|
%defattr(-, root, root)
|
|
%doc AUTHORS ChangeLog COPYING DISCLAIMER INSTALL
|
|
%{_sbindir}/*
|
|
/lib/modules/*
|
|
|
|
%files devel
|
|
%defattr(-,root,root)
|
|
%{_prefix}/src/*
|
|
|
|
%post
|
|
if [ -f /boot/System.map-%{kver} ]; then
|
|
depmod -ae -F /boot/System.map-%{kver} %{kver} || exit 0
|
|
else
|
|
depmod -ae %{kver} || exit 0
|
|
fi
|
|
|
|
%postun
|
|
if [ -f /boot/System.map-%{kver} ]; then
|
|
depmod -ae -F /boot/System.map-%{kver} %{kver} || exit 0
|
|
else
|
|
depmod -ae %{kver} || exit 0
|
|
fi
|