Name: qemu
Version: 4.2.0
Release: 1%{?dist}
Summary: QEMU is a FAST! processor emulator
License: GPLv2+ and LGPLv2+ and BSD
Group: Development/Tools
URL: http://www.qemu.org/
Source0: http://download.qemu-project.org/%{name}-%{version}.tar.xz
Source1: qemu.binfmt
# Creates /dev/kvm
Source3: 80-kvm.rules
# KSM control scripts
Source4: ksm.service
Source5: ksm.sysconfig
Source6: ksmctl.c
Source7: ksmtuned.service
Source8: ksmtuned
Source9: ksmtuned.conf
Source10: qemu-guest-agent.service
Source11: 99-qemu-guest-agent.rules
Source12: bridge.conf
# qemu-kvm back compat wrapper
#Source13: qemu-kvm-ppc64.sh
BuildRequires: SDL2-devel
BuildRequires: zlib-devel
BuildRequires: which
BuildRequires: chrpath
BuildRequires: texi2html
BuildRequires: gnutls-devel
BuildRequires: cyrus-sasl-devel
BuildRequires: libtool
BuildRequires: libaio-devel
BuildRequires: rsync
BuildRequires: pciutils-devel
BuildRequires: pulseaudio-libs-devel
BuildRequires: libiscsi-devel
BuildRequires: ncurses-devel
BuildRequires: libattr-devel
BuildRequires: usbredir-devel >= 0.5.2
BuildRequires: gperftools-devel
BuildRequires: texinfo
BuildRequires: perl-podlators
BuildRequires: spice-protocol >= 0.12.2
BuildRequires: spice-server-devel >= 0.12.0
BuildRequires: libseccomp-devel >= 2.1.0
# For network block driver
BuildRequires: libcurl-devel
# For rbd block driver
#BuildRequires: ceph-devel >= 0.61
# We need both because the 'stap' binary is probed for by configure
BuildRequires: systemtap
BuildRequires: systemtap-sdt-devel
# For smartcard NSS support
BuildRequires: nss-devel
# For XFS discard support in raw-posix.c
BuildRequires: xfsprogs-devel
# For VNC JPEG support
BuildRequires: libjpeg-devel
# For VNC PNG support
BuildRequires: libpng-devel
# For uuid generation
BuildRequires: libuuid-devel
# For BlueZ device support
BuildRequires: bluez-libs-devel
# For Braille device support
BuildRequires: brlapi-devel
# For FDT device tree support
BuildRequires: libfdt-devel
# For virtfs
BuildRequires: libcap-devel
# Hard requirement for version >= 1.3
BuildRequires: pixman-devel
# For gluster support
BuildRequires: glusterfs-devel >= 3.4.0
BuildRequires: glusterfs-api-devel >= 3.4.0
# Needed for usb passthrough for qemu >= 1.5
BuildRequires: libusbx-devel
# SSH block driver
BuildRequires: libssh2-devel
# GTK frontend
BuildRequires: gtk3-devel
BuildRequires: vte3-devel
# GTK translations
BuildRequires: gettext
# RDMA migration
BuildRequires: librdmacm-devel
# For sanity test
#BuildRequires: qemu-sanity-check-nodeps
BuildRequires: kernel
# For acpi compilation
BuildRequires: iasl
# Xen support
#BuildRequires: xen-devel
# memdev hostmem backend added in 2.1
BuildRequires: numactl-devel
# Added in qemu 2.3
BuildRequires: bzip2-devel
# Added in qemu 2.4 for opengl bits
BuildRequires: libepoxy-devel
BuildRequires: jemalloc-devel
BuildRequires: libnfs-devel >= 1.9.3
BuildRequires: device-mapper-multipath-devel
Requires: %{name}-img = %{version}-%{release}
Requires: %{name}-kvm =  %{version}-%{release}


%description
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation. QEMU has two operating modes:
 * Full system emulation. In this mode, QEMU emulates a full system (for
   example a PC), including a processor and various peripherials. It can be
   used to launch different Operating Systems without rebooting the PC or
   to debug system code.
 * User mode emulation. In this mode, QEMU can launch Linux processes compiled
   for one CPU on another CPU.
