File qemu-testsuite.spec of Package qemu.19806

#
# spec file for package qemu-testsuite
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define build_x86_firmware_from_source 0
%define build_skiboot_from_source 0
%define build_slof_from_source 0
%define kvm_available 0
%define legacy_qemu_kvm 0
%define force_fit_virtio_pxe_rom 1

%if 0%{?suse_version} > 1315
# cross-x86_64-gcc7 is available from SLE15/Leap15.0
%define build_rom_arch %ix86 x86_64 aarch64
%else
%define build_rom_arch %ix86 x86_64
%endif

%if "%{?distribution}" == ""
%define distro private-build
%else
%define distro %{distribution}
%endif

%ifarch %{build_rom_arch}
# choice of building all from source or using provided binary x86 blobs
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
%define build_x86_firmware_from_source 1
%endif
%endif

%ifarch ppc64
%define build_skiboot_from_source 1
%define build_slof_from_source 1
%endif

%ifarch ppc64le
%if 0%{?suse_version} > 1320 ||  0%{?suse_version} == 1315
%define build_skiboot_from_source 1
%define build_slof_from_source 1
%endif
%endif

%ifarch %ix86 x86_64 ppc ppc64 ppc64le s390x armv7hl aarch64
%define kvm_available 1
%endif

%ifarch %ix86 x86_64 s390x
%define legacy_qemu_kvm 1
%endif

%if 0%{?suse_version} >= 1315 && 0%{?is_opensuse}
%define with_glusterfs 1
%endif

%ifarch x86_64
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && ( 0%{?is_opensuse} == 0 || 0%{?sle_version} > 120100 ) )
%define with_rbd 1
%endif
%endif

%ifarch aarch64
%if 0%{?suse_version} > 1320 || ( 0%{?is_opensuse} == 0 && 0%{?sle_version} > 120100 )
%define with_rbd 1
%endif
%endif

%ifarch ppc64le
%if 0%{?suse_version} > 1320 || ( 0%{?is_opensuse} == 0 && 0%{?sle_version} > 120200 )
%define with_rbd 1
%endif
%endif

%ifarch s390x
%if 0%{?is_opensuse} == 0 && 0%{?sle_version} > 120200
%define with_rbd 1
%endif
%endif

%ifarch ppc64
%if 0%{?is_opensuse} && 0%{?sle_version} > 120200
%define with_rbd 1
%endif
%endif

%if 0%{?suse_version} > 1320
%define with_seccomp 1
%endif

%ifarch %ix86 x86_64 s390x aarch64 ppc64le
%define with_seccomp 1
%endif

%if 0%( pkg-config --exists 'udev > 190' && echo '1' ) == 01
%define _udevrulesdir /usr/lib/udev/rules.d
%else
%define _udevrulesdir /lib/udev/rules.d
%endif

%define qemuver 3.1.1.1
%define srcver  3.1.1.1
%define sbver   1.12.0_0_ga698c89
%define srcname qemu
Name:           qemu-testsuite
URL:            https://www.qemu.org/
Summary:        Machine emulator and virtualizer
License:        BSD-3-Clause AND GPL-2.0-only AND GPL-2.0-or-later AND LGPL-2.1-or-later AND MIT
Group:          System/Emulators/PC
Version:        %qemuver
Release:        0
Source:         https://wiki.qemu.org/download/%{srcname}-%{srcver}.tar.xz
Source99:       https://wiki.qemu.org/download/%{srcname}-%{srcver}.tar.xz.sig
Source100:      %{srcname}.keyring
Source1:        80-kvm.rules
Source2:        kvm.conf
Source3:        qemu-ifup
Source4:        bridge.conf
Source5:        qemu-kvm.1.gz
Source6:        ksm.service
Source7:        qemu-ga@.service
Source8:        80-qemu-ga.rules
Source9:        qemu-supportconfig
Source10:       supported.arm.txt
Source11:       supported.ppc.txt
Source12:       supported.x86.txt
Source13:       supported.s390.txt
# this is to make lint happy
Source300:      qemu-rpmlintrc
Source400:      bundles.tar.xz
Source401:      update_git.sh
Source402:      config.sh
Source403:      README.PACKAGING
# Upstream First -- https://wiki.qemu.org/Contribute/SubmitAPatch
# This patch queue is auto-generated - see README.PACKAGING for process

