File qemu-2.7.spec of Package qemu-2.7

#
# spec file for package qemu
#
# Copyright (c) 2018 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 _lto_cflags %{nil}
%bcond_without libnfs
%bcond_without librbd
%bcond_without qemu_opengl
%bcond_without qemu_vte
%bcond_without spice
%bcond_without virglrenderer

Name:           qemu-2.7
Version:        0
Release:        0
Summary:        Upstream %{name}
ExclusiveArch:  x86_64
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
Url:            https://www.qemu.org/
%define qemu_revision_full 0d83fccb4fb3140d21feeb37ba069ba71029aaa7
%define qemu_revision_short 0d83fccb4f
%define qemu_date_unix 1482507486
%define qemu_date_commit 2016-12-23 09:38:06 -0600

%define seabios_revision_full e2fc41e24ee0ada60fc511d60b15a41b294538be
%define seabios_revision_short e2fc41e2
%define seabios_date_unix 1467374532
%define seabios_date_commit 2016-07-01 14:02:12 +0200

%define ipxe_revision_full 04186319181298083ef28695a8309028b26fe83c
%define ipxe_revision_short 04186319
%define ipxe_date_unix 1466593675
%define ipxe_date_commit 2016-06-22 12:07:55 +0100

Patch1477053426: qemu.78f66897ddf58d1ffe5e0b95f7c1a1dad103a8da.patch
Patch1477053427: qemu.35132016dc1c27de2b1354b161df6cc22f3ac5bf.patch
Patch1482955473: qemu.4d04351f4c3db3b70dc21f7fdc8155e341f39916.patch
Patch1511866287: qemu.75e5b70e6b5dcc4f2219992d7cffa462aa406af0.patch
Source0: %{name}-%{version}.tar
#KEEP NOSOURCE DEBUGINFO
NoSource: 0
%if %suse_version > 1110
BuildRequires: pkgconfig(python3)
%endif
Patch1477411781: seabios.99e3316d5970dbcdac8ce7bb0f89f0986d01c0ce.patch
Patch1531663514: seabios.8c3f57ea1217ea0c80a72898bc35baa0e14af0e0.patch
%define seabios_version e2fc41e24ee0ada60fc511d60b15a41b294538be
Source1: seabios-%{seabios_version}.tar
#KEEP NOSOURCE DEBUGINFO
NoSource: 1
Patch1485331250: ipxe.941c53a3bf0f0c1c276996e2a68b0fa6263ce410.patch
Patch1490176329: ipxe.45f2265bfcbbf2afd7fac24372ae26e453f2b52d.patch
Patch1490772905: ipxe.28e26dd2503e6006fabb26f8c33050ba93a99623.patch
Patch1490772963: ipxe.5f85cbb9ee1c00cec81a848a9e871ad5d1e7f53f.patch
Patch1497439996: ipxe.7c395b0e21806b946fe944a27fc273407f357ea1.patch
Patch1524581252: ipxe.8ed4e3049f5fcb3a0b32f5190940e78c61654cff.patch
Patch1531069963: ipxe.1c47eb186e7e38bde2a1db528cc3557b1b300386.patch
Patch1548069424: ipxe.956f6a7227b62ce98d7840439af17bbca04f0c86.patch
Patch1484818598: ipxe.stable-build-id.patch
Patch1532525090: ipxe.R_X86_64_PLT32.patch
Patch1558971304: ipxe.address-of-packed-member.patch
Patch1558976324: ipxe.dbg_efi_protocols.patch
%define ipxe_version 04186319181298083ef28695a8309028b26fe83c
Source2: ipxe-%{ipxe_version}.tar
#KEEP NOSOURCE DEBUGINFO
NoSource: 2
%define sgabios_version 23d474943dcd55d0550a3d20b3d30e9040a4f15b
Source3: sgabios-%{sgabios_version}.tar
#KEEP NOSOURCE DEBUGINFO
NoSource: 3
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
#
%if %{suse_version} == 1110
BuildRequires:  gcc48
BuildRequires:  gtk2-devel
%endif
BuildRequires:  acpica
BuildRequires:  gcc-c++
BuildRequires:  libaio-devel
BuildRequires:  libattr-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  libnuma-devel
%if %{with librbd}
BuildRequires:  librbd-devel
%endif
BuildRequires:  makeinfo
BuildRequires:  ovmf-tools
BuildRequires:  perl
BuildRequires:  pkg-config
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(bzip2)
%if %{with qemu_opengl}
BuildRequires:  pkgconfig(epoxy)
BuildRequires:  pkgconfig(gbm)
%endif
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(gmodule-2.0)
BuildRequires:  pkgconfig(gnutls)
BuildRequires:  pkgconfig(gthread-2.0)
BuildRequires:  pkgconfig(gtk+-3.0)
BuildRequires:  pkgconfig(gtk+-x11-3.0)
BuildRequires:  pkgconfig(libacl)
BuildRequires:  pkgconfig(libcap)
BuildRequires:  pkgconfig(libcap-ng)
BuildRequires:  pkgconfig(libcurl)
%if %{with qemu_opengl}
BuildRequires:  pkgconfig(libdrm)
%endif
%if %{with libnfs}
BuildRequires:  pkgconfig(libnfs)
%endif
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libssh2)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(libusbredirparser-0.5)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  pkgconfig(ncurses)
BuildRequires:  pkgconfig(pixman-1)
BuildRequires:  pkgconfig(python2)
%if %{with spice}
BuildRequires:  pkgconfig(spice-protocol)
BuildRequires:  pkgconfig(spice-server)
%endif
BuildRequires:  pkgconfig(uuid)
BuildRequires:  pkgconfig(vdeplug)
%if %{with virglrenderer}
BuildRequires:  pkgconfig(virglrenderer)
%endif
%if %{with qemu_vte}
BuildRequires:  pkgconfig(vte-2.91)
%endif
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xencontrol)
BuildRequires:  pkgconfig(xendevicemodel)
BuildRequires:  pkgconfig(xenevtchn)
BuildRequires:  pkgconfig(xenforeignmemory)
BuildRequires:  pkgconfig(xengnttab)
BuildRequires:  pkgconfig(xenguest)
BuildRequires:  pkgconfig(xenstore)
BuildRequires:  pkgconfig(zlib)
BuildRequires:  xfsprogs-devel