As QEMU requires no host kernel patches to run, it is safe and easy to use.


%package kvm
Summary: QEMU metapackage for KVM support
Group: Development/Tools
Provides: kvm = 85
Obsoletes: kvm < 85
Requires: libseccomp >= 1.0.0
%ifarch ppc64 ppc64le
Requires: %{name}-system-ppc64 = %{version}-%{release}
%endif
%ifarch x86_64
Requires: %{name}-system-x64 = %{version}-%{release}
%endif
%description kvm
This is a meta-package that provides a qemu-system-<arch> package for native
architectures where kvm can be enabled.


%package  img
Summary: QEMU command line tool for manipulating disk images
Group: Development/Tools
%description img
This package provides a command line tool for manipulating disk images


%package  common
Summary: QEMU common files needed by all QEMU targets
Group: Development/Tools
Requires(post): /usr/bin/getent
Requires(post): /usr/sbin/groupadd
Requires(post): /usr/sbin/useradd
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
Requires: %{name}-bootloaders = %{version}-%{release}
%description common
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the common files needed by all QEMU targets


%package guest-agent
Summary: QEMU guest agent
Group: System Environment/Daemons
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description guest-agent
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides an agent to run inside guests, which communicates
with the host over a virtio-serial channel named "org.qemu.guest_agent.0"
This package does not need to be installed on the host OS.


%package -n ksm
Summary: Kernel Samepage Merging services
Group: Development/Tools
Requires: %{name}-common = %{version}-%{release}
Requires(post): systemd-units
Requires(postun): systemd-units
%description -n ksm
Kernel Samepage Merging (KSM) is a memory-saving de-duplication feature,
that merges anonymous (private) pages (not pagecache ones).
This package provides service files for disabling and tuning KSM.


%package system-x64
Summary: QEMU system emulator for x86_64
Group: Development/Tools
Requires: %{name}-common = %{version}-%{release}
%description system-x64
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the system emulator for x86_64 or amd64.


%package system-alpha
Summary: QEMU system emulator for Alpha
Group: Development/Tools
Requires: %{name}-common = %{version}-%{release}
%description system-alpha
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the system emulator for Alpha systems.


%package system-arm
Summary: QEMU system emulator for ARM
Group: Development/Tools
Requires: %{name}-common = %{version}-%{release}
%description system-arm
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the system emulator for ARM boards.


%package system-mips64
Summary: QEMU system emulator for MIPS
Group: Development/Tools
Requires: %{name}-common = %{version}-%{release}
%description system-mips64
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the system emulator for MIPS64 boards.


%package system-s390x
Summary: QEMU system emulator for S390X
Group: Development/Tools
Requires: %{name}-common = %{version}-%{release}
%description system-s390x
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the system emulator for S390X systems.


%package system-sparc64
Summary: QEMU system emulator for SPARC
Group: Development/Tools
Requires: %{name}-common = %{version}-%{release}
%description system-sparc64
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the system emulator for SPARC64 systems.


%package system-ppc64
Summary: QEMU system emulator for PPC
Group: Development/Tools
Requires: %{name}-common = %{version}-%{release}
%description system-ppc64
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the system emulator for PPC64 systems.


%package system-riscv64
Summary: QEMU system emulator for RISC-V
Group: Development/Tools
Requires: %{name}-common = %{version}-%{release}
%description system-riscv64
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the system emulator for RISC-V systems.


%package system-aarch64
Summary: QEMU system emulator for AArch64
Group: Development/Tools
Requires: %{name}-common = %{version}-%{release}
%description system-aarch64
QEMU is a generic and open source processor emulator which achieves a good
emulation speed by using dynamic translation.
This package provides the system emulator for AArch64.


#%package kvm-tools
#Summary: KVM debugging and diagnostics tools
#Group: Development/Tools
#%description kvm-tools
#This package contains some diagnostics and debugging tools for KVM,
#such as kvm_stat.


%package -n ivshmem-tools
Summary: Client and server for QEMU ivshmem device
Group: Development/Tools
%description -n ivshmem-tools
This package provides client and server tools for QEMU's ivshmem device.


