File qemu-8.2.spec of Package qemu-8.2

#
# 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
%global _buildshell /bin/bash
%bcond_without libnfs
%bcond_without librbd
%bcond_without qemu_gtk3_22
%bcond_without qemu_opengl
%bcond_without qemu_vte
%bcond_without spice
%bcond_without virglrenderer

Name:           qemu-8.2
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 f671ce11d2a15a58ab752d7cf0b2890c9022c7ba
%define qemu_revision_short f671ce11d2
%define qemu_date_unix 1742980408
%define qemu_date_commit 2025-03-26 12:13:28 +0300

%define seabios_revision_full a6ed6b701f0a57db0569ab98b0661c12a6ec3ff8
%define seabios_revision_short a6ed6b70
%define seabios_date_unix 1699879799
%define seabios_date_commit 2023-11-13 13:49:59 +0100

%define ipxe_revision_full 4262328c13a3ec085eac7c6c58fbed27d2466a0d
%define ipxe_revision_short 4262328c
%define ipxe_date_unix 1750952038
%define ipxe_date_commit 2025-06-26 16:33:58 +0100

%define ovmf_revision_full edc6681206c1a8791981a2f911d2fb8b3d2f5768
%define ovmf_revision_short edc6681206
%define ovmf_date_unix 1707931603
%define ovmf_date_commit 2024-02-14 17:26:43 +0000

%define btestfloat3_revision_full e7af9751d9f9fd3b47911f51a5cfd08af256a9ab
%define btestfloat3_revision_short e7af975
%define btestfloat3_date_unix 1689946593
%define btestfloat3_date_commit 2023-07-21 15:36:33 +0200

%define keycodemapdb_revision_full f5772a62ec52591ff6870b7e8ef32482371f22c6
%define keycodemapdb_revision_short f5772a6
%define keycodemapdb_date_unix 1677604609
%define keycodemapdb_date_commit 2023-02-28 18:16:49 +0100

Patch1523985546: qemu.configure-prefix.patch
Patch1680791780: qemu.22e11539e16773b1311ec2493f984d4542e93d90.patch
%if %suse_version > 1110
BuildRequires: python(abi) > 3.0
%endif
%define seabios_version a6ed6b701f0a57db0569ab98b0661c12a6ec3ff8
Patch1484818598: ipxe.stable-build-id.patch
%define ipxe_version 4262328c13a3ec085eac7c6c58fbed27d2466a0d
Patch1680904274: ovmf.GCC48_IA32_CC_FLAGS.patch
Patch1680906047: ovmf.BUILD_CFLAGS.patch
Patch1617269159: ovmf.Disable-brotli.patch
Patch1737362431: ovmf.e063f8b8a53861043b9872cc35b08a3dc03b0942.patch
%define ovmf_version edc6681206c1a8791981a2f911d2fb8b3d2f5768
%define openssl_version de90e54bbe82e5be4fb9608b6f5c308bb837d355
%define bsoftfloat3_version b64af41c3276f97f0e181920400ee056b9c88037
%define btestfloat3_version e7af9751d9f9fd3b47911f51a5cfd08af256a9ab
%define keycodemapdb_version f5772a62ec52591ff6870b7e8ef32482371f22c6
BuildRoot:      %_tmppath/%name-%version-build
BuildRequires:  acpica
BuildRequires:  bash
BuildRequires:  fdupes
%if %suse_version < 1500
BuildRequires:  gcc8
BuildRequires:  gcc8-c++
%else
BuildRequires:  gcc-c++
%endif
BuildRequires:  gettext-tools
BuildRequires:  libaio-devel
BuildRequires:  libattr-devel
BuildRequires:  libfdt-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  libnuma-devel
%if %{with librbd}
BuildRequires:  librbd-devel
%endif
BuildRequires:  nasm >= 2.15
BuildRequires:  ninja >= 1.8.2
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) >= 2.56
BuildRequires:  pkgconfig(gio-2.0)
BuildRequires:  pkgconfig(gio-unix-2.0)
BuildRequires:  pkgconfig(gmodule-2.0)
BuildRequires:  pkgconfig(gmodule-export-2.0)
BuildRequires:  pkgconfig(gnutls)
BuildRequires:  pkgconfig(gthread-2.0)
%if %{with qemu_gtk3_22}
BuildRequires:  pkgconfig(gtk+-3.0) >= 3.22.0
BuildRequires:  pkgconfig(gtk+-x11-3.0)
%endif
BuildRequires:  pkgconfig(jack)
BuildRequires:  pkgconfig(libacl)
BuildRequires:  pkgconfig(libcap)
BuildRequires:  pkgconfig(libcap-ng)
BuildRequires:  pkgconfig(libcurl)
%if %{with libnfs}
BuildRequires:  pkgconfig(libnfs)
%endif
BuildRequires:  pkgconfig(libpng)
BuildRequires:  pkgconfig(libpulse)
BuildRequires:  pkgconfig(libssh)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(libusbredirparser-0.5)
BuildRequires:  pkgconfig(liblzma)
BuildRequires:  pkgconfig(ncursesw)
BuildRequires:  pkgconfig(pixman-1)
BuildRequires:  python(abi) > 3.6
%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(xentoolcore)
BuildRequires:  pkgconfig(xkbcommon)
BuildRequires:  pkgconfig(zlib)

