1 |
# Please keep this package in sync with FC |
2 |
|
3 |
%define major 3.0 |
4 |
|
5 |
%define libname %mklibname %{name} %{major} |
6 |
%define develname %mklibname %{name} -d |
7 |
|
8 |
# Build a debug hypervisor only if rpmbuild was run with --with debug |
9 |
%define build_debug %{?_with_debug: 1} %{?!_with_debug: 0} |
10 |
# Build ocaml bits unless rpmbuild was run with --without ocaml |
11 |
# or ocamlopt is missing (the xen makefile doesn't build ocaml bits if it isn't there) |
12 |
%define with_ocaml %{?_without_ocaml: 0} %{?!_without_ocaml: 1} |
13 |
%define build_ocaml %(test -x %{_bindir}/ocamlopt && echo %{with_ocaml} || echo 0) |
14 |
%define build_docs 0 |
15 |
# Build with stubdom unless rpmbuild was run with --without stubdom |
16 |
%define build_stubdom %{?_without_stubdom: 0} %{?!_without_stubdom: 1} |
17 |
# Only build with qemu-traditional if rpmbuild was run with --with qemutrad |
18 |
%define build_qemutrad %{?_with_qemutrad: 1} %{?!_with_qemutrad: 0} |
19 |
# build with ovmf from edk2-ovmf unless rpmbuild was run with --without ovmf |
20 |
%define build_ovmf %{?_without_ovmf: 0} %{?!_without_ovmf: 1} |
21 |
# set to 0 for archs that don't use qemu or ovmf (reduces build dependencies) |
22 |
%ifnarch x86_64 %{ix86} |
23 |
%define build_qemutrad 0 |
24 |
%define build_ovmf 0 |
25 |
%endif |
26 |
# Build with xen hypervisor unless rpmbuild was run with --without hyp |
27 |
%define build_hyp %{?_without_hyp: 0} %{?!_without_hyp: 1} |
28 |
# build xsm support unless rpmbuild was run with --without xsm |
29 |
# or required packages are missing |
30 |
%define with_xsm %{?_without_xsm: 0} %{?!_without_xsm: 1} |
31 |
%define build_xsm %(test -x %{_bindir}/checkpolicy && test -x %{_bindir}/m4 && echo %{with_xsm} || echo 0) |
32 |
# cross compile 64-bit hypervisor on ix86 unless rpmbuild was run |
33 |
# with --without crosshyp |
34 |
%define build_crosshyp %{?_without_crosshyp: 0} %{?!_without_crosshyp: 1} |
35 |
%ifnarch %{ix86} |
36 |
%define build_crosshyp 0 |
37 |
%else |
38 |
%if ! %build_crosshyp |
39 |
%define build_hyp 0 |
40 |
%endif |
41 |
%endif |
42 |
# no point in trying to build xsm on ix86 without a hypervisor |
43 |
%if ! %build_hyp |
44 |
%define build_xsm 0 |
45 |
%endif |
46 |
%ifnarch %arm |
47 |
%define build_xsm 0 |
48 |
%endif |
49 |
# build an efi boot image (where supported) unless rpmbuild was run with |
50 |
# --without efi |
51 |
%define build_efi %{?_without_efi: 0} %{?!_without_efi: 1} |
52 |
# xen only supports efi boot images on x86_64 or aarch64 |
53 |
# i686 builds a x86_64 hypervisor so add that as well |
54 |
%ifnarch x86_64 aarch64 %{ix86} |
55 |
%define build_efi 0 |
56 |
%endif |
57 |
|
58 |
# Hypervisor ABI |
59 |
%define hv_abi 4.18 |
60 |
|
61 |
%define build_tpm 0 |
62 |
%ifarch x86_64 |
63 |
%define build_tpm 1 |
64 |
%endif |
65 |
|
66 |
# disable lto |
67 |
%global _lto_cflags %{nil} |
68 |
|
69 |
Summary: Xen is a virtual machine monitor |
70 |
Name: xen |
71 |
Version: 4.18.2 |
72 |
Release: %mkrel 1 |
73 |
Group: System/Kernel and hardware |
74 |
License: GPLv2+ and LGPLv2+ and BSD |
75 |
URL: https://xen.org/ |
76 |
Source0: https://downloads.xenproject.org/release/xen/%{version}/xen-%{version}.tar.gz |
77 |
Source2: %{name}.logrotate |
78 |
# used by stubdoms |
79 |
# (from https://xenbits.xen.org/xen-extfiles/): |
80 |
Source10: lwip-1.3.0.tar.gz |
81 |
Source11: newlib-1.16.0.tar.gz |
82 |
Source12: zlib-1.2.3.tar.gz |
83 |
Source13: pciutils-2.2.9.tar.bz2 |
84 |
Source14: grub-0.97.tar.gz |
85 |
Source15: polarssl-1.1.4-gpl.tgz |
86 |
Source16: tpm_emulator-0.7.4.tar.gz |
87 |
Source17: gmp-4.3.2.tar.bz2 |
88 |
# (from https://aur.archlinux.org/xen.git) |
89 |
Source18: vtpm-gcc12-fixes.patch |
90 |
|
91 |
# .config file for xen hypervisor |
92 |
Source21: xen.hypervisor.config |
93 |
Source22: xen.hypervisor.config.debug |
94 |
|
95 |
# Fedora patches: |
96 |
Patch4: CVE-2014-0150.patch |
97 |
Patch5: xen.fedora.systemd.patch |
98 |
Patch6: xen.ocaml.selinux.fix.patch |
99 |
Patch7: xen.fedora.crypt.patch |
100 |
Patch8: qemu.trad.CVE-2015-6815.patch |
101 |
Patch9: qemu.trad.CVE-2015-5279.patch |
102 |
Patch10: qemu.trad.CVE-2015-5278.patch |
103 |
Patch11: qemu.trad.CVE-2015-7295.patch |
104 |
Patch12: qemu.trad.CVE-2015-8345.patch |
105 |
Patch13: qemu.trad.CVE-2015-7512.patch |
106 |
Patch14: qemu.trad.CVE-2015-8504.patch |
107 |
Patch15: qemu.trad.CVE-2016-1714.patch |
108 |
Patch16: qemu.trad.CVE-2016-1981.patch |
109 |
Patch17: qemu.trad.CVE-2016-2841.patch |
110 |
Patch18: qemu.trad.CVE-2016-2538.patch |
111 |
Patch19: qemu.trad.CVE-2016-2857.patch |
112 |
Patch20: qemu.trad.CVE-2016-4001.patch |
113 |
Patch21: qemu.trad.CVE-2016-4002.patch |
114 |
Patch22: qemu.trad.CVE-2016-4439.patch |
115 |
Patch23: qemu.trad.CVE-2016-4441.patch |
116 |
Patch24: qemu.trad.CVE-2016-5238.patch |
117 |
Patch25: qemu.trad.CVE-2016-5338.patch |
118 |
Patch27: qemu.trad.CVE-2016-6351.patch |
119 |
Patch29: qemu.trad.CVE-2016-8669.patch |
120 |
Patch30: qemu.trad.CVE-2016-8910.patch |
121 |
Patch31: qemu.trad.bug1399055.patch |
122 |
Patch32: qemu.trad.CVE-2016-9776.patch |
123 |
Patch33: xen.gcc7.fix.patch |
124 |
Patch34: xen.canonicalize.patch |
125 |
Patch35: qemu.trad.CVE-2017-6505.patch |
126 |
Patch36: qemu.trad.CVE-2017-7718.patch |
127 |
Patch37: droplibvirtconflict.patch |
128 |
Patch38: qemu.trad.CVE-2017-8309.patch |
129 |
Patch39: qemu.trad.CVE-2017-9330.patch |
130 |
Patch40: xen.drop.brctl.patch |
131 |
Patch41: xen.gcc9.fixes.patch |
132 |
Patch43: xen.gcc11.fixes.patch |
133 |
Patch45: xen.gcc12.fixes.patch |
134 |
Patch46: xen.efi.build.patch |
135 |
Patch47: xen.gcc13.fixes.patch |
136 |
Patch49: xen.python3.12.patch |
137 |
#Patch50: xen.ocaml5.fixes.patch |
138 |
Patch52: xen.gcc14.fixes.patch |
139 |
Patch53: newlib.gcc14.fixes.patch |
140 |
|
141 |
# Mageia patches: |
142 |
Patch201: xen-4.1.2-fix-stubdom-Makefile.patch |
143 |
Patch202: xen-4.1.3-fix-doc-build.patch |
144 |
Patch203: xen-4.2.1-fix-glibc-build.patch |
145 |
Patch204: xen.armv8l.arm32.patch |
146 |
|
147 |
# opensuse patches: |
148 |
|
149 |
# aur |
150 |
Patch600: add-stubdom-fixes.patch |
151 |
|
152 |
# upstream patches (from https://xenbits.xen.org/git-http/xen.git) |
153 |
|
154 |
%if %build_tpm |
155 |
BuildRequires: cmake |
156 |
%endif |
157 |
|
158 |
BuildRequires: pkgconfig(python3) |
159 |
BuildRequires: pkgconfig(ncurses) |
160 |
%if %build_qemutrad |
161 |
BuildRequires: pkgconfig(libidn) |
162 |
BuildRequires: pkgconfig(zlib) |
163 |
BuildRequires: pkgconfig(sdl) |
164 |
BuildRequires: pkgconfig(libcurl) |
165 |
BuildRequires: pkgconfig(x11) |
166 |
BuildRequires: pkgconfig(gtk+-2.0) |
167 |
BuildRequires: libaio-devel |
168 |
%endif |
169 |
# build using Fedora seabios and ipxe packages for roms |
170 |
BuildRequires: seabios |
171 |
BuildRequires: seabios-bin |
172 |
BuildRequires: ipxe-roms-qemu |
173 |
%ifarch %{ix86} x86_64 |
174 |
# for the VMX "bios" |
175 |
BuildRequires: dev86-devel |
176 |
%endif |
177 |
BuildRequires: glibc-devel |
178 |
BuildRequires: gettext |
179 |
BuildRequires: pkgconfig(gnutls) |
180 |
BuildRequires: libgcrypt-devel |
181 |
BuildRequires: brlapi-devel |
182 |
BuildRequires: pkgconfig(openssl) |
183 |
# For ioemu PCI passthrough |
184 |
BuildRequires: pkgconfig(libpci) |
185 |
# Several tools now use uuid |
186 |
BuildRequires: pkgconfig(uuid) |
187 |
# iasl needed to build hvmloader |
188 |
BuildRequires: acpica-tools |
189 |
# for spice support |
190 |
BuildRequires: pkgconfig(spice-server) |
191 |
BuildRequires: spice-protocol |
192 |
BuildRequires: pkgconfig(libusbredirparser-0.5) >= 0.6 |
193 |
# modern compressed kernels |
194 |
BuildRequires: pkgconfig(bzip2) |
195 |
BuildRequires: pkgconfig(liblzma) |
196 |
BuildRequires: pkgconfig(libzstd) |
197 |
# libfsimage |
198 |
BuildRequires: e2fsprogs-devel |
199 |
# tools now require yajl and wget |
200 |
BuildRequires: pkgconfig(yajl) |
201 |
BuildRequires: wget |
202 |
# remus support now needs libnl3 |
203 |
BuildRequires: libnl3-devel |
204 |
%if %with_xsm |
205 |
# xsm policy file needs needs checkpolicy and m4 |
206 |
BuildRequires: checkpolicy m4 |
207 |
%endif |
208 |
# for virtfs support |
209 |
BuildRequires: attr-devel |
210 |
BuildRequires: pkgconfig(libcap) |
211 |
Requires: iptables |
212 |
%if %build_crosshyp |
213 |
# cross compiler for building 64-bit hypervisor on ix86 |
214 |
BuildRequires: gcc-x86_64-linux-gnu |
215 |
%endif |
216 |
BuildRequires: gcc make |
217 |
Requires: iproute |
218 |
Requires: python3-lxml |
219 |
Requires: xen-runtime = %{version}-%{release} |
220 |
# Not strictly a dependency, but kpartx is by far the most useful tool right |
221 |
# now for accessing domU data from within a dom0 so bring it in when the user |
222 |
# installs xen. |
223 |
Requires: kpartx |
224 |
ExclusiveArch: %{ix86} x86_64 armv7hl aarch64 |
225 |
%if %with_ocaml |
226 |
BuildRequires: ocaml >= 4.12.0 |
227 |
BuildRequires: ocaml-findlib-devel |
228 |
%endif |
229 |
Requires(post): systemd |
230 |
Requires(preun): systemd |
231 |
BuildRequires: pkgconfig(libsystemd) |
232 |
%ifarch %arm aarch64 |
233 |
BuildRequires: libfdt-devel |
234 |
%endif |
235 |
%if %build_hyp |
236 |
BuildRequires: bison flex |
237 |
%endif |
238 |
BuildRequires: hostname |
239 |
|
240 |
%description |
241 |
This package contains the XenD daemon and xm command line |
242 |
tools, needed to manage virtual machines running under the |
243 |
Xen hypervisor |
244 |
|
245 |
%package -n %{libname} |
246 |
Summary: Libraries for Xen tools |
247 |
Group: System/Libraries |
248 |
Conflicts: %{name} < 3.1.0-5 |
249 |
Requires: xen-licenses |
250 |
|
251 |
%description -n %{libname} |
252 |
This package contains the libraries needed to run applications |
253 |
which manage Xen virtual machines. |
254 |
|
255 |
|
256 |
%package runtime |
257 |
Summary: Core Xen runtime environment |
258 |
Requires: %libname = %{version}-%{release} |
259 |
#Requires: /usr/bin/qemu-img /usr/bin/qemu-nbd |
260 |
Requires: qemu-img |
261 |
# Ensure we at least have a suitable kernel installed, though we can't |
262 |
# force user to actually boot it. |
263 |
Requires: xen-hypervisor-abi = %{hv_abi} |
264 |
%ifnarch %arm |
265 |
Requires: kernel-server |
266 |
%endif |
267 |
# perl is used in /etc/xen/scripts/locking.sh |
268 |
Recommends: perl |
269 |
%ifnarch armv7hl aarch64 |
270 |
# use /usr/bin/qemu-system-i386 in Fedora instead of qemu-xen |
271 |
Recommends: qemu-system-x86-core |
272 |
# rom file for qemu-xen-traditional |
273 |
Recommends: ipxe-roms-qemu |
274 |
%endif |
275 |
Conflicts: xen <= 4.14.0-4.mga8 |
276 |
|
277 |
%description runtime |
278 |
This package contains the runtime programs and daemons which |
279 |
form the core Xen userspace environment. |
280 |
|
281 |
|
282 |
%package hypervisor |
283 |
Summary: Libraries for Xen tools |
284 |
Group: System/Kernel and hardware |
285 |
Provides: xen-hypervisor-abi = %{hv_abi} |
286 |
Requires: xen-licenses |
287 |
%if %build_hyp |
288 |
%ifarch %{ix86} |
289 |
Recommends: grub2-common |
290 |
%endif |
291 |
%ifarch x86_64 |
292 |
Recommends: grub2-efi |
293 |
%endif |
294 |
%endif |
295 |
%if %build_ovmf |
296 |
Recommends: edk2-ovmf-xen |
297 |
%endif |
298 |
|
299 |
%description hypervisor |
300 |
This package contains the Xen hypervisor. |
301 |
|
302 |
|
303 |
%if %build_docs |
304 |
%package doc |
305 |
Summary: Xen documentation |
306 |
Group: Documentation |
307 |
BuildArch: noarch |
308 |
Requires: xen-licenses |
309 |
# for the docs |
310 |
BuildRequires: perl(Pod::Man) perl(Pod::Text) perl(File::Find) |
311 |
BuildRequires: transfig perl(Pod::Html) |
312 |
#BuildRequires: pandoc |
313 |
|
314 |
%description doc |
315 |
This package contains the Xen documentation. |
316 |
%endif |
317 |
|
318 |
|
319 |
%package -n %{develname} |
320 |
Summary: Development libraries for Xen tools |
321 |
Group: Development/C |
322 |
Requires: %{libname} = %{version}-%{release} |
323 |
Provides: %{name}-devel = %{version}-%{release} |
324 |
Conflicts: %{name} < 4.13.0-6 |
325 |
|
326 |
%description -n %{develname} |
327 |
This package contains what's needed to develop applications |
328 |
which manage Xen virtual machines. |
329 |
|
330 |
%package licenses |
331 |
Summary: License files from Xen source |
332 |
|
333 |
%description licenses |
334 |
This package contains the license files from the source used |
335 |
to build the xen packages. |
336 |
|
337 |
|
338 |
%if %build_ocaml |
339 |
%package -n ocaml-xen |
340 |
Summary: Ocaml libraries for Xen tools |
341 |
Group: Development/Other |
342 |
Conflicts: %{name} < 3.1.0-5 |
343 |
|
344 |
%description -n ocaml-xen |
345 |
This package contains libraries for ocaml tools to manage Xen |
346 |
virtual machines. |
347 |
|
348 |
|
349 |
%package -n ocaml-xen-devel |
350 |
Summary: Ocaml development libraries for Xen tools |
351 |
Group: Development/Other |
352 |
Requires: %{name}-devel = %{version}-%{release} |
353 |
|
354 |
%description -n ocaml-xen-devel |
355 |
This package contains libraries for developing ocaml tools to |
356 |
manage Xen virtual machines. |
357 |
%endif |
358 |
|
359 |
|
360 |
%prep |
361 |
%setup -q |
362 |
# FC patches: |
363 |
%patch -P4 -p1 |
364 |
%patch -P5 -p1 |
365 |
%patch -P6 -p1 |
366 |
%patch -P7 -p1 |
367 |
%patch -P8 -p1 |
368 |
%patch -P9 -p1 |
369 |
%patch -P10 -p1 |
370 |
%patch -P11 -p1 |
371 |
%patch -P12 -p1 |
372 |
%patch -P13 -p1 |
373 |
%patch -P14 -p1 |
374 |
%patch -P15 -p1 |
375 |
%patch -P16 -p1 |
376 |
%patch -P17 -p1 |
377 |
%patch -P18 -p1 |
378 |
%patch -P19 -p1 |
379 |
%patch -P20 -p1 |
380 |
%patch -P21 -p1 |
381 |
%patch -P22 -p1 |
382 |
%patch -P23 -p1 |
383 |
%patch -P24 -p1 |
384 |
%patch -P25 -p1 |
385 |
%patch -P33 -p1 |
386 |
%patch -P34 -p1 |
387 |
%patch -P37 -p1 |
388 |
%patch -P40 -p1 |
389 |
%patch -P41 -p1 |
390 |
%patch -P43 -p1 |
391 |
%patch -P45 -p1 |
392 |
%patch -P46 -p1 |
393 |
%patch -P47 -p1 |
394 |
%patch -P49 -p1 |
395 |
%patch -P52 -p1 |
396 |
%patch -P53 -p1 |
397 |
|
398 |
# qemu-xen-traditional patches |
399 |
pushd tools/qemu-xen-traditional |
400 |
%patch -P27 -p1 |
401 |
%patch -P29 -p1 |
402 |
%patch -P30 -p1 |
403 |
%patch -P31 -p1 |
404 |
%patch -P32 -p1 |
405 |
%patch -P35 -p1 |
406 |
%patch -P36 -p1 |
407 |
%patch -P38 -p1 |
408 |
%patch -P39 -p1 |
409 |
popd |
410 |
|
411 |
# qemu-xen patches |
412 |
pushd tools/qemu-xen |
413 |
popd |
414 |
|
415 |
# Mageia patches: |
416 |
%patch -P201 -p1 |
417 |
%patch -P202 -p1 |
418 |
#patch203 -p1 |
419 |
%patch -P204 -p1 |
420 |
|
421 |
# opensuse patches |
422 |
|
423 |
# aur patches |
424 |
%if %build_tpm |
425 |
%patch -P600 -p1 |
426 |
%endif |
427 |
|
428 |
# stubdom sources |
429 |
cp -v %{SOURCE10} %{SOURCE11} %{SOURCE12} %{SOURCE13} %{SOURCE14} %{SOURCE15} stubdom |
430 |
%if %build_tpm |
431 |
cp -v %{SOURCE16} %{SOURCE17} %{SOURCE18} stubdom |
432 |
%endif |
433 |
|
434 |
# copy xen hypervisor .config file to change settings |
435 |
%if !%build_debug |
436 |
cp -v %{SOURCE21} xen/.config |
437 |
%else |
438 |
cp -v %{SOURCE22} xen/.config |
439 |
%endif |
440 |
|
441 |
%build |
442 |
export CFLAGS="%{build_cflags}" |
443 |
export CXXFLAGS="%{build_cxxflags}" |
444 |
%if !%build_ocaml |
445 |
%define ocaml_flags OCAML_TOOLS=n |
446 |
%endif |
447 |
%if %build_efi |
448 |
mkdir -p dist/install/boot/efi/efi/fedora |
449 |
%endif |
450 |
%if %build_ocaml |
451 |
mkdir -p dist/install%{_libdir}/ocaml/stublibs |
452 |
%endif |
453 |
export EXTRA_CFLAGS_XEN_TOOLS="$RPM_OPT_FLAGS -Wno-error=use-after-free $LDFLAGS" |
454 |
export EXTRA_CFLAGS_QEMU_TRADITIONAL="$RPM_OPT_FLAGS" |
455 |
export EXTRA_CFLAGS_QEMU_XEN="$RPM_OPT_FLAGS" |
456 |
export PYTHON="/usr/bin/python3" |
457 |
export LDFLAGS_SAVE=`echo $LDFLAGS | sed -e 's/-Wl,//g' -e 's/,/ /g' -e 's? -specs=[-a-z/0-9]*??g'` |
458 |
export CFLAGS_SAVE="$CFLAGS" |
459 |
%if %build_qemutrad |
460 |
CONFIG_EXTRA="--enable-qemu-traditional" |
461 |
%else |
462 |
CONFIG_EXTRA="" |
463 |
%endif |
464 |
%if %build_ovmf |
465 |
CONFIG_EXTRA="$CONFIG_EXTRA --with-system-ovmf=/usr/share/edk2/xen/OVMF.fd" |
466 |
%endif |
467 |
%ifnarch armv7hl aarch64 |
468 |
CONFIG_EXTRA="$CONFIG_EXTRA --with-system-ipxe=/usr/share/ipxe/10ec8139.rom" |
469 |
%endif |
470 |
%if %(test -f /usr/share/seabios/bios-256k.bin && echo 1|| echo 0) |
471 |
CONFIG_EXTRA="$CONFIG_EXTRA --with-system-seabios=/usr/share/seabios/bios-256k.bin" |
472 |
%else |
473 |
CONFIG_EXTRA="$CONFIG_EXTRA --disable-seabios" |
474 |
%endif |
475 |
./configure --prefix=%{_prefix} --libdir=%{_libdir} --libexecdir=%{_libexecdir} --with-system-qemu=/usr/bin/qemu-system-i386 --with-linux-backend-modules="xen-evtchn xen-gntdev xen-gntalloc xen-blkback xen-netback xen-pciback xen-scsiback xen-acpi-processor" $CONFIG_EXTRA |
476 |
unset CFLAGS CXXFLAGS FFLAGS LDFLAGS |
477 |
export LDFLAGS="$LDFLAGS_SAVE" |
478 |
export CFLAGS="$CFLAGS_SAVE -Wno-error=address" |
479 |
|
480 |
%if %build_hyp |
481 |
%if %build_crosshyp |
482 |
export CFLAGS=`echo $CFLAGS | sed -e 's/-m32//g' -e 's/-march=i686//g' 's/-specs=\/usr\/lib\/rpm\/redhat\/redhat-annobin-cc1//g'` |
483 |
XEN_TARGET_ARCH=x86_64 %make_build prefix=/usr xen CC="/usr/bin/x86_64-linux-gnu-gcc" |
484 |
%else |
485 |
%ifarch armv7hl |
486 |
export CFLAGS=`echo $CFLAGS | sed -e 's/-mfloat-abi=hard//g' -e 's/-march=armv7-a//g'` |
487 |
%endif |
488 |
# armv7hl aarch64 or x86_64 |
489 |
%make_build prefix=/usr xen |
490 |
%endif |
491 |
%endif |
492 |
unset CFLAGS CXXFLAGS FFLAGS LDFLAGS |
493 |
|
494 |
%make_build %{?ocaml_flags} prefix=/usr tools |
495 |
%if %build_docs |
496 |
make prefix=/usr docs |
497 |
%endif |
498 |
export RPM_OPT_FLAGS_RED=`echo $RPM_OPT_FLAGS | sed -e 's/-m64//g' -e 's/--param=ssp-buffer-size=4//g' -e's/-fstack-protector-strong//'` |
499 |
%ifarch %{ix86} |
500 |
export EXTRA_CFLAGS_XEN_TOOLS="$RPM_OPT_FLAGS_RED" |
501 |
%endif |
502 |
%if %build_stubdom |
503 |
%ifnarch armv7hl aarch64 |
504 |
make mini-os-dir |
505 |
make -C stubdom build |
506 |
%endif |
507 |
%ifarch x86_64 |
508 |
export EXTRA_CFLAGS_XEN_TOOLS="$RPM_OPT_FLAGS_RED" |
509 |
XEN_TARGET_ARCH=x86_32 make -C stubdom pv-grub-if-enabled |
510 |
%endif |
511 |
%endif |
512 |
|
513 |
|
514 |
%install |
515 |
mkdir -p %{buildroot} |
516 |
cp -prlP dist/install/* %{buildroot} |
517 |
%if %build_stubdom |
518 |
%ifnarch armv7hl aarch64 |
519 |
make DESTDIR=%{buildroot} %{?ocaml_flags} prefix=/usr install-stubdom |
520 |
%endif |
521 |
%endif |
522 |
%ifarch %{ix86} |
523 |
cat > README.install.urpmi <<_EOF |
524 |
Since xen 4.3, the hypervisor is no longer supported on x86_32. But fear not, |
525 |
you can actually use the x86_64 xen hypervisor, even when using a 32bit kernel |
526 |
and system. This is because the hypervisor is loaded before the kernel and OS. |
527 |
Keep in mind that a x86_64 capable processor is still required, but then if |
528 |
you are installing a hypervisor, you really should be using 64bit anyway. |
529 |
_EOF |
530 |
ln -f README.install.urpmi README.4.3.0.upgrade.urpmi |
531 |
%endif |
532 |
|
533 |
%if %build_efi |
534 |
mv %{buildroot}/boot/efi/efi %{buildroot}/boot/efi/EFI |
535 |
%endif |
536 |
%if %build_xsm |
537 |
# policy file should be in /boot/flask |
538 |
mkdir %{buildroot}/boot/flask |
539 |
mv %{buildroot}/boot/xenpolicy* %{buildroot}/boot/flask |
540 |
%else |
541 |
rm -f %{buildroot}/boot/xenpolicy* |
542 |
%endif |
543 |
|
544 |
############ kill unwanted stuff ############ |
545 |
|
546 |
# stubdom: newlib |
547 |
rm -rf %{buildroot}/usr/*-xen-elf |
548 |
|
549 |
# hypervisor symlinks |
550 |
rm -rf %{buildroot}/boot/xen-%{hv_abi}.gz |
551 |
rm -rf %{buildroot}/boot/xen-4.gz |
552 |
rm -rf %{buildroot}/boot/xen.gz |
553 |
%if !%build_hyp |
554 |
rm -rf %{buildroot}/boot |
555 |
%endif |
556 |
|
557 |
# silly doc dir fun |
558 |
rm -fr %{buildroot}%{_datadir}/doc/xen |
559 |
|
560 |
# Pointless helper |
561 |
rm -f %{buildroot}%{_sbindir}/xen-python-path |
562 |
|
563 |
# qemu stuff (unused or available from upstream) |
564 |
rm -rf %{buildroot}/usr/share/xen/man |
565 |
rm -rf %{buildroot}/usr/bin/qemu-*-xen |
566 |
ln -s qemu-img %{buildroot}/%{_bindir}/qemu-img-xen |
567 |
ln -s qemu-img %{buildroot}/%{_bindir}/qemu-nbd-xen |
568 |
for file in bios.bin openbios-sparc32 openbios-sparc64 ppc_rom.bin \ |
569 |
pxe-e1000.bin pxe-ne2k_pci.bin pxe-pcnet.bin pxe-rtl8139.bin \ |
570 |
vgabios.bin vgabios-cirrus.bin video.x openbios-ppc bamboo.dtb |
571 |
do |
572 |
rm -f %{buildroot}/%{_datadir}/xen/qemu/$file |
573 |
done |
574 |
|
575 |
# README's not intended for end users |
576 |
rm -f %{buildroot}/%{_sysconfdir}/xen/README* |
577 |
|
578 |
# standard gnu info files |
579 |
rm -rf %{buildroot}/usr/info |
580 |
|
581 |
# adhere to Static Library Packaging Guidelines |
582 |
rm -rf %{buildroot}/%{_libdir}/*.a |
583 |
|
584 |
%if %build_efi |
585 |
# clean up extra efi files |
586 |
%ifarch %{ix86} |
587 |
rm -f %{buildroot}/usr/lib64/efi/xen-%{hv_abi}.efi |
588 |
rm -f %{buildroot}/usr/lib64/efi/xen-4.efi |
589 |
rm -f %{buildroot}/usr/lib64/efi/xen.efi |
590 |
cp -p %{buildroot}/usr/lib64/efi/xen-%{version}{,.notstripped}.efi |
591 |
strip -s %{buildroot}/usr/lib64/efi/xen-%{version}.efi |
592 |
%else |
593 |
rm -f %{buildroot}/%{_libdir}/efi/xen-%{hv_abi}.efi |
594 |
rm -f %{buildroot}/%{_libdir}/efi/xen-4.efi |
595 |
rm -f %{buildroot}/%{_libdir}/efi/xen.efi |
596 |
cp -p %{buildroot}/%{_libdir}/efi/xen-%{version}{,.notstripped}.efi |
597 |
strip -s %{buildroot}/%{_libdir}/efi/xen-%{version}.efi |
598 |
%endif |
599 |
%endif |
600 |
|
601 |
%if ! %build_ocaml |
602 |
rm -rf %{buildroot}/%{_unitdir}/oxenstored.service |
603 |
%endif |
604 |
|
605 |
############ fixup files in /etc ############ |
606 |
|
607 |
# logrotate |
608 |
mkdir -p %{buildroot}%{_sysconfdir}/logrotate.d/ |
609 |
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/logrotate.d/%{name} |
610 |
|
611 |
# init scripts |
612 |
%define initdloc %(test -d /etc/rc.d/init.d/ && echo rc.d/init.d || echo init.d ) |
613 |
|
614 |
rm %{buildroot}%{_sysconfdir}/%{initdloc}/xen-watchdog |
615 |
rm %{buildroot}%{_sysconfdir}/%{initdloc}/xencommons |
616 |
rm %{buildroot}%{_sysconfdir}/%{initdloc}/xendomains |
617 |
rm %{buildroot}%{_sysconfdir}/%{initdloc}/xendriverdomain |
618 |
|
619 |
############ create dirs in /var ############ |
620 |
|
621 |
mkdir -p %{buildroot}%{_localstatedir}/lib/xen/images |
622 |
mkdir -p %{buildroot}%{_localstatedir}/log/xen/console |
623 |
|
624 |
############ create symlink for x86_64 for compatibility with 4.4 ############ |
625 |
|
626 |
%if "%{_libdir}" != "/usr/lib" |
627 |
ln -s %{_libexecdir}/%{name} %{buildroot}/%{_libdir}/%{name} |
628 |
%endif |
629 |
|
630 |
############ create symlink to qemu-system-i386 in /usr/bin ############ |
631 |
ln -s /usr/bin/qemu-system-i386 %{buildroot}/%{_libexecdir}/%{name}/bin/qemu-system-i386 |
632 |
|
633 |
# no selinux support |
634 |
#sed -i -E '/^Options=/ s/,context=".*?"//' %{buildroot}%{_unitdir}/var-lib-xenstored.mount |
635 |
|
636 |
# gprintify has a bug handling some constructs in xendomain |
637 |
export DONT_GPRINTIFY=1 |
638 |
|
639 |
|
640 |
%if %build_efi |
641 |
pushd %{buildroot}/boot/ |
642 |
mv efi/EFI/{fedora,mageia} |
643 |
mv efi EFI |
644 |
popd |
645 |
%endif |
646 |
|
647 |
rm -fr %{buildroot}/usr/share/locale/*/LC_MESSAGES/qemu.mo |
648 |
|
649 |
############ assemble license files ############ |
650 |
|
651 |
mkdir licensedir |
652 |
# avoid licensedir to avoid recursion, also stubdom/ioemu and dist |
653 |
# which are copies of files elsewhere |
654 |
find . -path licensedir -prune -o -path stubdom/ioemu -prune -o \ |
655 |
-path dist -prune -o -name COPYING -o -name LICENSE | while read file; do |
656 |
mkdir -p licensedir/`dirname $file` |
657 |
install -m 644 $file licensedir/$file |
658 |
done |
659 |
|
660 |
############ all done now ############ |
661 |
|
662 |
%post |
663 |
%systemd_post xendomains.service |
664 |
|
665 |
%preun |
666 |
%systemd_preun xendomains.service |
667 |
|
668 |
%post runtime |
669 |
%systemd_post xenstored.service xenconsoled.service |
670 |
|
671 |
%preun runtime |
672 |
%systemd_preun xenstored.service xenconsoled.service |
673 |
|
674 |
%if %build_hyp |
675 |
%post hypervisor |
676 |
do_it() { |
677 |
DIR=$1 |
678 |
TARGET=$2 |
679 |
if [ -d $DIR ]; then |
680 |
if [ ! -d $TARGET ]; then |
681 |
mkdir $TARGET |
682 |
fi |
683 |
for m in relocator.mod multiboot2.mod; do |
684 |
if [ -f $DIR/$m ]; then |
685 |
if [ ! -f $TARGET/$m ] || ! cmp -s $DIR/$m $TARGET/$m; then |
686 |
cp -p $DIR/$m $TARGET/$m |
687 |
fi |
688 |
fi |
689 |
done |
690 |
fi |
691 |
} |
692 |
if [ $1 == 1 -a -f /sbin/grub2-mkconfig ]; then |
693 |
for f in /boot/grub2/grub.cfg; do |
694 |
if [ -f $f ]; then |
695 |
/sbin/grub2-mkconfig -o $f |
696 |
sed -i -e '/insmod module2/d' $f |
697 |
fi |
698 |
done |
699 |
fi |
700 |
if [ -f /sbin/grub2-mkconfig ]; then |
701 |
if [ -f /boot/grub2/grub.cfg ]; then |
702 |
DIR=/usr/lib/grub/i386-pc |
703 |
TARGET=/boot/grub2/i386-pc |
704 |
do_it $DIR $TARGET |
705 |
DIR=/usr/lib/grub/x86_64-efi |
706 |
TARGET=/boot/grub2/x86_64-efi |
707 |
do_it $DIR $TARGET |
708 |
fi |
709 |
fi |
710 |
|
711 |
%postun hypervisor |
712 |
if [ -f /sbin/grub2-mkconfig ]; then |
713 |
for f in /boot/grub2/grub.cfg; do |
714 |
if [ -f $f ]; then |
715 |
/sbin/grub2-mkconfig -o $f |
716 |
sed -i -e '/insmod module2/d' $f |
717 |
fi |
718 |
done |
719 |
fi |
720 |
%endif |
721 |
|
722 |
%if %build_ocaml |
723 |
%post -n ocaml-xen |
724 |
%systemd_post oxenstored.service |
725 |
|
726 |
%preun -n ocaml-xen |
727 |
%systemd_preun oxenstored.service |
728 |
%endif |
729 |
|
730 |
# Base package only contains XenD/xm python stuff |
731 |
%files |
732 |
%if %build_docs |
733 |
%dir %{_docdir}/%{name} |
734 |
%endif |
735 |
%doc COPYING README |
736 |
%{python3_sitearch}/%{name} |
737 |
%{python3_sitearch}/xen-*.egg-info |
738 |
|
739 |
# Guest autostart links |
740 |
%dir %attr(0700,root,root) %{_sysconfdir}/%{name}/auto |
741 |
# Autostart of guests |
742 |
%config(noreplace) %{_sysconfdir}/sysconfig/xendomains |
743 |
|
744 |
%{_unitdir}/xendomains.service |
745 |
|
746 |
%files -n %{libname} |
747 |
%{_libdir}/*.so.* |
748 |
%{_libdir}/xenfsimage |
749 |
|
750 |
# All runtime stuff except for XenD/xm python stuff |
751 |
%files runtime |
752 |
# Hotplug rules |
753 |
%dir %attr(0700,root,root) %{_sysconfdir}/%{name} |
754 |
%dir %attr(0700,root,root) %{_sysconfdir}/%{name}/scripts/ |
755 |
%config %attr(0700,root,root) %{_sysconfdir}/%{name}/scripts/* |
756 |
|
757 |
%{_sysconfdir}/bash_completion.d/xl |
758 |
|
759 |
%{_unitdir}/proc-xen.mount |
760 |
%{_unitdir}/xenstored.service |
761 |
%{_unitdir}/xenconsoled.service |
762 |
%{_unitdir}/xen-watchdog.service |
763 |
%{_unitdir}/xen-qemu-dom0-disk-backend.service |
764 |
%{_unitdir}/xendriverdomain.service |
765 |
/usr/lib/modules-load.d/xen.conf |
766 |
%config(noreplace) %{_sysconfdir}/sysconfig/xencommons |
767 |
%config(noreplace) %{_sysconfdir}/xen/xl.conf |
768 |
%config(noreplace) %{_sysconfdir}/xen/cpupool |
769 |
%config(noreplace) %{_sysconfdir}/xen/xlexample* |
770 |
|
771 |
# Rotate console log files |
772 |
%config(noreplace) %{_sysconfdir}/logrotate.d/xen |
773 |
|
774 |
# Programs run by other programs |
775 |
%dir %{_libexecdir}/%{name} |
776 |
%dir %{_libexecdir}/%{name}/bin |
777 |
%attr(0700,root,root) %{_libexecdir}/%{name}/bin/* |
778 |
# QEMU runtime files |
779 |
%if %build_qemutrad |
780 |
%ifnarch armv7hl aarch64 |
781 |
%dir %{_datadir}/%{name}/qemu |
782 |
%dir %{_datadir}/%{name}/qemu/keymaps |
783 |
%{_datadir}/%{name}/qemu/keymaps/* |
784 |
%endif |
785 |
%endif |
786 |
|
787 |
# man pages |
788 |
%if %build_docs |
789 |
%{_mandir}/man*/* |
790 |
%endif |
791 |
|
792 |
%{python3_sitearch}/xenfsimage*.so |
793 |
%{python3_sitearch}/grub |
794 |
%{python3_sitearch}/pygrub-*.egg-info |
795 |
|
796 |
# The firmware |
797 |
%ifarch %{ix86} x86_64 |
798 |
%dir %{_libexecdir}/%{name}/boot |
799 |
%{_libexecdir}/xen/boot/hvmloader |
800 |
%ifnarch %{ix86} |
801 |
%{_libexecdir}/%{name}/boot/xen-shim |
802 |
/usr/lib/debug%{_libexecdir}/xen/boot/xen-shim-syms |
803 |
%endif |
804 |
%if %build_stubdom |
805 |
%if %build_qemutrad |
806 |
%{_libexecdir}/xen/boot/ioemu-stubdom.gz |
807 |
%endif |
808 |
%if %build_tpm |
809 |
%{_libexecdir}/xen/boot/vtpm-stubdom.gz |
810 |
%{_libexecdir}/xen/boot/vtpmmgr-stubdom.gz |
811 |
%endif |
812 |
%{_libexecdir}/xen/boot/xenstore-stubdom.gz |
813 |
%{_libexecdir}/xen/boot/xenstorepvh-stubdom.gz |
814 |
%endif |
815 |
%endif |
816 |
%if "%{_libdir}" != "/usr/lib" |
817 |
%{_libdir}/%{name} |
818 |
%endif |
819 |
# General Xen state |
820 |
%dir %{_localstatedir}/lib/%{name} |
821 |
%dir %{_localstatedir}/lib/%{name}/dump |
822 |
%dir %{_localstatedir}/lib/%{name}/images |
823 |
# Xenstore runtime state |
824 |
%ghost %{_localstatedir}/run/xenstored |
825 |
|
826 |
# All xenstore CLI tools |
827 |
%{_bindir}/qemu-*-xen |
828 |
%{_bindir}/xenstore |
829 |
%{_bindir}/xenstore-* |
830 |
%{_bindir}/pygrub |
831 |
%{_bindir}/xentrace* |
832 |
# XSM |
833 |
%{_sbindir}/flask-* |
834 |
# Misc stuff |
835 |
%ifnarch armv7hl aarch64 |
836 |
%{_bindir}/xen-detect |
837 |
%endif |
838 |
%{_bindir}/xencov_split |
839 |
%ifnarch armv7hl aarch64 |
840 |
%{_sbindir}/gdbsx |
841 |
%{_sbindir}/xen-kdd |
842 |
%endif |
843 |
%ifnarch armv7hl aarch64 |
844 |
%{_sbindir}/xen-hptool |
845 |
%{_sbindir}/xen-hvmcrash |
846 |
%{_sbindir}/xen-hvmctx |
847 |
%endif |
848 |
%{_sbindir}/xenconsoled |
849 |
%{_sbindir}/xenlockprof |
850 |
%{_sbindir}/xenmon |
851 |
%{_sbindir}/xentop |
852 |
%{_sbindir}/xentrace_setmask |
853 |
%{_sbindir}/xenbaked |
854 |
%{_sbindir}/xenstored |
855 |
%{_sbindir}/xenpm |
856 |
%{_sbindir}/xenpmd |
857 |
%{_sbindir}/xenperf |
858 |
%{_sbindir}/xenwatchdogd |
859 |
%{_sbindir}/xl |
860 |
%ifnarch armv7hl aarch64 |
861 |
%{_sbindir}/xen-lowmemd |
862 |
%endif |
863 |
%{_sbindir}/xencov |
864 |
%ifnarch armv7hl aarch64 |
865 |
%{_sbindir}/xen-mfndump |
866 |
%endif |
867 |
%{_bindir}/xenalyze |
868 |
%{_sbindir}/xentrace |
869 |
%{_sbindir}/xentrace_setsize |
870 |
%ifnarch armv7hl aarch64 |
871 |
%{_bindir}/xen-cpuid |
872 |
%endif |
873 |
%{_sbindir}/xen-livepatch |
874 |
%{_sbindir}/xen-diag |
875 |
%ifnarch armv7hl aarch64 |
876 |
%{_sbindir}/xen-ucode |
877 |
%{_sbindir}/xen-memshare |
878 |
%{_sbindir}/xen-mceinj |
879 |
%{_sbindir}/xen-vmtrace |
880 |
%endif |
881 |
%{_bindir}/vchan-socket-proxy |
882 |
%{_sbindir}/xenhypfs |
883 |
%{_sbindir}/xen-access |
884 |
|
885 |
# Xen logfiles |
886 |
%dir %attr(0700,root,root) %{_localstatedir}/log/xen |
887 |
# Guest/HV console logs |
888 |
%dir %attr(0700,root,root) %{_localstatedir}/log/xen/console |
889 |
|
890 |
%files hypervisor |
891 |
%ifarch %{ix86} |
892 |
%doc README.4.3.0.upgrade.urpmi README.install.urpmi |
893 |
%endif |
894 |
%if %build_hyp |
895 |
%ifnarch armv7hl aarch64 |
896 |
/boot/xen-*.gz |
897 |
/boot/xen*.config |
898 |
%else |
899 |
/boot/xen* |
900 |
%endif |
901 |
%if %build_xsm |
902 |
%dir %attr(0755,root,root) /boot/flask |
903 |
/boot/flask/xenpolicy* |
904 |
%endif |
905 |
/usr/lib/debug/xen* |
906 |
%endif |
907 |
%if %build_efi |
908 |
%ifarch %{ix86} |
909 |
/usr/lib64/efi/*.efi |
910 |
%else |
911 |
%{_libdir}/efi/*.efi |
912 |
%endif |
913 |
%endif |
914 |
|
915 |
%if %build_docs |
916 |
%files doc |
917 |
%{_docdir}/%{name}/* |
918 |
%doc docs/txt/* docs/html/* |
919 |
%endif |
920 |
|
921 |
%files -n %{develname} |
922 |
%{_includedir}/*.h |
923 |
%dir %{_includedir}/xen |
924 |
%{_includedir}/xen/* |
925 |
%dir %{_includedir}/xenstore-compat |
926 |
%{_includedir}/xenstore-compat/* |
927 |
%{_libdir}/*.so |
928 |
%{_libdir}/pkgconfig/* |
929 |
|
930 |
%files licenses |
931 |
%doc licensedir/* |
932 |
|
933 |
%if %build_ocaml |
934 |
%files -n ocaml-xen |
935 |
%{_libdir}/ocaml/xen* |
936 |
%exclude %{_libdir}/ocaml/xen*/*.a |
937 |
%exclude %{_libdir}/ocaml/xen*/*.cmxa |
938 |
%exclude %{_libdir}/ocaml/xen*/*.cmx |
939 |
%{_libdir}/ocaml/stublibs/*.so |
940 |
%{_libdir}/ocaml/stublibs/*.so.owner |
941 |
%{_sbindir}/oxenstored |
942 |
%config(noreplace) %{_sysconfdir}/xen/oxenstored.conf |
943 |
%{_unitdir}/oxenstored.service |
944 |
|
945 |
%files -n ocaml-xen-devel |
946 |
%{_libdir}/ocaml/xen*/*.a |
947 |
%{_libdir}/ocaml/xen*/*.cmxa |
948 |
%{_libdir}/ocaml/xen*/*.cmx |
949 |
%endif |
950 |
|