%package bootloaders
Summary: Bootloaders for QEMU
Group: Development/Tools
# x64 / ppc64
Requires: seabios-bin >= 1.7.5
Requires: seavgabios-bin >= 1.7.5
Requires: sgabios-bin
#Requires: ipxe-roms-qemu
# sparc64
#Requires: openbios
# ppc64
#Requires: openbios
Requires: SLOF-bin
%description bootloaders
This package provides the bootloader images for QEMU and stubs


%prep
%setup -q -n qemu-%{version}
%autopatch -p1


%build
# we do it all in the install


%install

#%global optflags %(echo %{optflags} | sed 's/-Wp,-D_FORTIFY_SOURCE=2//')
extraldflags="-Wl,--build-id";
buildldflags="VL_LDFLAGS=-Wl,--build-id"
tracebackends="dtrace"
%ifarch ppc64
cflags="-m64 -O3 -g -fsigned-char -fno-strength-reduce -mcpu=power8 -mtune=power8 -mpower8-fusion -mpower8-vector -mcrypto -mquad-memory -mquad-memory-atomic -maltivec -mpowerpc-gpopt -mpowerpc-gfxopt -mcrypto -mvsx -mdirect-move -fPIC -fPIE -DPIE -D_FORTIFY_SOURCE=2"
nativebuildarch="ppc64-softmmu"
emulatedbuildarch="x86_64-softmmu s390x-softmmu sparc64-softmmu aarch64-softmmu mips64-softmmu mips64el-softmmu riscv64-softmmu alpha-softmmu arm-softmmu"
%endif
%ifarch ppc64le
cflags="-m64 -O3 -g -fsigned-char -fno-strength-reduce -mcpu=power8 -mtune=power8 -mpower8-fusion -mpower8-vector -mcrypto -maltivec -mpowerpc-gpopt -mpowerpc-gfxopt -mcrypto -mvsx -mdirect-move -fPIC -fPIE -DPIE -D_FORTIFY_SOURCE=2"
nativebuildarch="ppc64-softmmu"
emulatedbuildarch="x86_64-softmmu s390x-softmmu sparc64-softmmu aarch64-softmmu mips64-softmmu mips64el-softmmu riscv64-softmmu alpha-softmmu arm-softmmu"
%endif
%ifarch x86_64
cflags="-m64 -O3 -g -march=core2 -mtune=core2 -mmmx -msse -msse2 -mssse3 -msse4 -msse4.1 -msse4.2 -mavx -fPIC -fPIE -DPIE -D_FORTIFY_SOURCE=2"
nativebuildarch="x86_64-softmmu"
emulatedbuildarch="ppc64-softmmu s390x-softmmu sparc64-softmmu aarch64-softmmu mips64-softmmu mips64el-softmmu riscv64-softmmu alpha-softmmu arm-softmmu"
%endif
%ifarch aarch64
nativebuildarch="aarch64-softmmu"
emulatedbuildarch="ppc64-softmmu s390x-softmmu sparc64-softmmu x86_64-softmmu mips64-softmmu mips64el-softmmu riscv64-softmmu alpha-softmmu arm-softmmu"
%endif


# native build
./configure \
  --prefix=%{_prefix} --libdir=%{_libdir} --sysconfdir=%{_sysconfdir} --interp-prefix=%{_prefix}/qemu-%%M \
  --localstatedir=%{_localstatedir} --libexecdir=%{_libexecdir} --with-pkgversion=%{name}-%{version}-%{release} \
  --disable-strip --enable-pie --enable-numa --disable-werror --disable-xen --enable-curl --enable-jemalloc \
  --enable-glusterfs --enable-libiscsi --enable-virtfs --enable-rdma --enable-pvrdma --enable-replication --enable-libssh \
  --enable-tpm --enable-smartcard --enable-lzo --enable-bzip2 --enable-libusb --enable-usb-redir --enable-bluez --enable-libnfs \
  --disable-gtk --disable-vte --disable-brlapi --enable-live-block-migration --enable-mpath --enable-membarrier \
  --enable-attr --enable-nettle --enable-vhost-scsi --enable-vhost-net --enable-vhost-vsock --enable-vhost-crypto --enable-crypto-afalg \
  --enable-xfsctl --enable-linux-aio --enable-vvfat --enable-coroutine-pool --enable-cap-ng --enable-opengl \
  --enable-vhost-kernel --enable-opengl --enable-debug-info \
  --enable-curses --enable-vnc --enable-vnc-sasl --enable-vnc-jpeg --enable-vnc-png --enable-curl --enable-fdt \
  --audio-drv-list=pa,sdl,alsa,oss --enable-trace-backend=$tracebackends \
  --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,gluster,rdb,blkdebug,luks,null-co,https,ssh \
  --block-drv-ro-whitelist=vmdk,vhdx,vpc \
  --extra-ldflags="$extraldflags -pie -Wl,-z,relro -Wl,-z,now" \
  --extra-cflags="$cflags -Wall" \
  --target-list="$nativebuildarch" --enable-kvm --enable-spice \
  "$@"