%description

%prep
rm -rf %_builddir/%name-%version
mv %_sourcedir/%name-%version %_builddir/%name-%version
%setup -c -T -D
pushd '.'
%patch -P 1523985546 -p1
%patch -P 1680791780 -p1
popd

rm -rf './roms/seabios'
mkdir -vp './roms'
mv -v '%_sourcedir/seabios-%seabios_version' './roms/seabios'
pushd './roms/seabios'
popd

rm -rf './roms/ipxe'
mkdir -vp './roms'
mv -v '%_sourcedir/ipxe-%ipxe_version' './roms/ipxe'
pushd './roms/ipxe'
%patch -P 1484818598 -p1
popd

rm -rf './roms/edk2'
mkdir -vp './roms'
mv -v '%_sourcedir/ovmf-%ovmf_version' './roms/edk2'
pushd './roms/edk2'
%patch -P 1680904274 -p1
%patch -P 1680906047 -p1
%patch -P 1617269159 -p1
%patch -P 1737362431 -p1
popd

rm -rf './roms/edk2/CryptoPkg/Library/OpensslLib/openssl'
mkdir -vp './roms/edk2/CryptoPkg/Library/OpensslLib'
mv -v '%_sourcedir/openssl-%openssl_version' './roms/edk2/CryptoPkg/Library/OpensslLib/openssl'

rm -rf './subprojects/berkeley-softfloat-3'
mkdir -vp './subprojects'
mv -v '%_sourcedir/bsoftfloat3-%bsoftfloat3_version' './subprojects/berkeley-softfloat-3'

rm -rf './subprojects/berkeley-testfloat-3'
mkdir -vp './subprojects'
mv -v '%_sourcedir/btestfloat3-%btestfloat3_version' './subprojects/berkeley-testfloat-3'

rm -rf './subprojects/keycodemapdb'
mkdir -vp './subprojects'
mv -v '%_sourcedir/keycodemapdb-%keycodemapdb_version' './subprojects/keycodemapdb'

find . -path '*/subprojects/packagefiles' | while read
do
  if pushd "${REPLY}" 2>/dev/null
  then
    for prj in *
    do
      if pushd "${prj}" > /dev/null
      then
        for f in *
        do
          test -f "${f}" || continue
          test -d "../../${prj}/" || continue
          ln -vft "../../${prj}/" *
          break
        done
        popd > /dev/null
      fi
    done
    popd > /dev/null
  fi
done

