1 # The following block is used to allow the source RPM to be rebuilt
2 # against specific kernels. It is preferable that rpmbuild define the
3 # require_kver, require_kdir, require_obj constants for us, but if it does not
4 # not we attempt to determine the correct values based on your distro.
6 # kdir: Full path to the kernel source headers
7 # kobj: Full path to the kernel build objects
9 # kpkg: Kernel package name
10 # kdevpkg: Kernel devel package name
11 # kverpkg: Kernel package version
13 %if %{defined require_kver}
14 %define kver %{require_kver}
17 %if %{defined require_kdir}
18 %define kdir %{require_kdir}
21 %if %{defined require_kobj}
22 %define kobj %{require_kobj}
26 %if %{defined suse_version}
29 %define kverextra ppc64
31 %define kverextra default
34 %if %{suse_version} >= 1100
35 %define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{kverextra}
36 %define krelease %{klnk}/include/config/kernel.release
38 %define klnk %{_usrsrc}/linux-obj/%{_target_cpu}/%{kverextra}
39 %define krelease %{klnk}/.kernelrelease
42 %define kver %((echo X; %{__cat} %{krelease} 2>/dev/null)|tail -1)
45 %if %{undefined kverextra}
46 %define kverextra %(echo %{kver} | cut -f3 -d'-')
49 %define kpkg kernel-%{kverextra}
50 %define kdevpkg kernel-source
51 %define kverpkg %(echo %{kver} | %{__sed} -e 's/-%{kverextra}//g')
53 # The kernel and rpm versions do not strictly match under SLES11
54 # e.g. kernel version 2.6.27.19-5 != rpm version 2.6.27.19-5.1
55 %if %{suse_version} >= 1100
62 %define kdir %{_usrsrc}/linux-%{kverpkg}
65 %define kobj %{kdir}-obj/%{_target_cpu}/%{kverextra}
70 %if %{defined ch4} || %{defined ch5}
72 %define klnk %{_usrsrc}/kernels/*/include/config
73 %define kver %((echo X; %{__cat} %{klnk}/kernel.release
74 2>/dev/null) | tail -1)
76 %define kpkg chaos-kernel
77 %define kdevpkg chaos-kernel-devel
78 %define kverpkg %{kver}
81 %define kdir %{_usrsrc}/kernels/%{kver}
89 %if %{defined el5} || %{defined el6}
91 %define klnk %{_usrsrc}/kernels/*/include/config
92 %define kver %((echo X; %{__cat} %{klnk}/kernel.release
93 2>/dev/null) | tail -1)
96 %define kdevpkg kernel-devel
98 %define kverpkg %(echo %{kver} | %{__sed} -e 's/.%{_target_cpu}//g')
100 %define kverpkg %{kver}
103 %if %{undefined kdir}
104 %define kdir %{_usrsrc}/kernels/%{kver}-%{_target_cpu}
106 %if %{undefined kobj}
112 %if %{defined fedora}
113 %if %{undefined kver}
114 %define klnk %{_usrsrc}/kernels/*/include/config
115 %define kver %((echo X; %{__cat} %{klnk}/kernel.release
116 2>/dev/null) | tail -1)
119 %define kdevpkg kernel-devel
120 %define kverpkg %(echo %{kver} | %{__sed} -e 's/.%{_target_cpu}//g')
122 %if %{undefined kdir}
123 %define kdir %{_usrsrc}/kernels/%{kver}
125 %if %{undefined kobj}
130 # Unsupported distro:
131 %if %{undefined kver}
132 %define kver %(uname -r)
134 %define kverpkg %{kver}
135 %if %{undefined kdir}
136 %define kdir /lib/modules/%{kver}/build
138 %if %{undefined kobj}
147 # spldir: Full path to the spl source headers
148 # splobj: Full path to the spl build objects
149 # splver: Spl version
150 # splpkg: Spl package name
151 # spldevpkg: Spl devel package name
152 # splverpkg: Spl package version
154 %if %{defined require_splver}
155 %define splver %{require_splver}
158 %if %{defined require_spldir}
159 %define spldir %{require_spldir}
162 %if %{defined require_splobj}
163 %define splobj %{require_splobj}
166 %if %{undefined splver}
167 %define spllnk %{_usrsrc}/spl-*/%{kver}
168 %define splver %((echo X; %{__cat} %{spllnk}/spl.release
169 2>/dev/null) | tail -1)
171 %define splpkg spl-modules
172 %define spldevpkg spl-modules-devel
173 %define splverpkg %{splver}
174 %if %{undefined spldir}
175 %define spldir %{_usrsrc}/spl-%{splver}/%{kver}
177 %if %{undefined splobj}
178 %define splobj %{spldir}/module
183 %define name @PACKAGE@-modules
184 %define version @VERSION@
185 %define debug_package %{nil}
187 # The kernel version should only be appended to a binary RPM. When
188 # building a source RPM it must be kernel version agnostic. This means
189 # the source RPM must never specify a required kernel version, but the
190 # final RPM should be keyed to the kernel version it was built against.
191 %if %{defined build_src_rpm}
192 %define release @ZFS_META_RELEASE@
194 %define krequires %{kpkg}
196 %define splrequires %{splpkg}
198 %define relext %(echo %{kverpkg} | %{__sed} -e 's/-/_/g')
199 %define release @ZFS_META_RELEASE@_%{relext}
201 %define krequires %{kpkg} %{koppkg} %{kverpkg}
203 %define splrequires %{splpkg} = %{splverpkg}
206 Summary: ZFS File System
207 Group: Utilities/System
212 URL: git://eris.llnl.gov/zfs.git
213 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-%(%{__id} -un)
214 Source: @PACKAGE@-%{version}.tar.gz
215 %if %{defined krequires}
216 Requires: %{krequires}
218 %if %{defined kdevpkg}
219 BuildRequires: %{kdevpkg}
221 Requires: %{splrequires}
222 BuildRequires: %{spldevpkg}
225 The %{name} package contains kernel modules and support utilities for
226 the %{name} file system.
229 Summary: ZFS File System Headers and Symbols
230 Group: Development/Libraries
231 %if %{defined krequires}
232 Requires: %{krequires}
234 Requires: %{splrequires}
235 %if %{defined kdevpkg}
236 BuildRequires: %{kdevpkg}
238 BuildRequires: %{spldevpkg}
241 The %{name}-devel package contains the kernel header files and
242 Module.symvers symbols needed for building additional modules
246 %setup -n @PACKAGE@-%{version}
248 %configure --with-linux=%{kdir} --with-linux-obj=%{kobj} \
249 --with-spl=%{spldir} --with-spl-obj=%{splobj} \
254 rm -rf $RPM_BUILD_ROOT
255 make DESTDIR=$RPM_BUILD_ROOT install
258 rm -rf $RPM_BUILD_ROOT
261 %defattr(-, root, root)
265 %defattr(-,root,root)
269 if [ -f /boot/System.map-%{kver} ]; then
270 depmod -ae -F /boot/System.map-%{kver} %{kver} || exit 0
272 depmod -ae %{kver} || exit 0
276 if [ -f /boot/System.map-%{kver} ]; then
277 depmod -ae -F /boot/System.map-%{kver} %{kver} || exit 0
279 depmod -ae %{kver} || exit 0