make V=1 %{?_smp_mflags} $buildldflags
make DESTDIR=%{buildroot} install

# other archs
./configure \
  --prefix=%{_prefix} --libdir=%{_libdir} --sysconfdir=%{_sysconfdir} --interp-prefix=%{_prefix}/qemu-%%M \
  --localstatedir=%{_localstatedir} --libexecdir=%{_libexecdir} --with-pkgversion=%{name}-%{version}-%{release} \
  --disable-strip --enable-pie --enable-numa --disable-werror --disable-xen --enable-curl --enable-jemalloc \
  --enable-glusterfs --enable-libiscsi --enable-virtfs --enable-rdma --enable-pvrdma --enable-replication --enable-libssh \
  --enable-tpm --enable-smartcard --enable-lzo --enable-bzip2 --enable-libusb --enable-usb-redir --enable-bluez --enable-libnfs \
  --disable-gtk --disable-vte --disable-brlapi --enable-live-block-migration --enable-mpath --enable-membarrier \
  --enable-attr --enable-nettle --enable-vhost-scsi --enable-vhost-net --enable-vhost-vsock --enable-vhost-crypto --enable-crypto-afalg \
  --enable-xfsctl --enable-linux-aio --enable-vvfat --enable-coroutine-pool --enable-cap-ng --enable-opengl \
  --enable-vhost-kernel --enable-opengl --enable-debug-info \
  --enable-curses --enable-vnc --enable-vnc-sasl --enable-vnc-jpeg --enable-vnc-png --enable-curl --enable-fdt \
  --audio-drv-list=pa,sdl,alsa,oss --enable-trace-backend=$tracebackends \
  --block-drv-rw-whitelist=qcow2,raw,file,host_device,nbd,iscsi,gluster,rdb,blkdebug,luks,null-co,https,ssh \
  --block-drv-ro-whitelist=vmdk,vhdx,vpc \
  --extra-ldflags="$extraldflags -pie -Wl,-z,relro -Wl,-z,now" \
  --extra-cflags="$cflags -Wall" \
  --target-list="$emulatedbuildarch" --enable-kvm --enable-tcg --enable-tcg-interpreter --enable-spice \
  "$@"
make V=1 %{?_smp_mflags} $buildldflags
make DESTDIR=%{buildroot} install

echo "config-host.mak contents:"
echo "==="
cat config-host.mak
echo "==="

gcc %{_sourcedir}/ksmctl.c $cflags -o ksmctl

###

%define _udevdir /lib/udev/rules.d
%define qemudocdir %{_docdir}/%{name}

mkdir -p %{buildroot}%{_udevdir}
mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_sysconfdir}/qemu

install -D -p -m 0644 %{_sourcedir}/ksm.service %{buildroot}%{_unitdir}
install -D -p -m 0644 %{_sourcedir}/ksm.sysconfig %{buildroot}%{_sysconfdir}/sysconfig/ksm
install -D -p -m 0755 ksmctl %{buildroot}%{_libexecdir}/ksmctl

install -D -p -m 0644 %{_sourcedir}/ksmtuned.service %{buildroot}%{_unitdir}
install -D -p -m 0755 %{_sourcedir}/ksmtuned %{buildroot}%{_sbindir}/ksmtuned
install -D -p -m 0644 %{_sourcedir}/ksmtuned.conf %{buildroot}%{_sysconfdir}/ksmtuned.conf