%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 gcc-7)"   && CC=$_
test -x "$(type -P gcc-8)"   && CC=$_
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=$_
test -x "$(type -P g++-7)"   && CXX=$_
test -x "$(type -P g++-8)"   && CXX=$_
#
%ifarch %ix86 x86_64
target_list="
i386-softmmu
x86_64-softmmu
"
%endif
target_list="`echo ${target_list}| xargs`"
test -n "${target_list}"
PYTHON="$(type -P false)"
for i in \
	python3.12 \
	python3.11 \
	python3.10 \
	python3.9 \
	python3.8 \
	python3.7 \
	python3
do
	test -x "$(type -P $i)" || continue
	PYTHON="$(readlink -f $_)"
	break
done
tee .env.sh <<_EOF_
CC="`readlink -f $CC`"
CPP="`readlink -f $CC` -E"
CXX="`readlink -f $CXX`"
_EOF_
. ./.env.sh
find * -type f -exec grep -ElZ "(%_bindir/python$|%_bindir/python3)" '{}' + | sort -z | tr '\0' '\n' | while read
do
	i="${REPLY}"
	sed -i~ "
	s@%_bindir/python[.0-9]*@$PYTHON@
	" "$i"
	diff -u "$i"~ "$i" && : identical "$_"
	touch --reference="$i"~ "$i"
	rm -f "$i"~
done
find * -type f -exec grep -lZ '%_bindir/env python' '{}' + | sort -z | tr '\0' '\n' | while read
do
	i="${REPLY}"
	sed -i~ "
	s@%_bindir/env python[.0-9]*@$PYTHON@
	" "$i"
	diff -u "$i"~ "$i" && : identical "$_"
	touch --reference="$i"~ "$i"
	rm -f "$i"~
done
if \
env \
CPP="${CPP}" \
"CFLAGS=%optflags -I%_includedir/ncursesw" \
"CXXFLAGS=%optflags -I%_includedir/ncursesw" \
bash \
./configure \
	--prefix=%_libdir/%name \
	--localstatedir=%_localstatedir \
	\
	--cc="${CC}" \
	--host-cc="${CC}" \
	--cxx="${CXX}" \
	--target-list="${target_list}" \
	\
	--iasl="$(type -P iasl)" \
	--install="$(type -P install)" \
	--objcc="$(type -P false)" \
	--python="${PYTHON}" \
	--ninja='%_bindir/ninja' \
	--tls-priority=NORMAL \
	\
	\
	--disable-docs \
	--disable-gtk \
	--disable-libnfs \
	--disable-opengl \
	--disable-rbd \
	--disable-spice \
	--disable-virglrenderer \
	--disable-vte \
	\
	\
	--enable-alsa \
	--enable-attr \
	--disable-brlapi \
	--disable-bsd-user \
	--enable-bzip2 \
	--enable-cap-ng \
	--disable-capstone \
	--disable-cocoa \
	--enable-coroutine-pool \
	--disable-crypto-afalg \
	--enable-curl \
	--enable-curses \
	--disable-dbus-display \
	--disable-debug-info \
	--disable-debug-mutex \
	--disable-debug-tcg \
	--with-default-devices \
	--disable-docs \
	--enable-fdt \
	--enable-gcrypt \
	--enable-gettext \
	--disable-glusterfs \
	--enable-gnutls \
%if %{with qemu_gtk3_22}
	--enable-gtk \
%endif
	--disable-guest-agent \
	--disable-guest-agent-msi \
	--disable-hvf \
	--enable-iconv \
	--enable-jack \
	--disable-keyring \
	--enable-kvm \
	--disable-libdaxctl \
	--disable-libdw \
	--disable-libiscsi \
%if %{with libnfs}
	--enable-libnfs \