# Patches applied in base project:
Patch0000:      0000-9pfs-Fully-restart-unreclaim-loop-C.patch
Patch0001:      0001-XXX-dont-dump-core-on-sigabort.patch
Patch0002:      0002-qemu-binfmt-conf-Modify-default-pat.patch
Patch0003:      0003-qemu-cvs-gettimeofday.patch
Patch0004:      0004-qemu-cvs-ioctl_debug.patch
Patch0005:      0005-qemu-cvs-ioctl_nodirection.patch
Patch0006:      0006-linux-user-add-binfmt-wrapper-for-a.patch
Patch0007:      0007-PPC-KVM-Disable-mmu-notifier-check.patch
Patch0008:      0008-linux-user-binfmt-support-host-bina.patch
Patch0009:      0009-linux-user-Fake-proc-cpuinfo.patch
Patch0010:      0010-Remove-problematic-evdev-86-key-fro.patch
Patch0011:      0011-linux-user-use-target_ulong.patch
Patch0012:      0012-Make-char-muxer-more-robust-wrt-sma.patch
Patch0013:      0013-linux-user-lseek-explicitly-cast-no.patch
Patch0014:      0014-AIO-Reduce-number-of-threads-for-32.patch
Patch0015:      0015-xen_disk-Add-suse-specific-flush-di.patch
Patch0016:      0016-qemu-bridge-helper-reduce-security-.patch
Patch0017:      0017-qemu-binfmt-conf-use-qemu-ARCH-binf.patch
Patch0018:      0018-linux-user-properly-test-for-infini.patch
Patch0019:      0019-roms-Makefile-pass-a-packaging-time.patch
Patch0020:      0020-Raise-soft-address-space-limit-to-h.patch
Patch0021:      0021-increase-x86_64-physical-bits-to-42.patch
Patch0022:      0022-vga-Raise-VRAM-to-16-MiB-for-pc-0.1.patch
Patch0023:      0023-i8254-Fix-migration-from-SLE11-SP2.patch
Patch0024:      0024-acpi_piix4-Fix-migration-from-SLE11.patch
Patch0025:      0025-Fix-tigervnc-long-press-issue.patch
Patch0026:      0026-string-input-visitor-Fix-uint64-par.patch
Patch0027:      0027-test-string-input-visitor-Add-int-t.patch
Patch0028:      0028-test-string-input-visitor-Add-uint6.patch
Patch0029:      0029-tests-Add-QOM-property-unit-tests.patch
Patch0030:      0030-tests-Add-scsi-disk-test.patch
Patch0031:      0031-Switch-order-of-libraries-for-mpath.patch
Patch0032:      0032-Make-installed-scripts-explicitly-p.patch
Patch0033:      0033-hw-smbios-handle-both-file-formats-.patch
Patch0034:      0034-qemu-io-tests-comment-out-problemat.patch
Patch0035:      0035-tests-test-thread-pool-is-racy-add-.patch
Patch0036:      0036-xen-add-block-resize-support-for-xe.patch
Patch0037:      0037-tests-qemu-iotests-Triple-timeout-o.patch
Patch0038:      0038-tests-block-io-test-130-needs-some-.patch
Patch0039:      0039-xen_disk-Avoid-repeated-memory-allo.patch
Patch0040:      0040-xen-ignore-live-parameter-from-xen-.patch
Patch0041:      0041-hw-usb-fix-mistaken-de-initializati.patch
Patch0042:      0042-rdma-check-num_sge-does-not-exceed-.patch
Patch0043:      0043-lsi-use-enum-type-for-s-waiting.patch
Patch0044:      0044-xen-Add-xen-v4.12-based-xc_domain_c.patch
Patch0045:      0045-Revert-target-i386-kvm-add-VMX-migr.patch
Patch0046:      0046-memory-Fix-the-memory-region-type-a.patch
Patch0047:      0047-target-i386-sev-Do-not-pin-the-ram-.patch
Patch0048:      0048-ppc-add-host-serial-and-host-model-.patch
Patch0049:      0049-spapr-Simplify-handling-of-host-ser.patch
Patch0050:      0050-target-i386-define-md-clear-bit.patch
Patch0051:      0051-s390x-cpumodel-add-z14-GA2-model.patch
Patch0052:      0052-i386-kvm-Disable-arch_capabilities-.patch
Patch0053:      0053-i386-Make-arch_capabilities-migrata.patch
Patch0054:      0054-target-i386-add-MDS-NO-feature.patch
Patch0055:      0055-x86-cpu-Enable-MOVDIRI-cpu-feature.patch
Patch0056:      0056-x86-cpu-Enable-MOVDIR64B-cpu-featur.patch
Patch0057:      0057-i386-Add-stibp-flag-name.patch
Patch0058:      0058-target-i386-define-a-new-MSR-based-.patch
Patch0059:      0059-i386-Introduce-SnowRidge-CPU-model.patch
Patch0060:      0060-pvusb-set-max-grants-only-in-initia.patch
Patch0061:      0061-i386-Fix-Snowridge-CPU-model-name-a.patch
Patch0062:      0062-scsi-lsi-exit-infinite-loop-while-e.patch
Patch0063:      0063-include-hw-i386-pc.h-fix-v2.12-era-.patch
Patch0064:      0064-docs-recommend-use-of-md-clear-feat.patch
Patch0065:      0065-target-i386-sev-Do-not-unpin-ram-de.patch
Patch0066:      0066-xen_disk-Disable-file-locking-for-t.patch
Patch0067:      0067-s390-bios-Skip-bootmap-signature-en.patch
Patch0068:      0068-include-update-Linux-headers-to-4.2.patch
Patch0069:      0069-linux-headers-add-linux-mman.h.patch
Patch0070:      0070-linux-headers-update-against-Linux-.patch
Patch0071:      0071-s390x-cpumodel-Miscellaneous-Instru.patch
Patch0072:      0072-s390x-cpumodel-mepochptff-warn-when.patch
Patch0073:      0073-s390x-cpumodel-msa9-facility.patch
Patch0074:      0074-s390x-cpumodel-vector-enhancements.patch
Patch0075:      0075-s390x-cpumodel-enhanced-sort-facili.patch
Patch0076:      0076-s390x-cpumodel-add-Deflate-conversi.patch
Patch0077:      0077-s390x-cpumodel-add-gen15-defintions.patch
Patch0078:      0078-s390x-cpumodel-wire-up-8561-and-856.patch
Patch0079:      0079-s390x-cpumodel-Rework-CPU-feature-d.patch
Patch0080:      0080-s390-cpumodel-fix-description-for-t.patch
Patch0081:      0081-s390x-cpumodel-also-change-name-of-.patch
Patch0082:      0082-s390x-cpumodel-remove-esort-from-th.patch
Patch0083:      0083-pc-bios-s390-ccw-Use-proper-registe.patch
Patch0084:      0084-s390-vfio-ccw-Add-bootindex-propert.patch
Patch0085:      0085-s390-bios-decouple-cio-setup-from-v.patch
Patch0086:      0086-s390-bios-decouple-common-boot-logi.patch
Patch0087:      0087-s390-bios-Clean-up-cio.h.patch
Patch0088:      0088-s390-bios-Decouple-channel-i-o-logi.patch
Patch0089:      0089-s390-bios-Map-low-core-memory.patch
Patch0090:      0090-s390-bios-ptr2u32-and-u32toptr.patch
Patch0091:      0091-s390-bios-Support-for-running-forma.patch
Patch0092:      0092-s390-bios-cio-error-handling.patch
Patch0093:      0093-s390-bios-Extend-find_dev-for-non-v.patch
Patch0094:      0094-s390-bios-Factor-finding-boot-devic.patch
Patch0095:      0095-s390-bios-Refactor-virtio-to-run-ch.patch
Patch0096:      0096-s390-bios-Use-control-unit-type-to-.patch
Patch0097:      0097-s390-bios-Add-channel-command-codes.patch
Patch0098:      0098-s390-bios-Support-booting-from-real.patch
Patch0099:      0099-s390-bios-Use-control-unit-type-to-.patch
Patch0100:      0100-linux-user-fix-__NR_semtimedop-unde.patch
Patch0101:      0101-target-i386-Export-TAA_NO-bit-to-gu.patch
Patch0102:      0102-target-i386-Add-pschange-mc-no-feat.patch
Patch0103:      0103-include-revert-part-of-the-linux-he.patch
Patch0104:      0104-scsi-disk-pass-sense-correctly-for-.patch
Patch0105:      0105-scsi-explicitly-list-guest-recovera.patch
Patch0106:      0106-scsi-add-guest-recoverable-ZBC-erro.patch
Patch0107:      0107-iscsi-fix-busy-timeout-task-set-ful.patch
Patch0108:      0108-iscsi-base-all-handling-of-check-co.patch
Patch0109:      0109-slirp-fix-big-little-endian-convers.patch
Patch0110:      0110-slirp-ensure-there-is-enough-space-.patch
Patch0111:      0111-slirp-don-t-manipulate-so_rcv-in-tc.patch
Patch0112:      0112-util-add-slirp_fmt-helpers.patch
Patch0113:      0113-tcp_emu-Fix-oob-access.patch
Patch0114:      0114-slirp-use-correct-size-while-emulat.patch
Patch0115:      0115-slirp-use-correct-size-while-emulat.patch
Patch0116:      0116-tcp_emu-fix-unsafe-snprintf-usages.patch
Patch0117:      0117-display-bochs-fix-pcie-support.patch
Patch0118:      0118-vnc-fix-memory-leak-when-vnc-discon.patch
Patch0119:      0119-iscsi-Cap-block-count-from-GET-LBA-.patch
Patch0120:      0120-tests-qemu-iotests-common.filter-ad.patch
Patch0121:      0121-pc-bios-s390x-Save-iplb-location-in.patch
Patch0122:      0122-Revert-i386-Add-CPUID-bit-for-PCONF.patch
Patch0123:      0123-i386-Disable-OSPKE-on-CPU-model-def.patch
Patch0124:      0124-i386-indicate-that-pconfig-feature-.patch
Patch0125:      0125-Fix-use-afte-free-in-ip_reass-CVE-2.patch
Patch0126:      0126-migration-Rate-limit-inside-host-pa.patch
Patch0127:      0127-es1370-check-total-frame-count-agai.patch
Patch0128:      0128-hw-core-loader-Fix-possible-crash-i.patch
Patch0129:      0129-usb-fix-setup_len-init-CVE-2020-143.patch
Patch0130:      0130-hw-net-net_tx_pkt-fix-assertion-fai.patch
Patch0131:      0131-hw-net-xgmac-Fix-buffer-overflow-in.patch
Patch0132:      0132-vfio-Make-vfio_get_region_info_cap-.patch
Patch0133:      0133-s390x-pci-rename-hotplug-handler-ca.patch
Patch0134:      0134-s390x-pci-Use-hotplug_dev-instead-o.patch
Patch0135:      0135-s390-avoid-potential-null-dereferen.patch
Patch0136:      0136-s390x-pci-Always-delete-and-free-th.patch
Patch0137:      0137-s390x-pci-add-common-function-measu.patch
Patch0138:      0138-s390x-pci-Move-some-hotplug-checks-.patch
Patch0139:      0139-s390x-pci-Ignore-the-unplug-call-if.patch
Patch0140:      0140-s390x-pci-Introduce-unplug-requests.patch
Patch0141:      0141-Makefile-generate-header-file-with-.patch
Patch0142:      0142-i386-kvm-support-guest-access-CORE-.patch
Patch0143:      0143-linux-headers-update-against-v5.4-r.patch
Patch0144:      0144-linux-headers-Update.patch
Patch0145:      0145-linux-headers-Update.patch
Patch0146:      0146-linux-headers-update.patch
Patch0147:      0147-linux-headers-update-against-Linux-.patch
Patch0148:      0148-Linux-headers-update.patch
Patch0149:      0149-linux-headers-sync-to-5.9-rc4.patch
Patch0150:      0150-linux-headers-sync-to-5.9-rc7.patch
Patch0151:      0151-linux-headers-update-against-5.10-r.patch
Patch0152:      0152-vfio-Create-shared-routine-for-scan.patch
Patch0153:      0153-vfio-Find-DMA-available-capability.patch
Patch0154:      0154-s390x-pci-Add-routine-to-get-the-vf.patch
Patch0155:      0155-s390x-pci-Move-header-files-to-incl.patch
Patch0156:      0156-s390x-pci-Honor-DMA-limits-set-by-v.patch
Patch0157:      0157-s390x-fix-build-for-without-default.patch
Patch0158:      0158-s390x-s390-virtio-ccw-Reset-PCI-dev.patch
Patch0159:      0159-scsi-disk-Convert-from-DPRINTF-macr.patch
Patch0160:      0160-scsi-generic-Convert-from-DPRINTF-m.patch
Patch0161:      0161-virtio-scsi-trace-events.patch
Patch0162:      0162-scsi-make-io_timeout-settable.patch
Patch0163:      0163-scsi-add-tracing-for-SG_IO-commands.patch
Patch0164:      0164-scsi-disk-set-default-I-O-timeout-t.patch
Patch0165:      0165-virtio-scsi-translate-SG_IO-host-st.patch
Patch0166:      0166-scsi-generic-check-for-additional-S.patch
Patch0167:      0167-scsi-disk-fold-SG_IO-errors-back-in.patch
Patch0168:      0168-scsi-disk-trace-rw-errors.patch
Patch0169:      0169-virtio-scsi-change-DID-TIMEOUT-hand.patch
Patch0170:      0170-hw-intc-arm_gic-Fix-interrupt-ID-in.patch
Patch0171:      0171-sm501-Convert-printf-abort-to-qemu_.patch
Patch0172:      0172-sm501-Shorten-long-variable-names-i.patch
Patch0173:      0173-sm501-Use-BIT-x-macro-to-shorten-co.patch
Patch0174:      0174-sm501-Clean-up-local-variables-in-s.patch
Patch0175:      0175-sm501-Replace-hand-written-implemen.patch
Patch0176:      0176-megasas-use-unsigned-type-for-reply.patch
Patch0177:      0177-hw-xhci-check-return-value-of-usb_p.patch
Patch0178:      0178-hw-ehci-check-return-value-of-usb_p.patch
Patch0179:      0179-hw-usb-hcd-ohci-check-len-and-frame.patch
Patch0180:      0180-hw-usb-hcd-ohci-check-for-processed.patch
Patch0181:      0181-net-remove-an-assert-call-in-eth_ge.patch
Patch0182:      0182-hw-net-e1000e-advance-desc_offset-i.patch
Patch0183:      0183-ide-atapi-assert-that-the-buffer-po.patch
Patch0184:      0184-memory-clamp-cached-translation-in-.patch
Patch0185:      0185-hw-pci-host-add-pci-intack-write-me.patch
Patch0186:      0186-pci-host-designware-add-pcie-msi-re.patch
Patch0187:      0187-vfio-add-quirk-device-write-method.patch
Patch0188:      0188-prep-add-ppc-parity-write-method.patch
Patch0189:      0189-spapr_pci-add-spapr-msi-read-method.patch
Patch0190:      0190-hw-misc-tz-ppc-Support-having-unuse.patch
Patch0191:      0191-tz-ppc-add-dummy-read-write-methods.patch
Patch0192:      0192-imx7-ccm-add-digprog-mmio-write-met.patch
Patch0193:      0193-e1000-fail-early-for-evil-descripto.patch
Patch0194:      0194-net-introduce-qemu_receive_packet.patch
Patch0195:      0195-rtl8139-switch-to-use-qemu_receive_.patch
Patch0196:      0196-e1000-switch-to-use-qemu_receive_pa.patch
Patch0197:      0197-dp8393x-switch-to-use-qemu_receive_.patch
Patch0198:      0198-sungem-switch-to-use-qemu_receive_p.patch
Patch0199:      0199-tx_pkt-switch-to-use-qemu_receive_p.patch
Patch0200:      0200-pcnet-switch-to-use-qemu_receive_pa.patch
Patch0201:      0201-cadence_gem-switch-to-use-qemu_rece.patch
Patch0202:      0202-lan9118-switch-to-use-qemu_receive_.patch
Patch0203:      0203-slirp-check-pkt_len-before-reading-.patch
Patch0204:      0204-exec-set-map-length-to-zero-when-re.patch
Patch0205:      0205-pc-bios-s390-ccw-fix-off-by-one-err.patch
Patch0206:      0206-pc-bios-s390-ccw-break-loop-if-a-nu.patch
Patch0207:      0207-block-iscsi-fix-heap-buffer-overflo.patch
Patch0208:      0208-net-vmxnet3-validate-configuration-.patch
Patch0209:      0209-revert-s390x-fix-build-for-without-.patch
Patch0210:      0210-Drop-bogus-IPv6-messages.patch
# Patches applied in roms/seabios/:
Patch1000:      1000-seabios-use-python2-explicitly-as-n.patch
Patch1001:      1001-seabios-switch-to-python3-as-needed.patch
Patch1002:      1002-seabios-fix_cross_compilation.patch
# Patches applied in roms/ipxe/:
Patch2000:      2000-ipxe-stub-out-the-SAN-req-s-in-int1.patch
Patch2001:      2001-ipxe-stable-buildid.patch
Patch2002:      2002-ipxe-use-gcc6-for-more-compact-code.patch
Patch2003:      2003-ipxe-efi-guard-strncpy-with-gcc-war.patch
Patch2004:      2004-ipxe-fix-build.patch
Patch2005:      2005-ipxe-efi-Simplify-diagnostic-for-NU.patch
Patch2006:      2006-ipxe-build-Disable-gcc-address-of-p.patch
# Patches applied in roms/sgabios/:
Patch3000:      3000-sgabios-stable-buildid.patch
Patch3001:      3001-sgabios-fix-cross-build.patch
# Patches applied in roms/skiboot/:
Patch4000:      4000-hdata-i2c.c-fix-building-with-gcc8.patch