# Install qemu-guest-agent service and udev rules
install -m 0644 %{_sourcedir}/qemu-guest-agent.service %{buildroot}%{_unitdir}
install -m 0644 %{_sourcedir}/99-qemu-guest-agent.rules %{buildroot}%{_udevdir}

# Install kvm specific bits
mkdir -p %{buildroot}%{_bindir}/
#install -m 0755 scripts/kvm/kvm_stat %{buildroot}%{_bindir}/
install -m 0644 %{_sourcedir}/80-kvm.rules %{buildroot}%{_udevdir}

#%find_lang %{name}

%ifnarch x86_64 ppc64le
chmod -x %{buildroot}%{_mandir}/man1/*
mkdir -p %{buildroot}%{qemudocdir}
install -D -p -m 0644 -t %{buildroot}%{qemudocdir} Changelog README COPYING COPYING.LIB LICENSE
for emu in %{buildroot}%{_bindir}/qemu-system-*; do
    ln -sf qemu.1.gz %{buildroot}%{_mandir}/man1/$(basename $emu).1.gz
done

#install -m 0755 %{_sourcedir}/qemu-kvm.sh %{buildroot}%{_bindir}/qemu-kvm
ln -sf qemu.1.gz %{buildroot}%{_mandir}/man1/qemu-kvm.1.gz
%endif

install -D -p -m 0644 qemu.sasl %{buildroot}%{_sysconfdir}/sasl2/qemu.conf

# Provided by package openbios
#rm -rf %{buildroot}%{_datadir}/%{name}/openbios-ppc
rm -rf %{buildroot}%{_datadir}/%{name}/openbios-sparc32
#rm -rf %{buildroot}%{_datadir}/%{name}/openbios-sparc64
# Provided by package SLOF
rm -rf %{buildroot}%{_datadir}/%{name}/slof.bin
# Provided by package ipxe
#rm -rf %{buildroot}%{_datadir}/%{name}/pxe*rom
#rm -rf %{buildroot}%{_datadir}/%{name}/efi*rom
# Provided by package seavgabios
rm -rf %{buildroot}%{_datadir}/%{name}/vgabios-*bin
# Provided by package seabios
rm -rf %{buildroot}%{_datadir}/%{name}/bios.bin
rm -rf %{buildroot}%{_datadir}/%{name}/bios-256k.bin
rm -rf %{buildroot}%{_datadir}/%{name}/acpi-dsdt.aml
rm -rf %{buildroot}%{_datadir}/%{name}/q35-acpi-dsdt.aml
# Provided by package sgabios
rm -rf %{buildroot}%{_datadir}/%{name}/sgabios.bin
#rm -rf %{buildroot}%{_datadir}/%{name}/palcode-clipper
# microblaze firmwares we do not need
rm -rf %{buildroot}%{_datadir}/%{name}/petalogix-ml605.dtb
rm -rf %{buildroot}%{_datadir}/%{name}/petalogix-s3adsp1800.dtb

# Install binfmt
#mkdir -p %{buildroot}%{_exec_prefix}/lib/binfmt.d
#for i in dummy \
#%ifnarch %{ix86} x86_64
#    qemu-x86_64 \
#%endif
#%ifnarch alpha
#    qemu-alpha \
#%endif
#%ifnarch %{arm}
#    qemu-arm \
#%endif
#    qemu-armeb \
#    qemu-cris \
#    qemu-microblaze qemu-microblazeel \
#%ifnarch mips
#    qemu-mips qemu-mips64 \
#%endif
#%ifnarch mipsel
#    qemu-mipsel qemu-mips64el \
#%endif
#%ifnarch m68k
#    qemu-m68k \
#%endif
#%ifnarch ppc ppc64 ppc64le
#    qemu-ppc qemu-ppc64abi32 qemu-ppc64 \
#%endif
#%ifnarch sparc sparc64
#    qemu-sparc qemu-sparc32plus qemu-sparc64 \
#%endif
#%ifnarch s390 s390x
#    qemu-s390x \
#%endif
#%ifnarch sh4
#    qemu-sh4 \
#%endif
#    qemu-sh4eb \
#; do
#  test $i = dummy && continue
#  grep /$i:\$ %{_sourcedir}/qemu.binfmt > %{buildroot}%{_exec_prefix}/lib/binfmt.d/$i.conf
#  chmod 644 %{buildroot}%{_exec_prefix}/lib/binfmt.d/$i.conf
#done < %{_sourcedir}/qemu.binfmt


# Install rules to use the bridge helper with libvirt's virbr0
install -m 0644 %{_sourcedir}/bridge.conf %{buildroot}%{_sysconfdir}/qemu

# override specific architecture as default qemu
%ifarch ppc64 ppc64le
%define qemu_system_exec_arch ppc64
%endif
%ifarch x86_64
%define qemu_system_exec_arch x86_64
%endif
cat << EOF > $RPM_BUILD_ROOT%{_bindir}/qemu-kvm
#!/bin/sh

exec /usr/bin/qemu-system-%{qemu_system_exec_arch} -machine accel=kvm "\$@"
EOF
chmod +x $RPM_BUILD_ROOT%{_bindir}/qemu-kvm

# When building using 'rpmbuild' or 'fedpkg local', RPATHs can be left in
# the binaries and libraries (although this doesn't occur when
# building in Koji, for some unknown reason). Some discussion here:
#
# https://lists.fedoraproject.org/pipermail/devel/2013-November/192553.html
#
# In any case it should always be safe to remove RPATHs from
# the final binaries:
for f in %{buildroot}%{_bindir}/* %{buildroot}%{_libdir}/* \
         %{buildroot}%{_libexecdir}/*; do
  if file $f | grep -q ELF; then chrpath --delete $f; fi
done



%post kvm
# Default /dev/kvm permissions are 660, we install a udev rule changing that
# to 666. However trying to trigger the re-permissioning via udev has been
# a neverending source of trouble, so we just force it with chmod. For
# more info see: https://bugzilla.redhat.com/show_bug.cgi?id=950436
chmod --quiet 666 /dev/kvm || :


%post common
getent group kvm >/dev/null || groupadd -g 36 -r kvm
getent group qemu >/dev/null || groupadd -g 107 -r qemu
getent passwd qemu >/dev/null || \
  useradd -r -u 107 -g qemu -G kvm -d / -s /sbin/nologin \
    -c "qemu user" qemu


%post -n ksm
%systemd_post ksm.service
%systemd_post ksmtuned.service
%preun -n ksm
%systemd_preun ksm.service
%systemd_preun ksmtuned.service
%postun -n ksm
%systemd_postun_with_restart ksm.service
%systemd_postun_with_restart ksmtuned.service


%post guest-agent
%systemd_post qemu-guest-agent.service
%preun guest-agent
%systemd_preun qemu-guest-agent.service
%postun guest-agent
%systemd_postun_with_restart qemu-guest-agent.service


%files


%files kvm
%{_bindir}/qemu-kvm
%{_udevdir}/80-kvm.rules
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-kvm.1*
%endif


#%files common -f %{name}.lang
%files common
%{_bindir}/qemu-edid
%{_bindir}/qemu-keymap
%{_bindir}/qemu-pr-helper
%{_bindir}/qemu-trace-stap
%{_bindir}/elf2dmp
%ifnarch x86_64 ppc64le
%dir %{qemudocdir}
%doc %{qemudocdir}/Changelog
#%doc %{qemudocdir}/README
%doc %{qemudocdir}/qemu-doc.txt
%doc %{qemudocdir}/qemu-doc.html
#%doc %{qemudocdir}/qemu-tech.html
#%doc %{qemudocdir}/qmp-commands.txt
%doc %{qemudocdir}/qemu-qmp-ref.txt
%doc %{qemudocdir}/qemu-qmp-ref.html
%doc %{qemudocdir}/COPYING
%doc %{qemudocdir}/COPYING.LIB
%doc %{qemudocdir}/LICENSE
%endif
%ifnarch ppc64le x86_64
%doc %{qemudocdir}/specs/.buildinfo
%doc %{qemudocdir}/specs/*
%endif
%dir %{_datadir}/%{name}/
#%{_datadir}/%{name}/qemu-icon.bmp
#%{_datadir}/%{name}/qemu_logo_no_text.svg
%{_datadir}/%{name}/keymaps/
%{_datadir}/%{name}/trace-events-all
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu.1*
%{_mandir}/man1/virtfs-proxy-helper.1*
%{_mandir}/man1/qemu-trace-stap.1.gz
%{_mandir}/man7/qemu-qmp-ref.7.gz
%{_mandir}/man7/qemu-block-drivers.7.gz
%{_mandir}/man7/qemu-cpu-models.7.gz
%endif
%{_bindir}/virtfs-proxy-helper
%attr(4755, root, root) %{_libexecdir}/qemu-bridge-helper
%config(noreplace) %{_sysconfdir}/sasl2/qemu.conf
%dir %{_sysconfdir}/qemu
%config(noreplace) %{_sysconfdir}/qemu/bridge.conf
%ifnarch x86_64 ppc64le
%dir %{_docdir}/%{name}/
%{_docdir}/%{name}/interop/.buildinfo
%{_docdir}/%{name}/interop/*
%endif
%{_datadir}/icons/hicolor/*/apps/qemu.*
%{_datadir}/applications/qemu.desktop
%{_datadir}/%{name}/qemu-nsis.bmp