%endif
	--enable-libssh \
	--enable-libusb \
	--enable-linux-aio \
	--disable-linux-user \
	--enable-live-block-migration \
	--disable-lzo \
	--disable-lzfse \
	--disable-malloc-trim \
	--disable-membarrier \
	--enable-modules \
	--disable-mpath \
	--disable-netmap \
	--disable-nettle \
	--enable-numa \
%if %{with qemu_opengl}
	--enable-opengl \
%endif
	--enable-oss \
	--enable-pie \
	--enable-plugins \
	--enable-png \
	--disable-qom-cast-debug \
%if %{with librbd}
	--enable-rbd \
%endif
	--disable-rdma \
	--enable-replication \
	--enable-rng-none \
	--disable-safe-stack \
	--disable-sanitizers \
	--disable-sdl \
	--disable-sdl-image \
	--disable-seccomp \
	--disable-slirp \
	--disable-smartcard \
	--disable-snappy \
	--disable-sndio \
	--disable-sparse \
%if %{with spice}
	--enable-spice \
%endif
	--enable-stack-protector \
	--disable-strip \
	--enable-system \
	--enable-tcg \
	--disable-tcg-interpreter \
	--enable-tools \
	--enable-tpm \
	--disable-tsan \
	--disable-u2f \
	--enable-usb-redir \
	--disable-user \
	--enable-vde \
	--enable-vhost-crypto \
	--enable-vhost-net \
	--enable-vhost-user \
%if %{with virglrenderer}
	--enable-virglrenderer \
%endif
	--enable-virtfs \
	--enable-vnc \
	--disable-vnc-jpeg \
	--disable-vnc-sasl \
%if %{with qemu_vte}
	--enable-vte \
%endif
	--disable-werror \
	--disable-whpx \
	--enable-xen \
	--enable-xen-pci-passthrough \
	%nil
then
	: success
else
	cat config.log
	exit 1
fi

V=V=1
%make_build ${V}

%ifarch x86_64
%make_build -C roms ${V} "CC=${CC}" "CPP=${CPP}" bios seavgabios pxerom efirom \
	'EDK2_JOBS=%{?_smp_mflags}' \
	"BUILD_CC=${CC}" \
	"BUILD_CXX=${CXX}" \
	"HOST_CC=${CC}" \
	'SEABIOS_EXTRAVERSION=-%_project/%name' \
	"PYTHON=${PYTHON}" \
	%nil
%endif
ls -ld '--time-style=full-iso' 'pc-bios' 'build/config-host.mak'
touch -r 'build/config-host.mak' 'pc-bios'

%install
. ./.env.sh
%make_install
find %buildroot -ls
find %buildroot -name "*.la" -print -delete
pushd %buildroot%_libdir/%name
rm -rfv \
	share/applications \
	share/icons \
	share/locale \
	%nil

	pushd share/qemu
		non_x86=(
		QEMU,cgthree.bin
		QEMU,tcx.bin
		bamboo.dtb
		canyonlands.dtb
		hppa-firmware.img
		npcm7xx_bootrom.bin
		openbios-ppc
		openbios-sparc32
		openbios-sparc64
		opensbi-riscv32-*.bin
		opensbi-riscv64-*.bin
		palcode-clipper
		petalogix-ml605.dtb
		petalogix-s3adsp1800.dtb
		qemu-nsis.bmp
		qemu_vga.ndrv
		s390-ccw.img
		s390-netboot.img
		skiboot.lid
		slof.bin
		u-boot-sam460-20100605.bin
		u-boot.e500
		vof*.bin
		edk2-licenses.txt
		*aarch64*.fd
		*arm*.fd
		firmware/*aarch64*.json
		firmware/*arm*.json
		)
		rm -fv "${non_x86[@]}"
	popd
	pushd %_lib/qemu
		non_x86=(
		hw-s390x-virtio-gpu-ccw.so
		)
		rm -fv "${non_x86[@]}"
	popd
popd
%fdupes %buildroot

%files
%_libdir/%name

%changelog
openSUSE Build Service is sponsored by