%description

%prep
%setup -q
pushd '.'
%patch1477053426 -p1
%patch1477053427 -p1
%patch1482955473 -p1
%patch1511866287 -p1
popd

rm -rf './roms/seabios'
tar xfa %{SOURCE1}
mkdir -vp './roms'
mv -v 'seabios-%{seabios_version}' './roms/seabios'
pushd './roms/seabios'
%patch1477411781 -p1
%patch1531663514 -p1
popd

rm -rf './roms/ipxe'
tar xfa %{SOURCE2}
mkdir -vp './roms'
mv -v 'ipxe-%{ipxe_version}' './roms/ipxe'
pushd './roms/ipxe'
%patch1485331250 -p1
%patch1490176329 -p1
%patch1490772905 -p1
%patch1490772963 -p1
%patch1497439996 -p1
%patch1524581252 -p1
%patch1531069963 -p1
%patch1548069424 -p1
%patch1484818598 -p1
%patch1532525090 -p1
%patch1558971304 -p1
%patch1558976324 -p1
popd

rm -rf './roms/sgabios'
tar xfa %{SOURCE3}
mkdir -vp './roms'
mv -v 'sgabios-%{sgabios_version}' './roms/sgabios'

%build
echo "%{seabios_revision_full}" > roms/seabios/.version
test -x "$(type -P gcc)"     && CC=$_
test -x "$(type -P gcc-4.6)" && CC=$_
test -x "$(type -P gcc-4.7)" && CC=$_
test -x "$(type -P gcc-4.8)" && CC=$_
test -x "$(type -P cpp)"     && CPP=$_
test -x "$(type -P cpp-4.6)" && CPP=$_
test -x "$(type -P cpp-4.7)" && CPP=$_
test -x "$(type -P cpp-4.8)" && CPP=$_
test -x "$(type -P g++)"     && CXX=$_
test -x "$(type -P g++-4.6)" && CXX=$_
test -x "$(type -P g++-4.7)" && CXX=$_
test -x "$(type -P g++-4.8)" && CXX=$_
tee .env.sh <<_EOF_
CC=$CC
CPP=$CPP
CXX=$CXX
_EOF_
. ./.env.sh
#
%ifarch %ix86 x86_64
target_list="
i386-softmmu
x86_64-softmmu
"
%endif
target_list="`echo ${target_list}| xargs`"
test -n "${target_list}"
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 || :
if \
bash \
./configure \
	--prefix=%{_libdir}/%{name} \
	--localstatedir=%{_localstatedir} \
	\
	--cc="${CC}" \
	--host-cc="${CC}" \
	--cxx="${CXX}" \
	--extra-cflags="%{optflags} ${XC_COMPAT}" \
	--target-list="${target_list}" \
	--audio-drv-list=alsa \
	\
	--iasl="$(type -P iasl)" \
	--install="$(type -P install)" \
	--objcc="$(type -P false)" \
	--python="$(type -P python)" \
	--tls-priority=NORMAL \
	--with-system-pixman \
	\
	\
	--disable-libnfs \
	--disable-opengl \
	--disable-rbd \
	--disable-spice \
	--disable-virglrenderer \
	--disable-vte \
	\
	\
	--disable-archipelago \
	--enable-attr \
	--disable-bluez \
	--disable-brlapi \
	--disable-bsd-user \
	--enable-bzip2 \
	--enable-cap-ng \
	--disable-cocoa \
	--enable-coroutine-pool \
	--enable-curl \
	--enable-curses \
	--disable-debug-info \
	--disable-debug-tcg \
	--enable-docs \
	--disable-fdt \
	--enable-gcrypt \
	--disable-glusterfs \
	--enable-gnutls \
	--enable-gtk \
	--disable-guest-agent \
	--disable-guest-agent-msi \
	--disable-jemalloc \
	--enable-kvm \
	--disable-libiscsi \