%files -n ksm
%{_libexecdir}/ksmctl
%{_sbindir}/ksmtuned
%{_unitdir}/ksmtuned.service
%{_unitdir}/ksm.service
%config(noreplace) %{_sysconfdir}/ksmtuned.conf
%config(noreplace) %{_sysconfdir}/sysconfig/ksm


%files guest-agent
%doc COPYING
%{_bindir}/qemu-ga
%{_unitdir}/qemu-guest-agent.service
%{_udevdir}/99-qemu-guest-agent.rules
%ifnarch x86_64 ppc64le
%{_mandir}/man8/qemu-ga.8*
%{_mandir}/man7/qemu-ga-ref.7.gz
%doc %{qemudocdir}/qemu-ga-ref.html
%doc %{qemudocdir}/qemu-ga-ref.txt
%endif


%files img
%{_bindir}/qemu-img
%{_bindir}/qemu-io
%{_bindir}/qemu-nbd
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-img.1*
%{_mandir}/man8/qemu-nbd.8*
%endif


%files -n ivshmem-tools
%{_bindir}/ivshmem-client
%{_bindir}/ivshmem-server


%files bootloaders
#%{_datadir}/%{name}/acpi-dsdt.aml
#%{_datadir}/%{name}/q35-acpi-dsdt.aml
#%{_datadir}/%{name}/bios.bin
#%{_datadir}/%{name}/bios-256k.bin
#%{_datadir}/%{name}/sgabios.bin
%{_datadir}/%{name}/linuxboot.bin
%{_datadir}/%{name}/linuxboot_dma.bin
%{_datadir}/%{name}/multiboot.bin
%{_datadir}/%{name}/bios-microvm.bin
%{_datadir}/%{name}/kvmvapic.bin
%{_datadir}/%{name}/vgabios.bin
%{_datadir}/%{name}/qemu_vga.ndrv
#%{_datadir}/%{name}/vgabios-cirrus.bin
#%{_datadir}/%{name}/vgabios-qxl.bin
#%{_datadir}/%{name}/vgabios-stdvga.bin
#%{_datadir}/%{name}/vgabios-vmware.bin
#%{_datadir}/%{name}/vgabios-virtio.bin
%{_datadir}/%{name}/pxe-e1000.rom
%{_datadir}/%{name}/efi-e1000.rom
%{_datadir}/%{name}/efi-e1000e.rom
%{_datadir}/%{name}/pxe-virtio.rom
%{_datadir}/%{name}/efi-virtio.rom
%{_datadir}/%{name}/pxe-pcnet.rom
%{_datadir}/%{name}/efi-pcnet.rom
%{_datadir}/%{name}/pxe-rtl8139.rom
%{_datadir}/%{name}/efi-rtl8139.rom
%{_datadir}/%{name}/pxe-ne2k_pci.rom
%{_datadir}/%{name}/efi-ne2k_pci.rom
%{_datadir}/%{name}/palcode-clipper
%{_datadir}/%{name}/bamboo.dtb
%{_datadir}/%{name}/canyonlands.dtb
%{_datadir}/%{name}/ppc_rom.bin
#%{_datadir}/%{name}/spapr-rtas.bin
%{_datadir}/%{name}/u-boot.e500
%{_datadir}/%{name}/efi-eepro100.rom
%{_datadir}/%{name}/efi-vmxnet3.rom
#%{_datadir}/%{name}/slof.bin
%{_datadir}/%{name}/openbios-ppc
%{_datadir}/%{name}/skiboot.lid
%{_datadir}/%{name}/pxe-eepro100.rom
%{_datadir}/%{name}/hppa-firmware.img
%{_datadir}/%{name}/u-boot-sam460-20100605.bin
%{_datadir}/%{name}/pvh.bin
%{_datadir}/%{name}/edk2-aarch64-code.fd
%{_datadir}/%{name}/edk2-arm-code.fd
%{_datadir}/%{name}/edk2-arm-vars.fd
%{_datadir}/%{name}/edk2-i386-code.fd
%{_datadir}/%{name}/edk2-i386-secure-code.fd
%{_datadir}/%{name}/edk2-i386-vars.fd
%{_datadir}/%{name}/edk2-licenses.txt
%{_datadir}/%{name}/edk2-x86_64-code.fd
%{_datadir}/%{name}/edk2-x86_64-secure-code.fd
%{_datadir}/%{name}/firmware/50-edk2-i386-secure.json
%{_datadir}/%{name}/firmware/50-edk2-x86_64-secure.json
%{_datadir}/%{name}/firmware/60-edk2-aarch64.json
%{_datadir}/%{name}/firmware/60-edk2-arm.json
%{_datadir}/%{name}/firmware/60-edk2-i386.json
%{_datadir}/%{name}/firmware/60-edk2-x86_64.json
%{_datadir}/%{name}/opensbi-riscv32-virt-fw_jump.bin
%{_datadir}/%{name}/opensbi-riscv64-sifive_u-fw_jump.bin
%{_datadir}/%{name}/opensbi-riscv64-virt-fw_jump.bin


