SHA256
1
0
forked from pool/qemu
qemu/qemu.spec.in

1423 lines
38 KiB
RPMSpec

#
# spec file for package qemu
#
# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
#
# 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 http://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 "%{?distribution}" == ""
%define distro private-build
%else
%define distro %{distribution}
%endif
%ifarch %ix86 x86_64
# 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} > 1320 || ( 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
Name: qemu
Url: http://www.qemu.org/
Summary: Machine emulator and virtualizer
License: BSD-3-Clause AND GPL-2.0 AND GPL-2.0+ AND LGPL-2.1+ AND MIT
Group: System/Emulators/PC/
QEMU_VERSION
Release: 0
Source: http://wiki.qemu.org/download/qemu-2.11.0.tar.xz
Source99: http://wiki.qemu.org/download/qemu-2.11.0.tar.xz.sig
Source1: 80-kvm.rules
Source2: qemu-ifup
Source3: kvm_stat
Source4: kvm_stat.1.gz
Source5: qemu-kvm.1.gz
Source6: ksm.service
Source7: qemu-ga.service
Source8: 80-qemu-ga.rules
Source9: qemu-supportconfig
Source10: kvm.conf
Source11: bridge.conf
Source12: supported.x86.txt
Source13: supported.s390.txt
Source14: supported.arm.txt
Source15: supported.ppc.txt
# Upstream First -- http://wiki.qemu-project.org/Contribute/SubmitAPatch
# This patch queue is auto-generated from https://github.com/openSUSE/qemu
PATCH_FILES
# Please do not add QEMU patches manually here.
# Run update_git.sh to regenerate this queue.
# SeaBIOS / SeaVGABIOS (Currently no patches)
# ipxe
# PATCH-FIX-OPENSUSE ipxe-stable-buildid.patch brogers@suse.com -- reproducible builds
Patch1100: ipxe-stable-buildid.patch
Patch1101: ipxe-use-gcc6-for-more-compact-code.patch
# sgabios
# PATCH-FIX-OPENSUSE sgabios-stable-buildid.patch brogers@suse.com -- reproducible builds
Patch1200: sgabios-stable-buildid.patch
# SLOF (Currently no patches)
# skiboot
Patch1400: skiboot-GCC7-fixes-for-Wimplicit-fallthr.patch
Patch1401: skiboot-libc-stdio-vsnprintf.c-add-expli.patch
Patch1402: skiboot-build-LDFLAGS-pass-pie-flag-explicitly-to-ld.patch
# this is to make lint happy
Source300: qemu-rpmlintrc
Source301: ipxe-stub-out-the-SAN-req-s-in-int13.patch
Source400: update_git.sh
ExcludeArch: s390
%if "%{name}" == "qemu-testsuite"
ExcludeArch: s390x
%endif
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: binutils-devel
%endif
BuildRequires: bluez-devel
BuildRequires: brlapi-devel
BuildRequires: curl-devel
BuildRequires: cyrus-sasl-devel
BuildRequires: e2fsprogs-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%{?with_rbd}
%if 0%{?is_opensuse} || 0%{?sle_version} > 120100
BuildRequires: librbd-devel
%else
BuildRequires: ceph-devel
%endif
%endif
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
BuildRequires: libiscsi-devel
%endif
BuildRequires: libjpeg-devel
%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: libpcap-devel
BuildRequires: libpixman-1-0-devel
BuildRequires: libpng-devel
BuildRequires: libpulse-devel
%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
BuildRequires: multipath-tools-devel
%endif
BuildRequires: ncurses-devel
%if %{build_x86_firmware_from_source}
BuildRequires: ovmf-tools
%endif
BuildRequires: pkgconfig
BuildRequires: pwdutils
BuildRequires: python
%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"
BuildRequires: bc
BuildRequires: qemu-arm = %version
BuildRequires: qemu-block-curl = %version
BuildRequires: qemu-block-dmg = %version
BuildRequires: qemu-extra = %version
BuildRequires: qemu-guest-agent = %version
BuildRequires: qemu-ppc = %version
BuildRequires: qemu-s390 = %version
BuildRequires: qemu-tools = %version
BuildRequires: qemu-x86 = %version
%if 0%{?with_glusterfs}
BuildRequires: qemu-block-gluster = %version
%endif
%if 0%{?suse_version} > 1320 || ( 0%{?suse_version} == 1315 && 0%{?sle_version} > 120100 )
BuildRequires: qemu-block-iscsi = %version
%endif
%if 0%{?with_rbd}
BuildRequires: qemu-block-rbd = %version
%endif
BuildRequires: qemu-block-ssh = %version
%endif
Requires(pre): shadow
Requires(post): coreutils
%if %{kvm_available}
Requires(post): acl
Requires(post): udev
%ifarch s390x
Requires(post): procps
%endif
%if 0%{?suse_version} > 1320
Recommends: kvm_stat
%else
Recommends: python-curses
%endif
%endif
Recommends: qemu-block-curl
Recommends: qemu-tools
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%{?with_rbd}
Suggests: qemu-block-rbd
%endif
Suggests: qemu-block-ssh
Suggests: qemu-extra
Suggests: qemu-lang
%if 0%{?is_opensuse}
Recommends: qemu-ksm = %{version}
%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}
%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 sgabios.bin \
vgabios.bin vgabios-cirrus.bin vgabios-stdvga.bin vgabios-virtio.bin \
vgabios-vmware.bin vgabios-qxl.bin pxe-e1000.rom pxe-pcnet.rom \
pxe-ne2k_pci.rom pxe-rtl8139.rom pxe-eepro100.rom pxe-virtio.rom}
%define x86_64_only_extra_built_firmware_list {efi-e1000.rom efi-e1000e.rom \
efi-eepro100.rom efi-pcnet.rom efi-ne2k_pci.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
Requires: qemu = %version
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
Requires: qemu = %version
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
Requires: qemu = %version
%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
Requires: qemu = %version
Recommends: qemu-ipxe
Recommends: qemu-vgabios
Recommends: ovmf
Recommends: qemu-uefi-aarch64
%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
Requires: qemu = %version
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
Url: http://www.linux-kvm.org
Summary: Wrapper to enable KVM acceleration under QEMU
Group: System/Emulators/PC
%ifarch %ix86 x86_64
Requires: qemu-x86 = %version
%endif
%ifarch s390x
Requires: qemu-s390 = %version
%endif
Provides: kvm = %version
Obsoletes: kvm < %version
%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
%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: qemu < %version-%release \
Conflicts: qemu > %version-%release \
Conflicts: qemu-tools < %version-%release \
Conflicts: qemu-tools > %version-%release
%package block-curl
Summary: cURL block support for QEMU
Group: System/Emulators/PC
Provides: qemu:%_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
%{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
%{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
%{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%{?with_rbd}
%package block-rbd
Summary: Rados Block Device (Ceph) support for QEMU
Group: System/Emulators/PC
%{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
%{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 tools
Summary: Tools for QEMU
Group: System/Emulators/PC
Provides: qemu:%_libexecdir/qemu-bridge-helper
Requires(pre): permissions
Requires(pre): shadow
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
Provides: qemu:%_bindir/qemu-ga
Requires(pre): shadow
Requires(post): udev
%{?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 %ix86 x86_64
%package seabios
Summary: x86 Legacy BIOS for QEMU
Group: System/Emulators/PC
SEABIOS_VERSION
Release: 0
BuildArch: noarch
Conflicts: qemu < 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
SEABIOS_VERSION
Release: 0
BuildArch: noarch
Conflicts: qemu < 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: qemu < 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: qemu < 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
%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 qemu-2.11.0
PATCH_EXEC
pushd roms/ipxe
%patch1100 -p1
%if 0%{?suse_version} <= 1320
%patch1101 -p1
%endif
popd
pushd roms/sgabios
%patch1200 -p1
popd
pushd roms/SLOF
popd
pushd roms/skiboot
%patch1400 -p1
%patch1401 -p1
%patch1402 -p1
popd
# as a safeguard, delete the firmware files that we intend to build
for i in %built_firmware
do
unlink pc-bios/$i
done
%build
echo '%{version}' > roms/seabios/.version
./configure \
--prefix=%_prefix \
--sysconfdir=%_sysconfdir \
--libdir=%_libdir \
--libexecdir=%_libexecdir \
--localstatedir=%_localstatedir \
--docdir=%_docdir/%name \
--firmwarepath=%_datadir/%name \
--extra-cflags="%{optflags}" \
--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-brlapi \
--enable-bzip2 \
--enable-cap-ng \
--disable-capstone \
--enable-coroutine-pool \
--disable-crypto-afalg \
--enable-curl \
--enable-curses \
--enable-fdt \
--enable-gcrypt \
%if 0%{?with_glusterfs}
--enable-glusterfs \
%else
--disable-glusterfs \
%endif
--enable-gnutls \
--enable-gtk \
--with-gtkabi=3.0 \
--disable-hax \
--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
--disable-libnfs \
--enable-libssh2 \
--enable-libusb \
--enable-linux-aio \
--enable-lzo \
%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
%if 0%{?with_rbd}
--enable-rbd \
%else
--disable-rbd \
%endif
%if 0%{?suse_version} >= 1315
--enable-rdma \
%else
--disable-rdma \
%endif
--enable-replication \
%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
%if 0%{?is_opensuse}
--enable-smartcard \
%else
--disable-smartcard \
%endif
--enable-snappy \
--enable-spice \
--disable-tcmalloc \
--enable-tpm \
--enable-usb-redir \
--enable-vde \
--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
%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}
make %{?_smp_mflags} -C roms bios
make %{?_smp_mflags} -C roms seavgabios
make %{?_smp_mflags} -C roms pxerom
%ifarch x86_64
make %{?_smp_mflags} -C roms efirom
%endif
make -C roms sgabios
%if %{force_fit_virtio_pxe_rom}
pushd roms/ipxe
patch -p1 < %{SOURCE301}
popd
make %{?_smp_mflags} -C roms pxerom_variants=virtio pxerom_targets=1af41000 NO_WERROR=1 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 SKIBOOT_VERSION=skiboot-5.3.7 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}/qemu/$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"
%ifnarch %ix86 x64_64
export QEMU_PROG=%{_bindir}/qemu-system-x86_64
%endif
export QEMU_IMG_PROG=%{_bindir}/qemu-img
export QEMU_IO_PROG=%{_bindir}/qemu-io
export QEMU_NBD_PROG=%{_bindir}/qemu-nbd
# make check-block would rebuild qemu-img and qemu-io
make tests/qemu-iotests/socket_scm_helper V=1
pushd tests/qemu-iotests
# -qcow 001 seems to hang?
# TODO investigate hangs and failures
#for fmt in -raw -bochs -cloop -parallels -qcow2 -qed -vdi -vpc -vhdx -vmdk; do
# ./check -v -T $fmt -file -g quick || true
#done
popd
# Create minimal gzip format file
echo "Test" > test.txt
cat test.txt | gzip - > test.gz
# Check qemu-img info output (bsc#945778)
format=`qemu-img info test.gz | grep "file format:" | cut -d ':' -f 2 | tr -d '[:space:]'`
[ "$format" == "raw" ] || false
# Create minimal tar format file
tar cf test.tar test.txt
# Check qemu-img info output (bsc#945778)
format=`qemu-img info test.tar | grep "file format:" | cut -d ':' -f 2 | tr -d '[:space:]'`
[ "$format" == "raw" ] || false
%endif # qemu-testsuite
%install
%if "%{name}" != "qemu-testsuite"
touch -r config-host.mak pc-bios
make install DESTDIR=%{buildroot}
%ifnarch %ix86 x86_64
for f in acpi-dsdt.aml %{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 %{SOURCE11} %{buildroot}%{_sysconfdir}/qemu/bridge.conf
install -D -m 0755 %{SOURCE2} %{buildroot}/usr/share/qemu/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/qemu
%if 0%{?is_opensuse} == 0
install -D -m 0644 %{SOURCE12} %{buildroot}%{_docdir}/qemu-x86/supported.txt
install -D -m 0644 %{SOURCE13} %{buildroot}%{_docdir}/qemu-s390/supported.txt
install -D -m 0644 %{SOURCE14} %{buildroot}%{_docdir}/qemu-arm/supported.txt
install -D -m 0644 %{SOURCE15} %{buildroot}%{_docdir}/qemu-ppc/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}
%if 0%{?suse_version} <= 1320
install -D -m 0755 %{SOURCE3} %{buildroot}%{_bindir}/kvm_stat
install -D -m 0644 %{SOURCE4} %{buildroot}%{_mandir}/man1/kvm_stat.1.gz
%endif
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 %{SOURCE10} %{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
%preun guest-agent
%service_del_preun 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.service || :
fi
%postun guest-agent
%service_del_postun qemu-ga.service
%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 COPYING COPYING.LIB COPYING.PYTHON Changelog README VERSION 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/qemu.1.gz
%_mandir/man7/qemu-block-drivers.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/qemu
%if %{kvm_available}
%if 0%{?suse_version} <= 1320
%_bindir/kvm_stat
%doc %_mandir/man1/kvm_stat.1.gz
%endif
%{_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
%_bindir/qemu-system-ppcemb
%_datadir/%name/ppc_rom.bin
%_datadir/%name/openbios-ppc
%_datadir/%name/slof.bin
%_datadir/%name/spapr-rtas.bin
%_datadir/%name/u-boot.e500
%_datadir/%name/bamboo.dtb
%_datadir/%name/petalogix-ml605.dtb
%_datadir/%name/skiboot.lid
%_datadir/%name/qemu_vga.ndrv
%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-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-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/palcode-clipper
%_datadir/%name/openbios-sparc32
%_datadir/%name/openbios-sparc64
%_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%{?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 lang -f %name.lang
%defattr(-, root, root)
%ifarch %ix86 x86_64
%files seabios
%defattr(-, root, root)
%dir %_datadir/%name
%_datadir/%name/bios.bin
%_datadir/%name/bios-256k.bin
%_datadir/%name/acpi-dsdt.aml
%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
%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-pcnet.rom
%_datadir/%name/pxe-ne2k_pci.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-pcnet.rom
%_datadir/%name/efi-ne2k_pci.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/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