# Please do not add patches manually here.

ExcludeArch:    s390
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#!BuildIgnore:  gcc-PIE
BuildRequires:  Mesa-devel
%if 0%{?is_opensuse}
BuildRequires:  SDL-devel
%if 0%{?suse_version} >= 1320
BuildRequires:  SDL2-devel
%endif
%endif
BuildRequires:  alsa-devel
%if %{build_x86_firmware_from_source}
BuildRequires:  acpica
BuildRequires:  binutils-devel
%ifnarch %{ix86} x86_64
# We must cross-compile on non-x86*
BuildRequires:  cross-x86_64-binutils
BuildRequires:  cross-x86_64-gcc7
%endif
%endif
BuildRequires:  bluez-devel
BuildRequires:  brlapi-devel
BuildRequires:  curl-devel
BuildRequires:  cyrus-sasl-devel
BuildRequires:  fdupes
BuildRequires:  gcc-c++
%if %{build_x86_firmware_from_source}
%if 0%{?suse_version} <= 1320
BuildRequires:  gcc6
%endif
%endif
BuildRequires:  glib2-devel
%if 0%{?with_glusterfs}
BuildRequires:  glusterfs-devel
%endif
BuildRequires:  gtk3-devel
BuildRequires:  libaio-devel
BuildRequires:  libattr-devel
BuildRequires:  libbz2-devel
%if 0%{?is_opensuse}
BuildRequires:  libcacard-devel
%endif
BuildRequires:  libcap-devel
BuildRequires:  libcap-ng-devel
BuildRequires:  libdrm-devel
%if 0%{?suse_version} >= 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
BuildRequires:  libepoxy-devel
%endif
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120200 )
BuildRequires:  libfdt-devel
%else
BuildRequires:  libfdt1-devel
%endif
BuildRequires:  libgbm-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  libgnutls-devel
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
BuildRequires:  libiscsi-devel
%endif
BuildRequires:  libjpeg-devel
%if 0%{?is_opensuse}
BuildRequires:  libnfs-devel
%endif
%ifarch %ix86 x86_64
%if 0%{?suse_version} > 1320 || 0%{?suse_version} == 1315
BuildRequires:  libnuma-devel
%endif
%else
%ifarch aarch64
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
BuildRequires:  libnuma-devel
%endif
%endif
%else
%ifnarch %arm s390x
BuildRequires:  libnuma-devel
%endif
%endif
BuildRequires:  libpixman-1-0-devel
%ifarch x86_64
BuildRequires:  libpmem-devel
%endif
BuildRequires:  libpng-devel
BuildRequires:  libpulse-devel
%if 0%{?with_rbd}
%if 0%{?is_opensuse} || 0%{?sle_version} > 120100
BuildRequires:  librbd-devel
%else
BuildRequires:  ceph-devel
%endif
%endif
%if 0%{?with_seccomp}
BuildRequires:  libseccomp-devel
%endif
BuildRequires:  libspice-server-devel
BuildRequires:  libssh2-devel
BuildRequires:  libudev-devel
BuildRequires:  libusb-1_0-devel
%if 0%{?suse_version} > 1320
BuildRequires:  libvdeplug-devel
%else
BuildRequires:  libvdeplug3-devel
%endif
BuildRequires:  libxkbcommon-devel
BuildRequires:  lzo-devel
BuildRequires:  makeinfo
%if 0%{?suse_version} > 1320
BuildRequires:  multipath-tools-devel
%endif
BuildRequires:  ncurses-devel
%if %{build_x86_firmware_from_source}
BuildRequires:  ovmf-tools
%endif
BuildRequires:  pkgconfig
BuildRequires:  pwdutils
%if 0%{?suse_version} > 1320
BuildRequires:  python3-base
%else
BuildRequires:  python-base
%endif
%if 0%{?suse_version} >= 1315
BuildRequires:  rdma-core-devel
%endif
BuildRequires:  snappy-devel
BuildRequires:  spice-protocol-devel
BuildRequires:  systemd
%{?systemd_requires}
%if %{kvm_available}
BuildRequires:  pkgconfig(udev)
%endif
BuildRequires:  usbredir-devel
%if 0%{?suse_version} >= 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
BuildRequires:  virglrenderer-devel >= 0.4.1
%endif
BuildRequires:  vte-devel
%ifarch x86_64
BuildRequires:  xen-devel
%endif
BuildRequires:  xfsprogs-devel
%if %{build_x86_firmware_from_source}
BuildRequires:  xz-devel
%endif
BuildRequires:  zlib-devel
%if "%{name}" == "qemu-testsuite"
%if 0%{?suse_version} > 1320
BuildRequires:  python-base
%endif
BuildRequires:  bc
BuildRequires:  qemu-arm   = %{qemuver}
BuildRequires:  qemu-block-curl = %{qemuver}
BuildRequires:  qemu-block-dmg = %{qemuver}
%if 0%{?with_glusterfs}
BuildRequires:  qemu-block-gluster = %{qemuver}
%endif
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
BuildRequires:  qemu-block-iscsi = %{qemuver}
%endif
%if 0%{?is_opensuse}
BuildRequires:  qemu-block-nfs = %{qemuver}
%endif
%if 0%{?with_rbd}
BuildRequires:  qemu-block-rbd = %{qemuver}
%endif
BuildRequires:  qemu-block-ssh = %{qemuver}
BuildRequires:  qemu-extra = %{qemuver}
BuildRequires:  qemu-guest-agent = %{qemuver}
BuildRequires:  qemu-ppc   = %{qemuver}
BuildRequires:  qemu-s390  = %{qemuver}
BuildRequires:  qemu-tools = %{qemuver}
BuildRequires:  qemu-ui-curses = %{qemuver}
BuildRequires:  qemu-ui-gtk = %{qemuver}
%if 0%{?is_opensuse}
BuildRequires:  qemu-ui-sdl = %{qemuver}
%endif
BuildRequires:  qemu-x86    = %{qemuver}
%endif
Requires(pre):  shadow
Requires(post): coreutils
%if %{kvm_available}
Requires(post): acl
Requires(post): udev
%ifarch s390x
Requires(post): procps
%endif
Recommends:     kvm_stat
%endif
Recommends:     qemu-block-curl
Recommends:     qemu-tools
Recommends:     qemu-ui-curses
Recommends:     qemu-ui-gtk
%if 0%{?is_opensuse}
Recommends:     qemu-ui-sdl
%else
Obsoletes:      qemu-audio-sdl <= %{qemuver}
Obsoletes:      qemu-ui-sdl    <= %{qemuver}
%endif
Recommends:     qemu-x86
%ifarch ppc ppc64 ppc64le
Recommends:     qemu-ppc
%else
Suggests:       qemu-ppc
%endif
%ifarch s390x
Recommends:     qemu-s390
%else
Suggests:       qemu-s390
%endif
%ifarch %arm aarch64
Recommends:     qemu-arm
%else
Suggests:       qemu-arm
%endif
Suggests:       qemu-block-dmg
%if 0%{?with_glusterfs}
Suggests:       qemu-block-gluster
%endif
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
Suggests:       qemu-block-iscsi
%endif
%if 0%{?is_opensuse}
Suggests:       qemu-block-nfs
%endif
%if 0%{?with_rbd}
Suggests:       qemu-block-rbd
%endif
Suggests:       qemu-block-ssh
Suggests:       qemu-extra
Suggests:       qemu-lang
%if 0%{?is_opensuse}
Recommends:     qemu-ksm = %{qemuver}
%endif

