1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
|
# The following block is used to allow the source RPM to be rebuilt
# 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}
%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}}
# CHAOS4:
%else
%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
%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
# Distro agnostic:
%define debug_package %{nil}
%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 %{kverpkg} | %{__sed} -e 's/-/_/g')
%endif
%if 0%{?require_kver:1}
%define buildrequires %{kdevpkg}=%{kverpkg}
%else
%define buildrequires %{kdevpkg}
%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: %{kpkg} = %{kverpkg}
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: %{kpkg} = %{kverpkg}
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
|