#%files kvm-tools
#%{_bindir}/kvm_stat


%files system-x64
%{_bindir}/qemu-system-x86_64
%{_datadir}/systemtap/tapset/qemu-system-x86_64*.stp
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-system-x86_64.1*
%endif


%files system-alpha
%{_bindir}/qemu-system-alpha
%{_datadir}/systemtap/tapset/qemu-system-alpha*.stp
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-system-alpha.1*
%endif


%files system-arm
%{_bindir}/qemu-system-arm
%{_datadir}/systemtap/tapset/qemu-system-arm*.stp
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-system-arm.1*
%endif


%files system-mips64
%{_bindir}/qemu-system-mips64
%{_bindir}/qemu-system-mips64el
%{_datadir}/systemtap/tapset/qemu-system-mips*.stp
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-system-mips64el.1*
%{_mandir}/man1/qemu-system-mips64.1*
%endif


%files system-s390x
%{_bindir}/qemu-system-s390x
%{_datadir}/systemtap/tapset/qemu-system-s390x*.stp
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-system-s390x.1*
%endif
#%{_datadir}/%{name}/s390-zipl.rom
%{_datadir}/%{name}/s390-ccw.img
%{_datadir}/%{name}/s390-netboot.img


%files system-sparc64
%{_bindir}/qemu-system-sparc64
%{_datadir}/systemtap/tapset/qemu-system-sparc*.stp
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-system-sparc64.1*
%endif
%{_datadir}/%{name}/QEMU,tcx.bin
%{_datadir}/%{name}/QEMU,cgthree.bin
%{_datadir}/%{name}/openbios-sparc64


%files system-ppc64
%{_bindir}/qemu-system-ppc64
%{_datadir}/systemtap/tapset/qemu-system-ppc64*.stp
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-system-ppc64.1*
%endif


%files system-riscv64
%{_bindir}/qemu-system-riscv64
%{_datadir}/systemtap/tapset/qemu-system-riscv64*.stp
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-system-riscv64.1*
%endif


%files system-aarch64
%{_bindir}/qemu-system-aarch64
%{_datadir}/systemtap/tapset/qemu-system-aarch64*.stp
%ifnarch x86_64 ppc64le
%{_mandir}/man1/qemu-system-aarch64.1*
%endif


%changelog