%define ppc_default_built_firmware {%nil}
%if %{build_skiboot_from_source} && %{build_slof_from_source}
%define ppc_extra_built_firmware {skiboot.lid slof.bin}
%else
%if %{build_skiboot_from_source}
%define ppc_extra_built_firmware {skiboot.lid}
%endif
%if %{build_slof_from_source}
%define ppc_extra_built_firmware {slof.bin}
%endif
%endif

%ifarch ppc64
%define ppc64_only_default_built_firmware {spapr-rtas.bin}
%define ppc64_only_extra_built_firmware {%nil}
%endif

%ifarch s390x
%define s390x_default_built_firmware {s390-ccw.img s390-netboot.img}
%define s390x_extra_built_firmware {%nil}
%endif

%ifarch %ix86 x86_64
%define x86_default_built_firmware {linuxboot.bin linuxboot_dma.bin \
multiboot.bin kvmvapic.bin}
%ifarch x86_64
%define x86_64_only_default_built_firmware {%nil}
%endif
%endif

%define x86_extra_built_firmware_list {bios.bin bios-256k.bin pxe-e1000.rom \
pxe-eepro100.rom pxe-ne2k_pci.rom pxe-pcnet.rom pxe-rtl8139.rom pxe-virtio.rom \
sgabios.bin vgabios-bochs-display.bin vgabios.bin vgabios-cirrus.bin \
vgabios-qxl.bin vgabios-ramfb.bin vgabios-stdvga.bin vgabios-virtio.bin \
vgabios-vmware.bin}
%define x86_64_only_extra_built_firmware_list {efi-e1000.rom efi-e1000e.rom \
efi-eepro100.rom efi-ne2k_pci.rom efi-pcnet.rom efi-rtl8139.rom efi-virtio.rom \
efi-vmxnet3.rom}

%if %{build_x86_firmware_from_source}
%define x86_extra_built_firmware %{x86_extra_built_firmware_list}
%ifarch x86_64
%define x86_64_only_extra_built_firmware %{x86_64_only_extra_built_firmware_list}
%endif
%endif

%define built_firmware { \
%{?ppc_default_built_firmware} %{?ppc_extra_built_firmware} \
%{?ppc64_only_default_built_firmware} %{?ppc64_only_extra_built_firmware} \
%{?s390x_default_built_firmware} %{?s390x_extra_built_firmware} \
%{?x86_default_built_firmware} %{?x86_extra_built_firmware} \
%{?x86_64_only_default_built_firmware} %{?x86_64_only_extra_built_firmware} }

%description
QEMU provides full machine emulation and cross architecture usage. It closely
integrates with KVM and Xen virtualization, allowing for excellent performance.
Many options are available for defining the emulated environment, including
traditional devices, direct host device access, and interfaces specific to
virtualization.

This package acts as an umbrella package to the other QEMU sub-packages.

%if "%{name}" != "qemu-testsuite"

%package x86
Summary:        Machine emulator and virtualizer for x86 architectures
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
Requires:       %name = %{qemuver}
Requires:       qemu-ipxe
Requires:       qemu-seabios
Requires:       qemu-sgabios
Requires:       qemu-vgabios
Recommends:     ovmf
Recommends:     qemu-ovmf-x86_64

%description x86
QEMU provides full machine emulation and cross architecture usage. It closely
integrates with KVM and Xen virtualization, allowing for excellent performance.
Many options are available for defining the emulated environment, including
traditional devices, direct host device access, and interfaces specific to
virtualization.

This package provides i386 and x86_64 emulation.

%package ppc
Summary:        Machine emulator and virtualizer for Power architectures
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
Requires:       %name = %{qemuver}
Recommends:     qemu-ipxe
Recommends:     qemu-vgabios

%description ppc
QEMU provides full machine emulation and cross architecture usage. It closely
integrates with KVM and Xen virtualization, allowing for excellent performance.
Many options are available for defining the emulated environment, including
traditional devices, direct host device access, and interfaces specific to
virtualization.

This package provides ppc and ppc64 emulation.

%package s390
Summary:        Machine emulator and virtualizer for S/390 architectures
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
Requires:       %name = %{qemuver}

%description s390
QEMU provides full machine emulation and cross architecture usage. It closely
integrates with KVM and Xen virtualization, allowing for excellent performance.
Many options are available for defining the emulated environment, including
traditional devices, direct host device access, and interfaces specific to
virtualization.

This package provides s390x emulation.

%package arm
Summary:        Machine emulator and virtualizer for ARM architectures
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
Requires:       %name = %{qemuver}
Recommends:     ovmf
Recommends:     qemu-ipxe
Recommends:     qemu-uefi-aarch64
Recommends:     qemu-vgabios

%description arm
QEMU provides full machine emulation and cross architecture usage. It closely
integrates with KVM and Xen virtualization, allowing for excellent performance.
Many options are available for defining the emulated environment, including
traditional devices, direct host device access, and interfaces specific to
virtualization.

This package provides arm emulation.

%package extra
Summary:        Machine emulator and virtualizer for "extra" architectures
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
Requires:       %name = %{qemuver}
Recommends:     qemu-ipxe
Recommends:     qemu-vgabios

%description extra
QEMU provides full machine emulation and cross architecture usage. It closely
integrates with KVM and Xen virtualization, allowing for excellent performance.
Many options are available for defining the emulated environment, including
traditional devices, direct host device access, and interfaces specific to
virtualization.

This package provides some lesser used emulations, including alpha, m68k,
mips, moxie, sparc, and xtensa. (The term "extra" is juxtapositioned against
more popular QEMU packages which are dedicated to a single architecture.)

%if %{legacy_qemu_kvm}
%package kvm
Summary:        Wrapper to enable KVM acceleration under QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%ifarch %ix86 x86_64
Requires:       qemu-x86 = %{qemuver}
%endif
%ifarch s390x
Requires:       qemu-s390 = %{qemuver}
%endif
Provides:       kvm = %{qemuver}
Obsoletes:      kvm < %{qemuver}

%description kvm
QEMU provides full machine emulation and cross architecture usage. It closely
integrates with KVM and Xen virtualization, allowing for excellent performance.
Many options are available for defining the emulated environment, including
traditional devices, direct host device access, and interfaces specific to
virtualization.

This package simply provides a shell script wrapper for the QEMU program which
does the actual machine emulation and virtualization for this architecture. The
wrapper simply adds command-line parameters to ensure that the KVM accelerator
is invoked. It provides no additional benefit, and is considered deprecated.
%endif

