File qemu.spec of Package qemu
%define realname qemu
%define realver 9.2.2
%define srcext tar.xz
%bcond_with xen
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Disable binaries stripping by brp-strip
%global __brp_strip /bin/true
# Python 3.x support
%define python3_pkg python3
%define python3 %{_bindir}/python3
%if ! 0%{?py3_ver:1}
%define py3_ver %(%python3 -c "import sys; v=sys.version_info[:2]; print ('%%d.%%d'%%v)" 2>/dev/null || echo PYTHON3-NOT-FOUND)
%endif
# Common info
Name: %{realname}
Version: %{realver}%{?extraver:%(tr '-' '~' <<< %{extraver})}
Release: wiz%{?extraver:0.}1%{?dist}
License: GPL-2.0 and LGPL-2.1
Group: System/Emulators/PC
URL: http://qemu.org/
Summary: Generic and open source machine emulator and virtualizer
# Install-time parameters
Provides: %{name}-common = %{?epoch:%{epoch}:}%{version}-%{release}
Obsoletes: %{name}-common < %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-kvm-common = %{?epoch:%{epoch}:}%{version}-%{release}
Obsoletes: %{name}-kvm-common < %{?epoch:%{epoch}:}%{version}-%{release}
Requires: %{name}-%{!?suse_version:system-}%{__isa_name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: qemu-ipxe = %{version}
Provides: qemu-seabios = %{version}
Provides: qemu-vgabios = %{version}
Obsoletes: qemu-ipxe < %{version}
Obsoletes: qemu-seabios < %{version}
Obsoletes: qemu-vgabios < %{version}
# Build-time parameters
BuildRequires: %{python3_pkg} %{python3_pkg}-tomli
BuildRequires: pkg-config
BuildRequires: libtool
BuildRequires: flex bison
BuildRequires: gcc-c++ libstdc++-devel
BuildRequires: binutils
BuildRequires: meson >= 1.5.0 ninja >= 1.8.2
BuildRequires: gettext%{?suse_version:-runtime}
BuildRequires: iasl
BuildRequires: pkgconfig(glib-2.0) >= 2.66
BuildRequires: pkgconfig(gmodule-export-2.0) >= 2.66
BuildRequires: pkgconfig(gio-2.0) pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(pixman-1) >= 0.21.8
BuildRequires: zlib-devel
BuildRequires: libaio-devel
BuildRequires: pkgconfig(liburing) >= 0.3
BuildRequires: pkgconfig(libnfs) >= 1.9.3 pkgconfig(libnfs) < 6.0.0
BuildRequires: libattr-devel
BuildRequires: pkgconfig(libseccomp) >= 2.3.0
BuildRequires: libcap-ng-devel
BuildRequires: pkgconfig(xkbcommon)
BuildRequires: pkgconfig(alsa) pkgconfig(libpulse) pkgconfig(libpipewire-0.3) >= 0.3.60
BuildRequires: pkgconfig(spice-protocol) >= 0.14.0 pkgconfig(spice-server) >= 0.14.0
BuildRequires: pkgconfig(libiscsi) >= 1.9.0
BuildRequires: pkgconfig(libzstd) >= 1.4.0
BuildRequires: pkgconfig(virglrenderer)
BuildRequires: pkgconfig(libcurl) >= 7.29.0
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(ncursesw)
BuildRequires: pkgconfig(sdl2) pkgconfig(SDL2_image)
BuildRequires: pkgconfig(glusterfs-api) >= 3
BuildRequires: pkgconfig(epoxy)
BuildRequires: pkgconfig(gbm)
BuildRequires: pkgconfig(gnutls) >= 3.6.14
BuildRequires: pkgconfig(gmp) pkgconfig(hogweed) >= 3.4
BuildRequires: pkgconfig(gtk+-3.0) >= 3.22.0 pkgconfig(gtk+-x11-3.0) >= 3.22.0 pkgconfig(vte-2.91)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(libpng) >= 1.6.34
BuildRequires: pkgconfig(libjpeg)
BuildRequires: cyrus-sasl-devel
BuildRequires: %{?suse_version:lib}snappy-devel
BuildRequires: lzo-devel
BuildRequires: libfdt-devel >= 1.5.1
BuildRequires: libibumad-devel libibverbs-devel librdmacm-devel
BuildRequires: pkgconfig(libcacard) >= 2.5.1
BuildRequires: pkgconfig(libusb-1.0) >= 1.0.13 pkgconfig(libusbredirparser-0.5) >= 0.6
BuildRequires: pkgconfig(libtasn1)
BuildRequires: pkgconfig(libselinux)
BuildRequires: pkgconfig(fuse3) >= 3.1
BuildRequires: pkgconfig(libbpf) >= 1.1.0
BuildRequires: pkgconfig(libxdp) >= 1.4.0
%if 0%{?suse_version}
BuildRequires: multipath-tools-devel
BuildRequires: libbz2-devel
BuildRequires: libnuma-devel
BuildRequires: libvdeplug3-devel
BuildRequires: librbd-devel
BuildRequires: pkgconfig(libssh) >= 0.8.7
BuildRequires: pkgconfig(lttng-ust)
BuildRequires: pkgconfig(liburcu-bp)
%if %{with xen}
BuildRequires: libxc-devel
BuildRequires: libxenstore-devel
BuildRequires: libxenforeignmemory-devel
BuildRequires: libxengnttab-devel
BuildRequires: libxenevtchn-devel
BuildRequires: libxendevicemodel-devel
BuildRequires: libxentoolcore-devel
%endif
%else
BuildRequires: device-mapper-multipath-devel
BuildRequires: bzip2-devel
BuildRequires: numactl-devel
%endif
BuildRequires: systemd-devel
# subprojects/libvfio-user
BuildRequires: pkgconfig(json-c) >= 0.11
BuildRequires: pkgconfig(cmocka)
# Docs
BuildRequires: python3dist(sphinx) python3dist(sphinx-rtd-theme)
Source0: https://download.qemu.org/%{realname}-%{realver}%{?extraver}.%{srcext}
Source22: ivshmem.service
%description
QEMU is a generic and open source machine emulator and virtualizer.
When used as a machine emulator, QEMU can run OSes and programs made for one
machine (e.g. an ARM board) on a different machine (e.g. your own PC). By using
dynamic translation, it achieves very good performance.
When used as a virtualizer, QEMU achieves near native performances by executing
the guest code directly on the host CPU. QEMU supports virtualization when
executing under the Xen hypervisor or using the KVM kernel module in Linux. When
using KVM, QEMU can virtualize x86, server and embedded PowerPC, and S390 guests.
%package %{!?suse_version:system-}alpha
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/Alpha
Summary: QEMU System emulator for Alpha
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%description %{!?suse_version:system-}alpha
QEMU System emulator for Alpha.
The Alpha processor is a processor that was made by Digital Electronics Corporation.
%files %{!?suse_version:system-}alpha
%defattr(-,root,root)
%{_bindir}/qemu-system-alpha
%doc %{_mandir}/man1/qemu-system-alpha.1*
%package %{!?suse_version:system-}arm
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/ARM
Summary: QEMU System emulator for ARM and AArch64
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-%{!?suse_version:system-}aarch64
%description %{!?suse_version:system-}arm
QEMU System emulator for ARM and AArch64.
%files %{!?suse_version:system-}arm
%defattr(-,root,root)
%{_bindir}/qemu-system-arm*
%{_bindir}/qemu-system-aarch64*
%doc %{_mandir}/man1/qemu-system-arm*.1*
%doc %{_mandir}/man1/qemu-system-aarch64*.1*
%package %{!?suse_version:system-}avr
Group: System/Emulators/PC
URL: https://www.qemu.org/docs/master/system/target-avr.html
Summary: QEMU System emulator for AVR 8 bit based machine
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%description %{!?suse_version:system-}avr
QEMU System emulator for AVR 8 bit based machine. These can have one of the
following cores: avr1, avr2, avr25, avr3, avr31, avr35, avr4, avr5, avr51, avr6,
avrtiny, xmega2, xmega3, xmega4, xmega5, xmega6 and xmega7.
As for now it supports few Arduino boards for educational and testing purposes.
These boards use a ATmega controller, which model is limited to USART & 16-bit
timer devices, enought to run FreeRTOS based applications.
%files %{!?suse_version:system-}avr
%defattr(-,root,root)
%{_bindir}/qemu-system-avr
%doc %{_mandir}/man1/qemu-system-avr.1*
%package %{!?suse_version:system-}hppa
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/HPPA
Summary: QEMU System emulator for HP PA-RISC
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%description %{!?suse_version:system-}hppa
System emulation of HP's PA-RISC platform. Both 32-bit (PA1.1)
and 64-bit (PA2.0). Emulated systems would likely include one of
the 'Snakes' (e.g. the 715/100), the C180/C240/similar, and C3000 or similar.
%files %{!?suse_version:system-}hppa
%defattr(-,root,root)
%{_bindir}/qemu-system-hppa
%doc %{_mandir}/man1/qemu-system-hppa.1*
%package %{!?suse_version:system-}loongarch64
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/LoongArch64
Summary: QEMU System emulator for LoongArch64
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%description %{!?suse_version:system-}loongarch64
LoongArch is the general processor architecture of Loongson.
The following versions of the LoongArch core are supported
core: 3A5000
%files %{!?suse_version:system-}loongarch64
%defattr(-,root,root)
%doc target/loongarch/README
%{_bindir}/qemu-system-loongarch64
%doc %{_mandir}/man1/qemu-system-loongarch64.1*
%package %{!?suse_version:system-}m68k
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/68k
Summary: QEMU System emulator for Motorola 68k
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%description %{!?suse_version:system-}m68k
An emulated 68k Macintosh. The model being the Quadra 800.
%files %{!?suse_version:system-}m68k
%defattr(-,root,root)
%{_bindir}/qemu-system-m68k
%doc %{_mandir}/man1/qemu-system-m68k.1*
%package %{!?suse_version:system-}microblaze
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/MicroBlaze
Summary: QEMU System emulator for MicroBlaze
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-%{!?suse_version:system-}microblazeel
%description %{!?suse_version:system-}microblaze
QEMU System emulator for MicroBlaze.
MicroBlaze is a software-based RISC CPU used with the Xilinx field programmable
gate array.
%files %{!?suse_version:system-}microblaze
%defattr(-,root,root)
%{_bindir}/qemu-system-microblaze*
%doc %{_mandir}/man1/qemu-system-microblaze*.1*
%package %{!?suse_version:system-}mips
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/MIPS
Summary: QEMU System emulator for MIPS
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-%{!?suse_version:system-}mipsel
Provides: %{name}-%{!?suse_version:system-}mips64
Provides: %{name}-%{!?suse_version:system-}mips64el
%description %{!?suse_version:system-}mips
The MIPS emulator emulates a MIPS Malta system.
%files %{!?suse_version:system-}mips
%defattr(-,root,root)
%{_bindir}/qemu-system-mips*
%doc %{_mandir}/man1/qemu-system-mips*.1*
%package %{!?suse_version:system-}or1k
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/OpenRISC
Summary: QEMU System emulator for OpenRISC
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%description %{!?suse_version:system-}or1k
QEMU System emulator for OpenRISC.
OpenRISC is an open source processor architecture. While instruction sets like
x86 are proprietary and owned by a single company, OpenRISC is free. Its main
use is as a processor on an embedded system.
%files %{!?suse_version:system-}or1k
%defattr(-,root,root)
%{_bindir}/qemu-system-or1k
%doc %{_mandir}/man1/qemu-system-or1k.1*
%package %{!?suse_version:system-}ppc
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/POWER
Summary: QEMU System emulator for PowerPC and POWER
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-%{!?suse_version:system-}ppc64
%description %{!?suse_version:system-}ppc
QEMU System emulator for PowerPC and POWER.
PowerPC emulates the Apple Beige Power Mac G3 and Sawtooth Power Mac G4.
POWER emulates pSeries IBM hardware.
%files %{!?suse_version:system-}ppc
%defattr(-,root,root)
%{_bindir}/qemu-system-ppc*
%doc %{_mandir}/man1/qemu-system-ppc*.1*
%package %{!?suse_version:system-}riscv
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/RISCV
Summary: QEMU System emulator for RISC-V
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-%{!?suse_version:system-}riscv32
Provides: %{name}-%{!?suse_version:system-}riscv64
%description %{!?suse_version:system-}riscv
QEMU System emulator for RISC-V.
RISC-V is an open source instruction set. It is a modular with only a small set
of mandatory instructions. Every other module might be implemented by vendors
allowing RISC-V to be suitable for small embended systems
up to large supercomputers.
%files %{!?suse_version:system-}riscv
%defattr(-,root,root)
%{_bindir}/qemu-system-riscv32
%{_bindir}/qemu-system-riscv64
%doc %{_mandir}/man1/qemu-system-riscv32.1*
%doc %{_mandir}/man1/qemu-system-riscv64.1*
%package %{!?suse_version:system-}rx
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/RX
Summary: QEMU System emulator for Renesas RX architecture
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%description %{!?suse_version:system-}rx
QEMU System emulator for Renesas RX architecture.
RX is the family name for a range of 32-bit microcontrollers manufactured
by Renesas Electronics. RX is an acronym for Renesas Extreme.
Key to the high performance of the microcontroller is the CISC architecture with
high performance integrated flash memory enabling the central processing
unit (CPU) to operate at very high frequency, 100 MHz, without requiring
wait-states for the memory accesses resulting in performance up
to 1.65 DMIPS/MHz.
%files %{!?suse_version:system-}rx
%defattr(-,root,root)
%{_bindir}/qemu-system-rx
%doc %{_mandir}/man1/qemu-system-rx.1*
%package %{!?suse_version:system-}s390x
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/S390X
Summary: QEMU System emulator for S/390
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-%{!?suse_version:system-}s390
%description %{!?suse_version:system-}s390x
QEMU System emulator for S/390.
Currently, the only supported guest operation system is Linux.
%files %{!?suse_version:system-}s390x
%defattr(-,root,root)
%{_bindir}/qemu-system-s390x
%doc %{_mandir}/man1/qemu-system-s390x.1*
%package %{!?suse_version:system-}sh4
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/SH4
Summary: QEMU System emulator for SuperH
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-%{!?suse_version:system-}sh4eb
%description %{!?suse_version:system-}sh4
QEMU System emulator for SuperH.
The SH-4 is a 32-bit RISC CPU. QEMU supports two SH-4 machines, the "r2d" board
and the "shix" board.
%files %{!?suse_version:system-}sh4
%defattr(-,root,root)
%{_bindir}/qemu-system-sh4*
%doc %{_mandir}/man1/qemu-system-sh4*.1*
%package %{!?suse_version:system-}sparc
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/SPARC
Summary: QEMU System emulator for Sparc32 and Sparc64
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-%{!?suse_version:system-}sparc64
%description %{!?suse_version:system-}sparc
QEMU System emulator for Sparc32 and Sparc64.
Supported emulation:
* sun4m - Complete, supported
* sun4u - Beta, supported
* sun4v - Incomplete, unsupported
* niagara - Complete, supported
%files %{!?suse_version:system-}sparc
%defattr(-,root,root)
%{_bindir}/qemu-system-sparc*
%doc %{_mandir}/man1/qemu-system-sparc*.1*
%package %{!?suse_version:system-}tricore
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/TriCore
Summary: QEMU System emulator for TriCore
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
%description %{!?suse_version:system-}tricore
QEMU System emulator for TriCore.
TriCore is a unified, 32-bit microcontroller-DSP architecture optimized for
real-time embedded systems. It mostly targets gasoline and diesel engine control
units (ECUs), applications in hybrid and electric vehicles as well
as transmission, active and passive safety and chassis applications.
The instruction set architecture (ISA) consists of three types of instruction
sets: one microcontroller, one RISC load-store, and
one DSP instruction set -- thus the name TriCore.
%files %{!?suse_version:system-}tricore
%defattr(-,root,root)
%{_bindir}/qemu-system-tricore
%doc %{_mandir}/man1/qemu-system-tricore.1*
%package %{!?suse_version:system-}x86
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/PC
Summary: QEMU System emulator for x86 and x86-64
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-%{!?suse_version:system-}i386
Provides: %{name}-%{!?suse_version:system-}x86_64
%description %{!?suse_version:system-}x86
QEMU System emulator for PC x86 and x86-64.
%files %{!?suse_version:system-}x86
%defattr(-,root,root)
%{_bindir}/qemu-system-i386
%{_bindir}/qemu-system-x86_64
%doc %{_mandir}/man1/qemu-system-i386.1*
%doc %{_mandir}/man1/qemu-system-x86_64.1*
%package %{!?suse_version:system-}xtensa
Group: System/Emulators/PC
URL: https://wiki.qemu.org/Documentation/Platforms/Xtensa
Summary: QEMU System emulator for Xtensa
Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release}
Provides: %{name}-%{!?suse_version:system-}xtensaeb
%description %{!?suse_version:system-}xtensa
QEMU System emulator for Xtensa.
Xtensa is a configurable processor developed by Tensilica.
%files %{!?suse_version:system-}xtensa
%defattr(-,root,root)
%{_bindir}/qemu-system-xtensa
%{_bindir}/qemu-system-xtensaeb
%doc %{_mandir}/man1/qemu-system-xtensa.1*
%doc %{_mandir}/man1/qemu-system-xtensaeb.1*
%package %{?suse_version:linux-}user
Group: System/Emulators/Other
Summary: QEMU User space emulator
%description %{?suse_version:linux-}user
In user mode emulation mode, QEMU can launch processes compiled for one CPU
on another CPU. It can be used to launch the Wine Windows
API emulator (http://www.winehq.org) or to ease cross-compilation
and cross-debugging.
%package tools
Group: System/Emulators/Other
Summary: Tools for qemu
%if 0%{?suse_version}
PreReq: permissions
%endif
Provides: qemu-img = %{?epoch:%{epoch}:}%{version}-%{release}
Obsoletes: qemu-img < %{?epoch:%{epoch}:}%{version}-%{release}
Provides: qemu-kvm-tools = %{?epoch:%{epoch}:}%{version}-%{release}
Obsoletes: qemu-kvm-tools < %{?epoch:%{epoch}:}%{version}-%{release}
%description tools
Some tools for qemu
%package guest-agent
Group: System/Emulators/PC
Summary: Guest agent for qemu
Requires: systemd
%description guest-agent
QEMU Guest Agent
It is a daemon program running inside the domain which is supposed to help
management applications with executing functions which need assistance of the
guest OS. For example, freezing and thawing filesystems, entering suspend.
However, guest agent (GA) is not bullet proof, and hostile guest OS can send
spurious replies.
To be able to use GA users needs to create virtio serial port with special
name org.qemu.guest_agent.0. In other words, one needs to add this to his/her
domain XML under <devices>:
<channel type='unix'>
<source mode='bind' path='/var/lib/libvirt/qemu/f16x86_64.agent'/>
<target type='virtio' name='org.qemu.guest_agent.0'/>
</channel>
If you use libvirt 1.0.6 or newer, you can omit the path='...' attribute
of the <source> element, and libvirt will manage things automatically
on your behalf.
# See: subprojects/libvfio-user/
%package -n libvfio-user0
Version: 0.0.1
License: BSD-3-Clause
Group: System/Libraries
Summary: Framework for emulating devices in userspace
%description -n libvfio-user0
vfio-user is a framework that allows implementing PCI devices in userspace.
Clients (such as qemu) talk the vfio-user protocol over a UNIX socket to
a server. This library, libvfio-user, provides an API for implementing
such servers.
%files -n libvfio-user0
%defattr(-,root,root)
%license subprojects/libvfio-user/LICENSE
%doc subprojects/libvfio-user/README.md
%{_libdir}/libvfio-user.so.0*
%package -n libvfio-user-devel
Version: 0.0.1
License: BSD-3-Clause
Group: Developent/Languages/C and C++
Summary: Developent stuff for the framework for emulating devices in userspace
Requires: libvfio-user0 = 0.0.1
Provides: libvfio-user0-devel = 0.0.1
%description -n libvfio-user-devel
vfio-user is a framework that allows implementing PCI devices in userspace.
Clients (such as qemu) talk the vfio-user protocol over a UNIX socket to
a server. This library, libvfio-user, provides an API for implementing
such servers.
This package contains headers and libraries to build software using libvfio-user
%files -n libvfio-user-devel
%defattr(-,root,root)
%license subprojects/libvfio-user/LICENSE
%doc subprojects/libvfio-user/README.md
%{_libdir}/libvfio-user.so
%{_includedir}/vfio-user/
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
# Disable non-needed libvfio-user components
%{__sed} -ri '/^subdir.+(samples|test)/ d' subprojects/libvfio-user/meson.build
%build
### %{__sed} -ri '/^for binary in sphinx-build/ s/$/ sphinx-build-%{py3_ver}/' configure
./configure \
--prefix=%{_prefix} \
--python=%{python3} \
--extra-cflags="%{optflags} -Wno-error=calloc-transposed-args -UNDEBUG" \
--extra-ldflags="-Wl,--as-needed -Wl,--strip-all -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro" \
--mandir=%{_mandir} \
--datadir=%{_datadir} \
--libdir=%{_libdir} \
--libexecdir=%{_libexecdir} \
--sysconfdir=%{_sysconfdir} \
--localstatedir=%{_localstatedir} \
\
--ninja=%{_bindir}/ninja \
--audio-drv-list=alsa,sdl,pa,pipewire \
--enable-fdt=system \
%if 0%{?gcc_lto:1}
--enable-lto \
%endif
--enable-strip \
\
--enable-af-xdp \
--enable-attr \
--enable-bpf \
--enable-bzip2 \
--enable-cap-ng \
--enable-crypto-afalg \
--enable-curl \
--enable-curses \
--enable-dbus-display \
--enable-dmg \
--enable-docs \
--enable-fuse \
--enable-glusterfs \
--enable-gtk \
--enable-guest-agent \
--enable-hv-balloon \
--enable-kvm \
--enable-libiscsi \
--enable-libnfs \
%if 0%{?suse_version}
--enable-libssh \
%endif
--enable-libudev \
--enable-libusb \
--enable-linux-aio \
--enable-linux-io-uring \
--enable-lzo \
--enable-malloc-trim \
--enable-membarrier \
--enable-modules \
--enable-multiprocess \
--enable-numa \
--enable-opengl \
--enable-plugins \
--enable-png \
%if 0%{?suse_version}
--enable-rbd \
%endif
--enable-rdma \
--enable-replication \
--enable-sdl \
--enable-sdl-image \
--enable-seccomp \
--enable-selinux \
--enable-snappy \
--enable-spice \
--enable-spice-protocol \
--enable-tools \
--enable-tpm \
--enable-usb-redir \
%if 0%{?suse_version}
--enable-vde \
%endif
--enable-vdi \
--enable-vfio-user-server \
--enable-vhdx \
--enable-vhost-crypto \
--enable-vhost-kernel \
--enable-vhost-net \
--enable-vhost-user \
--enable-vhost-user-blk-server \
--enable-vhost-vdpa \
--enable-virglrenderer \
--enable-virtfs \
--enable-vmdk \
--enable-vnc \
--enable-vnc-jpeg \
--enable-vnc-sasl \
--enable-vte \
%if 0%{?suse_version} && %{with xen}
--enable-xen \
--enable-xen-pci-passthrough \
%endif
--enable-zstd \
--enable-system \
--enable-user \
--enable-linux-user
ninja -v -C build %{?_smp_mflags}
%install
DESTDIR=%{buildroot} ninja -v -C build install
%{__install} -D -m644 contrib/systemd/qemu-guest-agent.service %{buildroot}%{_unitdir}/qemu-guest-agent.service
%{__install} -D -m644 %{S:22} %{buildroot}%{_unitdir}/ivshmem.service
%{__install} -D -m755 scripts/qemu-guest-agent/fsfreeze-hook %{buildroot}%{_sysconfdir}/qemu/fsfreeze-hook
%{__install} -d -m755 %{buildroot}%{_sysconfdir}/qemu/fsfreeze-hook.d
%{__install} -m755 scripts/qemu-guest-agent/fsfreeze-hook.d/* %{buildroot}%{_sysconfdir}/qemu/fsfreeze-hook.d/
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}%{_datadir}/doc/qemu/* %{buildroot}%{_datadir}/doc/qemu/.buildinfo
for bin in %{buildroot}%{_bindir}/qemu-system-*; do
%{__ln_s} -f qemu.1 %{buildroot}%{_mandir}/man1/${bin##*/}.1
done
# SASL config
%{__install} -D -m0644 qemu.sasl %{buildroot}%{_sysconfdir}/sasl2/qemu.conf
# SUSE-specific
%if 0%{?suse_version}
%{__install} -d -m 755 %{buildroot}%{_sysconfdir}/permissions.d
cat > %{buildroot}%{_sysconfdir}/permissions.d/qemu-tools <<EOF
# qemu-bridge-helper should be SUID root
%{_libexecdir}/qemu-bridge-helper root:root 4755
EOF
%endif
# bridge.conf example
cat > %{buildroot}%{_sysconfdir}/qemu/bridge.conf <<EOF
#allow all
#deny br2
EOF
%find_lang %{name}
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files -f %{name}.lang
%defattr(-,root,root)
%doc COPYING COPYING.LIB LICENSE MAINTAINERS docs/*
%doc %{_mandir}/man1/qemu.1*
%doc %{_mandir}/man7/qemu-qmp-ref.7*
%doc %{_mandir}/man7/qemu-block-drivers.7*
%doc %{_mandir}/man7/qemu-cpu-models.7*
%doc %{_mandir}/man8/qemu-pr-helper.8*
%{_bindir}/elf2dmp
%{_bindir}/qemu-pr-helper
%{_libexecdir}/vhost-user-gpu
%if 0%{?suse_version}
%verify(not mode) %attr(4755,root,root) %{_libexecdir}/qemu-bridge-helper
%config %{_sysconfdir}/permissions.d/qemu-tools
%else
%attr(4755,root,root) %{_libexecdir}/qemu-bridge-helper
%endif
%{_unitdir}/ivshmem.service
%dir %{_sysconfdir}/qemu
%dir %{_sysconfdir}/sasl2/
%config(noreplace) %{_sysconfdir}/qemu/bridge.conf
%config(noreplace) %{_sysconfdir}/sasl2/qemu.conf
%dir %{_libdir}/qemu/
%{_libdir}/qemu/*.so
%{_includedir}/qemu-plugin.h
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/*
%{_datadir}/applications/qemu.desktop
%{_datadir}/icons/hicolor/32x32/apps/qemu.bmp
%{_datadir}/icons/hicolor/*x*/apps/qemu.png
%{_datadir}/icons/hicolor/scalable/apps/qemu.svg
%exclude %{_bindir}/qemu-ga
%exclude %{_bindir}/qemu-img
%exclude %{_bindir}/qemu-io
%exclude %{_bindir}/qemu-nbd
%files %{?suse_version:linux-}user
%defattr(-,root,root)
%{_bindir}/qemu-*
%exclude %{_bindir}/qemu-system-*
%exclude %{_bindir}/qemu-edid
%exclude %{_bindir}/qemu-ga
%exclude %{_bindir}/qemu-img
%exclude %{_bindir}/qemu-io
%exclude %{_bindir}/qemu-keymap
%exclude %{_bindir}/qemu-nbd
%exclude %{_bindir}/qemu-pr-helper
%exclude %{_bindir}/qemu-storage-daemon
%files tools
%defattr(-,root,root)
%doc %{_mandir}/man1/qemu-img.1*
%doc %{_mandir}/man1/qemu-storage-daemon.1*
%doc %{_mandir}/man7/qemu-storage-daemon-qmp-ref.7*
%doc %{_mandir}/man8/qemu-nbd.8*
%{_bindir}/qemu-edid
%{_bindir}/qemu-img
%{_bindir}/qemu-io
%{_bindir}/qemu-keymap
%{_bindir}/qemu-nbd
%{_bindir}/qemu-storage-daemon
%files guest-agent
%defattr(-,root,root)
%dir %{_sysconfdir}/qemu/fsfreeze-hook.d/
%dir %{_sysconfdir}/qemu
%config(noreplace) %{_sysconfdir}/qemu/fsfreeze-hook
%config(noreplace) %{_sysconfdir}/qemu/fsfreeze-hook.d/*
%{_unitdir}/qemu-guest-agent.service
%{_bindir}/qemu-ga
%doc %{_mandir}/man7/qemu-ga-ref.7*
%doc %{_mandir}/man8/qemu-ga.8*
%if 0%{?suse_version}
%verifyscript tools
%verify_permissions -e %{_libexecdir}/qemu-bridge-helper
%post tools
%set_permissions %{_libexecdir}/qemu-bridge-helper
%pre
%{service_add_pre ivshmem.service}
%post
%{service_add_post ivshmem.service}
%preun
%{service_del_preun ivshmem.service}
%postun
%{service_del_postun ivshmem.service}
%pre guest-agent
%{service_add_pre qemu-guest-agent.service}
%post guest-agent
%{service_add_post qemu-guest-agent.service}
%preun guest-agent
%{service_del_preun qemu-guest-agent.service}
%postun guest-agent
%{service_del_postun qemu-guest-agent.service}
%endif
%changelog