%if %{with libnfs}
	--enable-libnfs \
%endif
	--enable-libssh2 \
	--enable-libusb \
	--enable-linux-aio \
	--disable-linux-user \
	--disable-lzo \
	--enable-modules \
	--disable-netmap \
	--disable-nettle \
	--enable-numa \
%if %{with qemu_opengl}
	--enable-opengl \
%endif
	--enable-pie \
	--disable-qom-cast-debug \
%if %{with librbd}
	--enable-rbd \
%endif
	--disable-rdma \
	--disable-sdl \
	--disable-seccomp \
	--disable-slirp \
	--disable-smartcard \
	--disable-snappy \
	--disable-sparse \
%if %{with spice}
	--enable-spice \
%endif
	--enable-stack-protector \
	--disable-strip \
	--enable-system \
	--disable-tcg-interpreter \
	--disable-tcmalloc \
	--enable-tools \
	--disable-tpm \
	--enable-usb-redir \
	--disable-user \
	--enable-uuid \
	--enable-vde \
	--enable-vhdx \
	--enable-vhost-net \
	--enable-vhost-scsi \
%if %{with virglrenderer}
	--enable-virglrenderer \
%endif
	--enable-virtfs \
	--enable-vnc \
	--disable-vnc-jpeg \
	--enable-vnc-png \
	--disable-vnc-sasl \
%if %{with qemu_vte}
	--enable-vte \
%endif
	--disable-werror \
	--enable-xen \
	--enable-xen-pci-passthrough \
	--enable-xfsctl \
	%{nil}
then
	: success
else
	cat config.log
	exit 1
fi

V=V=1
make %{?_smp_mflags} ${V}

%ifarch x86_64
pushd pc-bios/optionrom
	cp --remove-destination -avt .. \
	kvmvapic.bin \
	linuxboot_dma.bin \
	linuxboot.bin \
	multiboot.bin \
	%{nil}
popd
efirom=
test -x "$(type -P EfiRom)" && efirom=efirom
make                 -C roms ${V} CC="${CC}" sgabios                       BUILD_DATE='\"date\"' BUILD_SHORT_DATE='\"short_date\"' BUILD_HOST='\"host\"' BUILD_USER='\"user\"'
make %{?_smp_mflags} -C roms ${V} CC="${CC}" bios seavgabios pxerom ${efirom} HOST_CC=${CC} CPP="${CPP}" SEABIOS_EXTRAVERSION='-%{_project}/%{name}'
%endif

%install
. ./.env.sh
touch -r config-host.mak pc-bios
%make_install
find %{buildroot} -ls
find %{buildroot} -name "*.la" -print -delete

%files
%defattr(-, root, root)
%doc COPYING COPYING.LIB Changelog README VERSION qemu-doc.html
%{_libdir}/%{name}

%changelog