%package lang
Summary:        Translations for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0

%description lang
This package contains a few language translations, particularly for the
graphical user interface components that come with QEMU. The bulk of strings
in QEMU are not localized.

# Modules need to match {qemu-system-*,qemu-img} version.
# We cannot have qemu and qemu-tools require them in the right version,
# as that would drag in the dependencies the modules are supposed to avoid.
# Nor can we have modules require the right version of qemu and qemu-tools
# as Xen reuses our qemu-tools but does not want our qemu and qemu-x86.
%define qemu_module_conflicts \
Conflicts:      %name < %{qemuver}-%{release} \
Conflicts:      %name > %{qemuver}-%{release} \
Conflicts:      qemu-tools < %{qemuver}-%{release} \
Conflicts:      qemu-tools > %{qemuver}-%{release}

%package block-curl
Summary:        cURL block support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
Provides:       %name:%_libdir/%name/block-curl.so
%{qemu_module_conflicts}

%description block-curl
This package contains a module for accessing network-based image files over
a network connection from qemu-img tool and QEMU system emulation.

%package block-dmg
Summary:        DMG block support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description block-dmg
This package contains a module for accessing Mac OS X image files from
qemu-img tool and QEMU system emulation.

%if 0%{?with_glusterfs}
%package block-gluster
Summary:        GlusterFS block support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description block-gluster
This package contains a module for accessing network-based image files over a
GlusterFS network connection from qemu-img tool and QEMU system emulation.
%endif

%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
%package block-iscsi
Summary:        iSCSI block support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description block-iscsi
This package contains a module for accessing network-based image files over an
iSCSI network connection from qemu-img tool and QEMU system emulation.
%endif

%if 0%{?is_opensuse}
%package block-nfs
Summary:        direct Network File System support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description block-nfs
This package contains a module for directly accessing nfs based image files.
%endif

%if 0%{?with_rbd}
%package block-rbd
Summary:        Rados Block Device (Ceph) support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description block-rbd
This package contains a module for accessing ceph (rbd,rados) image files.
%endif

%package block-ssh
Summary:        SSH (SFTP) block support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description block-ssh
This package contains a module for accessing network-based image files over an
SSH network connection from qemu-img tool and QEMU system emulation.

%package ui-curses
Summary:        Curses based UI support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description ui-curses
This package contains a module for doing curses based UI for QEMU.

%package ui-gtk
Summary:        GTK based UI support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description ui-gtk
This package contains a module for doing GTK based UI for QEMU.

%if 0%{?is_opensuse}
%package ui-sdl
Summary:        SDL based UI support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description ui-sdl
This package contains a module for doing SDL based UI for QEMU.
%endif

%package audio-alsa
Summary:        ALSA based audio support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description audio-alsa
This package contains a module for ALSA based audio support for QEMU.

%package audio-oss
Summary:        OSS based audio support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description audio-oss
This package contains a module for OSS based audio support for QEMU.

%package audio-pa
Summary:        Pulse Audio based audio support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description audio-pa
This package contains a module for Pulse Audio based audio support for QEMU.

%if 0%{?is_opensuse}
%package audio-sdl
Summary:        SDL based audio support for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
%{qemu_module_conflicts}

%description audio-sdl
This package contains a module for SDL based audio support for QEMU.
%endif

%package tools
Summary:        Tools for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
Provides:       %name:%_libexecdir/qemu-bridge-helper
Requires(pre):  permissions
Requires(pre):  shadow
%if 0%{?suse_version} > 1320
Recommends:     multipath-tools
%endif
Recommends:     qemu-block-curl
%if 0%{?with_rbd}
Recommends:     qemu-block-rbd
%endif

%description tools
This package contains various QEMU related tools, including a bridge helper,
a virtfs helper, ivshmem, disk utilities and scripts for various purposes.

%package guest-agent
Summary:        Guest agent for QEMU
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
Provides:       %name:%_bindir/qemu-ga
Requires(pre):  shadow
Requires(post): udev
Supplements:    modalias(acpi*:QEMU0002%3A*)
Supplements:    modalias(pci:v00005853d00000001sv*sd*bc*sc*i*)
Supplements:    modalias(pci:v0000FFFDd00000101sv*sd*bc*sc*i*)
%{?systemd_requires}

%description guest-agent
This package contains the QEMU guest agent. It is installed in the linux guest
to provide information and control at the guest OS level.

%ifarch %{build_rom_arch}
%package seabios
Summary:        x86 Legacy BIOS for QEMU
Group:          System/Emulators/PC
Version:        %{sbver}
Release:        0
BuildArch:      noarch
Conflicts:      %name < 1.6.0

%description seabios
SeaBIOS is an open source implementation of a 16bit x86 BIOS. SeaBIOS
is the default and legacy BIOS for QEMU.

%package vgabios
Summary:        VGA BIOSes for QEMU
Group:          System/Emulators/PC
Version:        %{sbver}
Release:        0
BuildArch:      noarch
Conflicts:      %name < 1.6.0

%description vgabios
VGABIOS provides the video ROM BIOSes for the following variants of VGA
emulated devices: Std VGA, QXL, Cirrus CLGD 5446 and VMware emulated
video card.

%package sgabios
Summary:        Serial Graphics Adapter BIOS for QEMU
Group:          System/Emulators/PC
Version:        8
Release:        0
BuildArch:      noarch
Conflicts:      %name < 1.6.0

%description sgabios
The Google Serial Graphics Adapter BIOS or SGABIOS provides a means for legacy
x86 software to communicate with an attached serial console as if a video card
were attached.

%package ipxe
Summary:        PXE ROMs for QEMU NICs
Group:          System/Emulators/PC
Version:        1.0.0+
Release:        0
BuildArch:      noarch
Conflicts:      %name < 1.6.0

%description ipxe
Provides Preboot Execution Environment (PXE) ROM support for various emulated
network adapters available with QEMU.
%endif

%if 0%{?is_opensuse}
%package ksm
Summary:        Kernel Samepage Merging services
Group:          System/Emulators/PC
Version:        %{qemuver}
Release:        0
Requires(pre):  coreutils
Requires(post): coreutils

%description ksm
Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature, that
merges anonymous (private) pages (not pagecache ones).

This package provides a service file for starting and stopping KSM.
%endif

%endif # !qemu-testsuite

