2009-03-05 17:08:07 +00:00
|
|
|
# The following block is used to allow the source RPM to be rebuilt
|
2009-06-25 22:31:53 +00:00
|
|
|
# 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.
|
|
|
|
|
|
|
|
%{?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}
|
2009-06-26 16:40:14 +00:00
|
|
|
%define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{_target_cpu}
|
2009-06-26 19:43:27 +00:00
|
|
|
%define kver %((echo X; %{__cat} %{klnk}/.kernelrelease
|
2009-06-26 17:34:40 +00:00
|
|
|
2>/dev/null) | tail -1)
|
|
|
|
%endif
|
2009-06-25 22:31:53 +00:00
|
|
|
%define kpkg kernel-%{_target_cpu}
|
|
|
|
%define kdevpkg kernel-source kernel-syms
|
|
|
|
%define kverpkg %(echo %{kver} | cut -d'-' -f1-2)
|
2009-06-26 17:34:40 +00:00
|
|
|
%if %{undefined kdir}
|
|
|
|
%define kdir %{_usrsrc}/linux-%{kverpkg}
|
|
|
|
%endif
|
|
|
|
%if %{undefined kobj}
|
|
|
|
%define kobj %{kdir}-obj/%{_target_cpu}/%{_target_cpu}
|
|
|
|
%endif
|
2009-06-25 22:31:53 +00:00
|
|
|
|
|
|
|
# CHAOS4:
|
2009-06-16 17:44:59 +00:00
|
|
|
%else
|
2009-06-25 22:31:53 +00:00
|
|
|
%if %{defined ch4}
|
|
|
|
%if %{undefined kver}
|
2009-06-26 16:40:14 +00:00
|
|
|
%define klnk %{_usrsrc}/kernels/*/include/config
|
2009-06-26 19:43:27 +00:00
|
|
|
%define kver %((echo X; %{__cat} %{klnk}/kernel.release
|
2009-06-26 17:34:40 +00:00
|
|
|
2>/dev/null) | tail -1)
|
|
|
|
%endif
|
2009-06-25 22:31:53 +00:00
|
|
|
%define kpkg chaos-kernel
|
|
|
|
%define kdevpkg chaos-kernel-devel
|
|
|
|
%define kverpkg %{kver}
|
2009-06-26 17:34:40 +00:00
|
|
|
%if %{undefined kdir}
|
|
|
|
%define kdir %{_usrsrc}/kernels/%{kver}
|
|
|
|
%endif
|
|
|
|
%if %{undefined kobj}
|
|
|
|
%define kobj %{kdir}
|
|
|
|
%endif
|
2009-06-25 22:31:53 +00:00
|
|
|
|
|
|
|
# RHEL*/Fedora:
|
2009-06-16 17:44:59 +00:00
|
|
|
%else
|
2009-06-25 22:31:53 +00:00
|
|
|
%if %{defined fedora} || %{defined rhel}
|
|
|
|
%if %{undefined kver}
|
2009-06-26 16:40:14 +00:00
|
|
|
%define klnk %{_usrsrc}/kernels/*/include/config
|
2009-06-26 19:43:27 +00:00
|
|
|
%define kver %((echo X; %{__cat} %{klnk}/kernel.release
|
2009-06-26 17:34:40 +00:00
|
|
|
2>/dev/null) | tail -1)
|
2009-06-25 22:31:53 +00:00
|
|
|
%endif
|
|
|
|
%define kpkg kernel
|
|
|
|
%define kdevpkg kernel-devel
|
|
|
|
%define kverpkg %(echo %{kver} | cut -d'.' -f1-7)
|
2009-06-26 17:34:40 +00:00
|
|
|
%if %{undefined kdir}
|
|
|
|
%define kdir %{_usrsrc}/kernels/%{kver}
|
|
|
|
%endif
|
|
|
|
%if %{undefined kobj}
|
|
|
|
%define kobj %{kdir}
|
|
|
|
%endif
|
2009-06-16 17:44:59 +00:00
|
|
|
|
2009-03-05 17:08:07 +00:00
|
|
|
%else
|
|
|
|
|
2009-06-25 22:31:53 +00:00
|
|
|
# Unsupported distro:
|
2009-06-26 17:34:40 +00:00
|
|
|
%if %{undefined kver}
|
2009-06-26 19:43:27 +00:00
|
|
|
%define kver X
|
2009-06-26 17:34:40 +00:00
|
|
|
%endif
|
|
|
|
%define kpkg kernel
|
|
|
|
%define kdevpkg kernel-devel
|
|
|
|
%define kverpkg %{kver}
|
|
|
|
%if %{undefined kdir}
|
|
|
|
%define kdir %{_usrsrc}/kernels/%{kver}
|
|
|
|
%endif
|
|
|
|
%if %{undefined kobj}
|
|
|
|
%define kobj %{kdir}
|
|
|
|
%endif
|
2009-06-25 22:31:53 +00:00
|
|
|
|
|
|
|
%endif
|
|
|
|
%endif
|
2009-03-05 17:08:07 +00:00
|
|
|
%endif
|
|
|
|
|
2009-06-25 22:31:53 +00:00
|
|
|
# Distro agnostic:
|
2009-06-26 18:37:06 +00:00
|
|
|
%define name @PACKAGE@
|
|
|
|
%define version @VERSION@
|
|
|
|
%define debug_package %{nil}
|
2009-03-05 17:08:07 +00:00
|
|
|
|
2009-06-26 19:43:27 +00:00
|
|
|
|
2009-06-26 18:37:06 +00:00
|
|
|
# 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
|
|
|
|
# final RPM should be keyed to the kernel version it was built against.
|
2009-06-25 23:11:13 +00:00
|
|
|
%if %{defined build_src_rpm}
|
2009-06-26 18:37:06 +00:00
|
|
|
%define release @SPL_META_RELEASE@
|
|
|
|
%define requires %{kpkg}
|
2009-03-05 17:08:07 +00:00
|
|
|
%else
|
2009-06-26 19:43:27 +00:00
|
|
|
%define relext %(echo %{kverpkg} | %{__sed} -e 's/-/_/g')
|
|
|
|
%define release @SPL_META_RELEASE@_%{relext}
|
2009-06-26 18:37:06 +00:00
|
|
|
%define requires %{kpkg} = %{kverpkg}
|
2009-03-05 17:08:07 +00:00
|
|
|
%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
|
2009-06-26 16:40:14 +00:00
|
|
|
Requires: %{requires}
|
2009-06-26 19:43:27 +00:00
|
|
|
BuildRequires: %{kdevpkg}
|
2009-03-05 17:08:07 +00:00
|
|
|
|
|
|
|
%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
|
2009-06-26 16:40:14 +00:00
|
|
|
Requires: %{requires}
|
2009-06-26 19:43:27 +00:00
|
|
|
BuildRequires: %{kdevpkg}
|
2009-03-05 17:08:07 +00:00
|
|
|
|
|
|
|
%description devel
|
2009-06-16 18:34:28 +00:00
|
|
|
The %{name}-devel package contains the header files and Module{s}.symvers
|
2009-03-05 17:08:07 +00:00
|
|
|
symbols needed for building additional modules which use %{name}.
|
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup
|
|
|
|
%build
|
2009-06-16 17:44:59 +00:00
|
|
|
%configure --with-linux=%{kdir} --with-linux-obj=%{kobj}
|
2009-03-05 17:08:07 +00:00
|
|
|
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)
|
2009-06-16 17:44:59 +00:00
|
|
|
%{_prefix}/src/*
|
2009-03-05 17:08:07 +00:00
|
|
|
|
|
|
|
%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
|