%prep
%setup -q -n %{srcname}-%{expand:%%(SV=%{srcver};echo ${SV%%%%+git*})}
%patch0000 -p1
%patch0001 -p1
%patch0002 -p1
%patch0003 -p1
%patch0004 -p1
%patch0005 -p1
%patch0006 -p1
%patch0007 -p1
%patch0008 -p1
%patch0009 -p1
%patch0010 -p1
%patch0011 -p1
%patch0012 -p1
%patch0013 -p1
%patch0014 -p1
%patch0015 -p1
%patch0016 -p1
%patch0017 -p1
%patch0018 -p1
%patch0019 -p1
%patch0020 -p1
%patch0021 -p1
%patch0022 -p1
%patch0023 -p1
%patch0024 -p1
%patch0025 -p1
%patch0026 -p1
%patch0027 -p1
%patch0028 -p1
%patch0029 -p1
%patch0030 -p1
%patch0031 -p1
%patch0032 -p1
%patch0033 -p1
%patch0034 -p1
%patch0035 -p1
%patch0036 -p1
%patch0037 -p1
%patch0038 -p1
%patch0039 -p1
%patch0040 -p1
%patch0041 -p1
%patch0042 -p1
%patch0043 -p1
%patch0044 -p1
%patch0045 -p1
%patch0046 -p1
%patch0047 -p1
%patch0048 -p1
%patch0049 -p1
%patch0050 -p1
%patch0051 -p1
%patch0052 -p1
%patch0053 -p1
%patch0054 -p1
%patch0055 -p1
%patch0056 -p1
%patch0057 -p1
%patch0058 -p1
%patch0059 -p1
%patch0060 -p1
%patch0061 -p1
%patch0062 -p1
%patch0063 -p1
%patch0064 -p1
%patch0065 -p1
%patch0066 -p1
%if 0%{?suse_version} == 1315
%patch0067 -p1
%endif
%patch0068 -p1
%patch0069 -p1
%patch0070 -p1
%patch0071 -p1
%patch0072 -p1
%patch0073 -p1
%patch0074 -p1
%patch0075 -p1
%patch0076 -p1
%patch0077 -p1
%patch0078 -p1
%patch0079 -p1
%patch0080 -p1
%patch0081 -p1
%patch0082 -p1
%patch0083 -p1
%patch0084 -p1
%patch0085 -p1
%patch0086 -p1
%patch0087 -p1
%patch0088 -p1
%patch0089 -p1
%patch0090 -p1
%patch0091 -p1
%patch0092 -p1
%patch0093 -p1
%patch0094 -p1
%patch0095 -p1
%patch0096 -p1
%patch0097 -p1
%patch0098 -p1
%patch0099 -p1
%patch0100 -p1
%patch0101 -p1
%patch0102 -p1
%patch0103 -p1
%patch0104 -p1
%patch0105 -p1
%patch0106 -p1
%patch0107 -p1
%patch0108 -p1
%patch0109 -p1
%patch0110 -p1
%patch0111 -p1
%patch0112 -p1
%patch0113 -p1
%patch0114 -p1
%patch0115 -p1
%patch0116 -p1
%patch0117 -p1
%patch0118 -p1
%patch0119 -p1
%patch0120 -p1
%patch0121 -p1
%patch0122 -p1
%patch0123 -p1
%patch0124 -p1
%patch0125 -p1
%patch0126 -p1
%patch0127 -p1
%patch0128 -p1
%patch0129 -p1
%patch0130 -p1
%patch0131 -p1
%if 0%{?suse_version} == 1315
%patch0132 -p1
%patch0133 -p1
%patch0134 -p1
%patch0135 -p1
%patch0136 -p1
%patch0137 -p1
%patch0138 -p1
%patch0139 -p1
%patch0140 -p1
%patch0141 -p1
%patch0142 -p1
%patch0143 -p1
%patch0144 -p1
%patch0145 -p1
%patch0146 -p1
%patch0147 -p1
%patch0148 -p1
%patch0149 -p1
%patch0150 -p1
%patch0151 -p1
%patch0152 -p1
%patch0153 -p1
%patch0154 -p1
%patch0155 -p1
%patch0156 -p1
%patch0157 -p1
%patch0158 -p1
%endif
%patch0159 -p1
%patch0160 -p1
%patch0161 -p1
%patch0162 -p1
%patch0163 -p1
%patch0164 -p1
%patch0165 -p1
%patch0166 -p1
%patch0167 -p1
%patch0168 -p1
%patch0169 -p1
%patch0170 -p1
%patch0171 -p1
%patch0172 -p1
%patch0173 -p1
%patch0174 -p1
%patch0175 -p1
%patch0176 -p1
%patch0177 -p1
%patch0178 -p1
%patch0179 -p1
%patch0180 -p1
%patch0181 -p1
%patch0182 -p1
%patch0183 -p1
%patch0184 -p1
%patch0185 -p1
%patch0186 -p1
%patch0187 -p1
%patch0188 -p1
%patch0189 -p1
%patch0190 -p1
%patch0191 -p1
%patch0192 -p1
%patch0193 -p1
%patch0194 -p1
%patch0195 -p1
%patch0196 -p1
%patch0197 -p1
%patch0198 -p1
%patch0199 -p1
%patch0200 -p1
%patch0201 -p1
%patch0202 -p1
%patch0203 -p1
%patch0204 -p1
%patch0205 -p1
%patch0206 -p1
%patch0207 -p1
%patch0208 -p1
%if 0%{?suse_version} == 1315
%patch0209 -p1
%endif
%patch0210 -p1
%patch1000 -p1
%if 0%{?suse_version} > 1320
%patch1001 -p1
%endif
%patch1002 -p1
%if 0%{?patch-possibly-applied-elsewhere}
%patch2000 -p1
%endif
%patch2001 -p1
%if 0%{?suse_version} <= 1320
%patch2002 -p1
%endif
%patch2003 -p1
%patch2004 -p1
%patch2005 -p1
%patch2006 -p1
%patch3000 -p1
%patch3001 -p1
%patch4000 -p1

# as a safeguard, delete the firmware files that we intend to build
for i in %built_firmware
do
  unlink pc-bios/$i
done

%build
XC_COMPAT="
-DXC_WANT_COMPAT_DEVICEMODEL_API=1
-DXC_WANT_COMPAT_EVTCHN_API=1
-DXC_WANT_COMPAT_GNTTAB_API=1
-DXC_WANT_COMPAT_MAP_FOREIGN_API=1
"
XC_COMPAT="`echo ${XC_COMPAT} | xargs`"
sed -i~ /undef/d include/hw/xen/xen_common.h
diff -u include/hw/xen/xen_common.h~ include/hw/xen/xen_common.h || :
./configure \
	--prefix=%_prefix \
	--sysconfdir=%_sysconfdir \
	--libdir=%_libdir \
	--libexecdir=%_libexecdir \
	--localstatedir=%_localstatedir \
	--docdir=%_docdir/%name \
	--firmwarepath=%_datadir/%name \
%if 0%{?suse_version} > 1320
        --python=%_bindir/python3 \
%else
        --python=%_bindir/python2 \
%endif
	--extra-cflags="%{optflags} ${XC_COMPAT}" \
	--disable-stack-protector \
	--disable-strip \
	--with-pkgversion="%(echo '%{distro}' | sed 's/ (.*)//')" \
	--enable-system --disable-linux-user \
	--enable-tools --enable-guest-agent \
	--enable-modules \
	--enable-pie \
	--enable-docs \
%if 0%{?is_opensuse}
	--audio-drv-list="pa alsa sdl oss" \
%else
	--audio-drv-list="pa alsa oss" \
%endif
	--enable-attr \
	--enable-bluez \
	--enable-bochs \
	--enable-brlapi \
	--enable-bzip2 \
	--enable-cap-ng \
	--disable-capstone \
	--enable-cloop \
	--enable-coroutine-pool \
	--disable-crypto-afalg \
	--enable-curl \
	--enable-curses \
	--enable-dmg \
	--enable-fdt \
	--enable-gcrypt \
%if 0%{?with_glusterfs}
	--enable-glusterfs \
%else
	--disable-glusterfs \
%endif
	--enable-gnutls \
	--enable-gtk \
	--disable-hax \
	--disable-hvf \
	--disable-jemalloc \
%if %{kvm_available}
	--enable-kvm \
%else
	--disable-kvm \
%endif
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
	--enable-libiscsi \
%else
	--disable-libiscsi \
%endif
%if 0%{?is_opensuse}
	--enable-libnfs \
%else
	--disable-libnfs \
%endif
%ifarch x86_64
	--enable-libpmem \
%else
	--disable-libpmem \
%endif
	--enable-libssh2 \
	--enable-libusb \
	--disable-libxml2 \
	--enable-linux-aio \
	--enable-lzo \
	--disable-malloc-trim \
	--enable-membarrier \
%if 0%{?suse_version} > 1320
	--enable-mpath \
%else
	--disable-mpath \
%endif
	--disable-netmap \
	--disable-nettle \
%ifarch %ix86 x86_64
%if 0%{?suse_version} > 1320 || 0%{?suse_version} == 1315
	--enable-numa \
%else
	--disable-numa \
%endif
%else
%ifarch aarch64
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
	--enable-numa \
%endif
%else
	--disable-numa \
%endif
%else
%ifarch %arm s390x
	--disable-numa \
%else
	--enable-numa \
%endif
%endif
%if 0%{?suse_version} >= 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
	--enable-opengl \
%endif
	--enable-parallels \
%if 0%{?suse_version} >= 1315
	--enable-pvrdma \
%else
	--disable-pvrdma \
%endif
	--enable-qcow1 \
	--enable-qed \
%if 0%{?with_rbd}
	--enable-rbd \
%else
	--disable-rbd \
%endif
%if 0%{?suse_version} >= 1315
	--enable-rdma \
%else
	--disable-rdma \
%endif
	--enable-replication \
	--disable-sanitizers \
%if 0%{?is_opensuse}
	--enable-sdl \
%if 0%{?suse_version} >= 1320
	--with-sdlabi=2.0 \
%else
	--with-sdlabi=1.2 \
%endif
%else
	--disable-sdl \
%endif
%if 0%{?with_seccomp}
	--enable-seccomp \
%else
	--disable-seccomp \
%endif
	--enable-sheepdog \
%if 0%{?is_opensuse}
	--enable-smartcard \
%else
	--disable-smartcard \
%endif
	--enable-snappy \
	--enable-spice \
	--disable-tcmalloc \
	--enable-tpm \
	--enable-usb-redir \
	--enable-vde \
	--enable-vdi \
	--enable-vhost-crypto \
	--enable-vhost-net \
%if 0%{?suse_version} >= 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
	--enable-virglrenderer \
%endif
	--enable-virtfs \
	--enable-vnc \
	--enable-vnc-jpeg \
	--enable-vnc-png \
	--enable-vnc-sasl \
%if 0%{?suse_version} == 1320
	--disable-vte \
%else
	--enable-vte \
%endif
	--enable-vvfat \
	--disable-whpx \
%ifarch x86_64
	--enable-xen \
	--enable-xen-pci-passthrough \
	--enable-xen-pv-domain-build \
%else
	--disable-xen \
%endif
	--enable-xfsctl \

%if "%{name}" != "qemu-testsuite"

make %{?_smp_mflags} V=1

# Firmware

%ifarch s390x
for i in %s390x_default_built_firmware
do
  cp pc-bios/s390-ccw/$i pc-bios/
done
%endif

%ifarch ppc64
for i in %ppc64_only_default_built_firmware
do
  cp pc-bios/spapr-rtas/$i pc-bios/
done
%endif

%ifarch %ix86 x86_64
for i in %x86_default_built_firmware
do
  cp pc-bios/optionrom/$i pc-bios/
done
%ifarch x86_64
for i in %x86_64_only_default_built_firmware
do
  cp pc-bios/optionrom/$i pc-bios/
done
%endif
%endif

%if %{build_x86_firmware_from_source}
%ifnarch %{ix86} x86_64
export CC=x86_64-suse-linux-gcc
export LD=x86_64-suse-linux-ld
%endif

make %{?_smp_mflags} -C roms bios \
%if 0%{?is_opensuse} == 0
  SEABIOS_EXTRAVERSION="-rebuilt.suse.com" \
%else
  SEABIOS_EXTRAVERSION="-rebuilt.opensuse.org" \
%endif
%ifnarch %ix86 x86_64
  HOSTCC=cc \
%endif

make %{?_smp_mflags} -C roms seavgabios \
%ifnarch %ix86 x86_64
  HOSTCC=cc \
%endif

make %{?_smp_mflags} -C roms pxerom

%ifnarch %ix86
make %{?_smp_mflags} -C roms efirom
%endif

make                 -C roms sgabios \
  HOSTCC=cc

%if %{force_fit_virtio_pxe_rom}
patch -p1 < %_sourcedir/2000-ipxe-stub-out-the-SAN-req-s-in-int1.patch
make %{?_smp_mflags} -C roms pxerom_variants=virtio pxerom_targets=1af41000 pxerom
%endif

# enforce pxe rom sizes for migration compatability from SLE 11 SP3 forward
# the following need to be > 64K
%define supported_nics_large {e1000 rtl8139}
# the following need to be <= 64K
%define supported_nics_small {virtio}
# Though not required, make unsupported pxe roms migration compatable as well
%define unsupported_nics {eepro100 ne2k_pci pcnet}

for i in %supported_nics_large %unsupported_nics
  do
    if test "`stat -c '%s' pc-bios/pxe-$i.rom`" -gt "131072" ; then
    echo "pxe rom is too large"
    exit 1
  fi
  if test "`stat -c '%s' pc-bios/pxe-$i.rom`" -le "65536" ; then
    ./roms/ipxe/src/util/padimg.pl pc-bios/pxe-$i.rom -s 65536 -b 255
    echo -ne "SEGMENT OVERAGE\0" >> pc-bios/pxe-$i.rom
  fi
done
for i in %supported_nics_small
  do
    if test "`stat -c '%s' pc-bios/pxe-$i.rom`" -gt "65536" ; then
    echo "pxe rom is too large"
    exit 1
  fi
done
%endif

%if %{build_skiboot_from_source}
make %{?_smp_mflags} -C roms skiboot CROSS=
%endif

%if %{build_slof_from_source}
make %{?_smp_mflags} -C roms slof
%endif

%else # qemu-testsuite

ln -s %_bindir/qemu-img qemu-img
ln -s %_bindir/qemu-ga qemu-ga
ln -s %_bindir/qemu-io qemu-io

for i in %built_firmware
do
  ln -s %_datadir/%name/$i pc-bios/$i
done

for conf in default-configs/*-softmmu.mak; do
  arch=`echo "$conf" | sed -e 's|default-configs/\(.*\)-softmmu.mak|\1|g'`
  ln -s %_bindir/qemu-system-$arch $arch-softmmu/qemu-system-$arch
done

# Compile the QOM test binary first, so that ...

touch -r config-host.mak pc-bios
make tests/qom-test %{?_smp_mflags} V=1
# Firmware
# ... make comes in fresh and has lots of address space (needed for 32bit, bsc#957379)
make check-report.html V=1

%endif

%check
%if "%{name}" == "qemu-testsuite"

export QEMU_PROG=%_bindir/qemu-system-x86_64
export QEMU_IMG_PROG=%_bindir/qemu-img
export QEMU_IO_PROG=%_bindir/qemu-io
export QEMU_NBD_PROG=%_bindir/qemu-nbd
make check-block V=1

%endif # qemu-testsuite

%install
%if "%{name}" != "qemu-testsuite"

touch -r config-host.mak pc-bios
make install DESTDIR=%{buildroot}
%ifnarch %{build_rom_arch}
for f in %{x86_extra_built_firmware_list} \
         %{x86_64_only_extra_built_firmware_list}; do
  unlink %{buildroot}%_datadir/%name/$f
done
%endif
%find_lang %name
install -D -m 0644 %{SOURCE4} %{buildroot}%_sysconfdir/%name/bridge.conf
install -D -m 0755 %{SOURCE3} %{buildroot}%_datadir/%name/qemu-ifup
install -D -p -m 0644 %{SOURCE8} %{buildroot}%{_udevrulesdir}/80-qemu-ga.rules
install -D -m 0755 scripts/analyze-migration.py  %{buildroot}%_bindir/analyze-migration.py
install -D -m 0755 scripts/vmstate-static-checker.py  %{buildroot}%_bindir/vmstate-static-checker.py
mkdir -p %{buildroot}%_libexecdir/supportconfig/plugins
install -D -m 0755 %{SOURCE9} %{buildroot}%_libexecdir/supportconfig/plugins/%name
%if 0%{?is_opensuse} == 0
install -D -m 0644 %{SOURCE10} %{buildroot}%_docdir/qemu-arm/supported.txt
install -D -m 0644 %{SOURCE11} %{buildroot}%_docdir/qemu-ppc/supported.txt
install -D -m 0644 %{SOURCE12} %{buildroot}%_docdir/qemu-x86/supported.txt
install -D -m 0644 %{SOURCE13} %{buildroot}%_docdir/qemu-s390/supported.txt
%endif
%if %{legacy_qemu_kvm}
cat > %{buildroot}%_bindir/qemu-kvm << 'EOF'
#!/bin/sh

%ifarch s390x
exec %_bindir/qemu-system-s390x -machine accel=kvm "$@"
%else
exec %_bindir/qemu-system-x86_64 -machine accel=kvm "$@"
%endif
EOF
chmod 755 %{buildroot}%_bindir/qemu-kvm
install -D -m 0644 %{SOURCE5} %{buildroot}%_mandir/man1/qemu-kvm.1.gz
%if 0%{?is_opensuse} == 0
install -d %{buildroot}%_docdir/qemu-kvm
%ifarch s390x
ln -s ../qemu-s390/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt
%else
ln -s ../qemu-x86/supported.txt %{buildroot}%_docdir/qemu-kvm/kvm-supported.txt
%endif
%endif
%endif
%if %{kvm_available}
install -D -m 0644 %{SOURCE1} %{buildroot}%{_udevrulesdir}/80-kvm.rules
%endif
install -D -p -m 0644 %{SOURCE7} %{buildroot}%{_unitdir}/qemu-ga@.service
%if 0%{?is_opensuse}
install -D -p -m 0644 %{SOURCE6} %{buildroot}%{_unitdir}/ksm.service
%endif
%ifarch s390x
install -D -m 0644 %{SOURCE2} %{buildroot}%_libexecdir/modules-load.d/kvm.conf
%endif
%fdupes -s %{buildroot}

%else # qemu-testsuite

install -D -m 0644 check-report.html %{buildroot}%_datadir/qemu/check-report.html
install -D -m 0644 check-report.xml %{buildroot}%_datadir/qemu/check-report.xml

%endif

%if "%{name}" != "qemu-testsuite"

%pre
%_bindir/getent group kvm >/dev/null || %_sbindir/groupadd -r kvm
%_bindir/getent group qemu >/dev/null || %_sbindir/groupadd -r qemu
%_bindir/getent passwd qemu >/dev/null ||
  %_sbindir/useradd -r -g qemu -G kvm -d / -s /sbin/nologin \
  -c "qemu user" qemu

%if %{kvm_available}
%post
# Do not execute operations affecting host devices while running in a chroot
if [ $(stat -L -c "%i" /proc/1/root/) = $(stat -L -c "%i" /) ]; then
  setfacl --remove-all /dev/kvm &> /dev/null || :
%ifarch s390x
  if [ -c /dev/kvm ]; then
    %_bindir/chmod 0666 /dev/kvm
    %_bindir/chgrp kvm /dev/kvm
  fi
%endif
  %udev_rules_update
  %_bindir/udevadm trigger -y kvm || :
%ifarch s390x
  sysctl vm.allocate_pgste=1 || :
%endif
fi
%endif

%pre tools
%_bindir/getent group kvm >/dev/null || %_sbindir/groupadd -r kvm

%post tools
%set_permissions %_libexecdir/qemu-bridge-helper

%verifyscript tools
%verify_permissions %_libexecdir/qemu-bridge-helper

%pre guest-agent
%_bindir/getent group kvm >/dev/null || %_sbindir/groupadd -r kvm
%service_add_pre qemu-ga@.service

%post guest-agent
%service_add_post qemu-ga@.service
if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
  /usr/bin/systemctl start qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service || :
fi

%preun guest-agent
if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
  /usr/bin/systemctl stop qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service || :
fi

%postun guest-agent
%service_del_postun_without_restart qemu-ga@.service
if [ "$1" = "1" ] ; then
  if [ -e /dev/virtio-ports/org.qemu.guest_agent.0 ]; then
    /usr/bin/systemctl restart qemu-ga@virtio\\x2dports-org.qemu.guest_agent.0.service || :
  fi
fi

%if 0%{?is_opensuse}
%pre ksm
%service_add_pre ksm.service

%post ksm
%service_add_post ksm.service

%preun ksm
%service_del_preun ksm.service

%postun ksm
%service_del_postun ksm.service
%endif

%endif # !qemu-testsuite

%files
%defattr(-, root, root)
%if "%{name}" != "qemu-testsuite"
%doc Changelog README VERSION
%license COPYING COPYING.LIB LICENSE
%_docdir/%name/qemu-doc.txt
%_docdir/%name/qemu-doc.html
%_docdir/%name/qemu-qmp-ref.txt
%_docdir/%name/qemu-qmp-ref.html
%_docdir/%name/qemu-ga-ref.txt
%_docdir/%name/qemu-ga-ref.html
%_mandir/man1/%name.1.gz
%_mandir/man7/qemu-block-drivers.7.gz
%_mandir/man7/qemu-cpu-models.7.gz
%_mandir/man7/qemu-qmp-ref.7.gz
%_mandir/man7/qemu-ga-ref.7.gz
%dir %_datadir/%name
%_datadir/%name/keymaps
%_datadir/%name/trace-events-all
%_datadir/%name/qemu-icon.bmp
%_datadir/%name/qemu_logo_no_text.svg
%dir %_sysconfdir/%name
%_datadir/%name/qemu-ifup
%dir %_libexecdir/supportconfig
%dir %_libexecdir/supportconfig/plugins
%_libexecdir/supportconfig/plugins/%name
%if %{kvm_available}
%{_udevrulesdir}/80-kvm.rules
%ifarch s390x
%_libexecdir/modules-load.d/kvm.conf
%endif
%endif

%files x86
%defattr(-, root, root)
%_bindir/qemu-system-i386
%_bindir/qemu-system-x86_64
%_datadir/%name/kvmvapic.bin
%_datadir/%name/linuxboot.bin
%_datadir/%name/linuxboot_dma.bin
%_datadir/%name/multiboot.bin
%if 0%{?is_opensuse} == 0
%dir %_docdir/qemu-x86
%_docdir/qemu-x86/supported.txt
%endif

%files ppc
%defattr(-, root, root)
%_bindir/qemu-system-ppc
%_bindir/qemu-system-ppc64
%_datadir/%name/bamboo.dtb
%_datadir/%name/canyonlands.dtb
%_datadir/%name/openbios-ppc
%_datadir/%name/ppc_rom.bin
%_datadir/%name/qemu_vga.ndrv
%_datadir/%name/skiboot.lid
%_datadir/%name/slof.bin
%_datadir/%name/spapr-rtas.bin
%_datadir/%name/u-boot.e500
%_datadir/%name/u-boot-sam460-20100605.bin
%if 0%{?is_opensuse} == 0
%dir %_docdir/qemu-ppc
%_docdir/qemu-ppc/supported.txt
%endif

%files s390
%defattr(-, root, root)
%_bindir/qemu-system-s390x
%_datadir/%name/s390-ccw.img
%_datadir/%name/s390-netboot.img
%if 0%{?is_opensuse} == 0
%dir %_docdir/qemu-s390
%_docdir/qemu-s390/supported.txt
%endif

%files arm
%defattr(-, root, root)
%_bindir/qemu-system-arm
%_bindir/qemu-system-aarch64
%if 0%{?is_opensuse} == 0
%dir %_docdir/qemu-arm
%_docdir/qemu-arm/supported.txt
%endif

%files extra
%defattr(-, root, root)
%_bindir/qemu-system-alpha
%_bindir/qemu-system-cris
%_bindir/qemu-system-hppa
%_bindir/qemu-system-lm32
%_bindir/qemu-system-m68k
%_bindir/qemu-system-microblaze
%_bindir/qemu-system-microblazeel
%_bindir/qemu-system-mips
%_bindir/qemu-system-mipsel
%_bindir/qemu-system-mips64
%_bindir/qemu-system-mips64el
%_bindir/qemu-system-moxie
%_bindir/qemu-system-nios2
%_bindir/qemu-system-or1k
%_bindir/qemu-system-riscv32
%_bindir/qemu-system-riscv64
%_bindir/qemu-system-sh4
%_bindir/qemu-system-sh4eb
%_bindir/qemu-system-sparc
%_bindir/qemu-system-sparc64
%_bindir/qemu-system-tricore
%_bindir/qemu-system-unicore32
%_bindir/qemu-system-xtensa
%_bindir/qemu-system-xtensaeb
%_datadir/%name/hppa-firmware.img
%_datadir/%name/openbios-sparc32
%_datadir/%name/openbios-sparc64
%_datadir/%name/palcode-clipper
%_datadir/%name/petalogix-ml605.dtb
%_datadir/%name/petalogix-s3adsp1800.dtb
%_datadir/%name/QEMU,cgthree.bin
%_datadir/%name/QEMU,tcx.bin

%if %{legacy_qemu_kvm}
%files kvm
%defattr(-,root,root)
%_bindir/qemu-kvm
%_mandir/man1/qemu-kvm.1.gz
%if 0%{?is_opensuse} == 0
%dir %_docdir/qemu-kvm
%_docdir/qemu-kvm/kvm-supported.txt
%endif
%endif

%files block-curl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-curl.so

%files block-dmg
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-dmg-bz2.so

%if 0%{?with_glusterfs}
%files block-gluster
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-gluster.so
%endif

%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
%files block-iscsi
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-iscsi.so
%endif

%if 0%{?is_opensuse}
%files block-nfs
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-nfs.so
%endif

%if 0%{?with_rbd}
%files block-rbd
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-rbd.so
%endif

%files block-ssh
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/block-ssh.so

%files ui-curses
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-curses.so

%files ui-gtk
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-gtk.so

%if 0%{?is_opensuse}
%files ui-sdl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/ui-sdl.so
%endif

%files audio-alsa
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-alsa.so

%files audio-oss
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-oss.so

%files audio-pa
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-pa.so

%if 0%{?is_opensuse}
%files audio-sdl
%defattr(-, root, root)
%dir %_libdir/%name
%_libdir/%name/audio-sdl.so
%endif

%files lang -f %name.lang
%defattr(-, root, root)

%ifarch %{build_rom_arch}
%files seabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/bios.bin
%_datadir/%name/bios-256k.bin

%files vgabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/vgabios.bin
%_datadir/%name/vgabios-cirrus.bin
%_datadir/%name/vgabios-qxl.bin
%_datadir/%name/vgabios-stdvga.bin
%_datadir/%name/vgabios-virtio.bin
%_datadir/%name/vgabios-vmware.bin
%_datadir/%name/vgabios-bochs-display.bin
%_datadir/%name/vgabios-ramfb.bin

%files sgabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/sgabios.bin

%files ipxe
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/pxe-e1000.rom
%_datadir/%name/pxe-eepro100.rom
%_datadir/%name/pxe-ne2k_pci.rom
%_datadir/%name/pxe-pcnet.rom
%_datadir/%name/pxe-rtl8139.rom
%_datadir/%name/pxe-virtio.rom
%_datadir/%name/efi-e1000.rom
%_datadir/%name/efi-e1000e.rom
%_datadir/%name/efi-eepro100.rom
%_datadir/%name/efi-ne2k_pci.rom
%_datadir/%name/efi-pcnet.rom
%_datadir/%name/efi-rtl8139.rom
%_datadir/%name/efi-virtio.rom
%_datadir/%name/efi-vmxnet3.rom
%endif

%files tools
%defattr(-, root, root)
%_mandir/man1/qemu-img.1.gz
%_mandir/man1/virtfs-proxy-helper.1.gz
%_mandir/man8/qemu-nbd.8.gz
%_bindir/qemu-edid
%_bindir/ivshmem-client
%_bindir/ivshmem-server
%_bindir/qemu-io
%_bindir/qemu-img
%_bindir/qemu-keymap
%_bindir/qemu-nbd
%_bindir/qemu-pr-helper
%_bindir/virtfs-proxy-helper
%verify(not mode) %attr(4750,root,kvm) %_libexecdir/qemu-bridge-helper
%dir %_sysconfdir/%name
%config %_sysconfdir/%name/bridge.conf
%_bindir/analyze-migration.py
%_bindir/vmstate-static-checker.py

%files guest-agent
%defattr(-, root, root)
%_mandir/man8/qemu-ga.8.gz
%attr(0755,root,kvm) %_bindir/qemu-ga
%{_unitdir}/qemu-ga@.service
%{_udevrulesdir}/80-qemu-ga.rules

%if 0%{?is_opensuse}
%files ksm
%defattr(-, root, root)
%{_unitdir}/ksm.service
%endif

%else # qemu-testsuite
%_datadir/qemu/check-report.xml
%_datadir/qemu/check-report.html
%endif

%changelog
openSUSE Build Service is sponsored by