File qemu-7.2.spec of Package qemu-7.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-7.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 ee4e62749d533455b6847c6155c7c1e12046afda
%define qemu_revision_short ee4e62749d
%define qemu_date_unix 1759910091
%define qemu_date_commit 2025-10-08 10:54:51 +0300

%define seabios_revision_full 3208b098f51a9ef96d0dfa71d5ec3a3eaec88f0a
%define seabios_revision_short 3208b098
%define seabios_date_unix 1669192134
%define seabios_date_commit 2022-11-23 09:28:54 +0100

%define ipxe_revision_full 0336e2987c3e671298af8c2817ec17aa67e98065
%define ipxe_revision_short 0336e298
%define ipxe_date_unix 1761654426
%define ipxe_date_commit 2025-10-28 12:27:06 +0000

%define keycodemapdb_revision_full d21009b1c9f94b740ea66be8e48a1d8ad8124023
%define keycodemapdb_revision_short d21009b
%define keycodemapdb_date_unix 1624871780
%define keycodemapdb_date_commit 2021-06-28 09:16:20 +0000

%define btestfloat3_revision_full 5a59dcec19327396a011a17fd924aed4fec416b3
%define btestfloat3_revision_short 5a59dce
%define btestfloat3_date_unix 1547748698
%define btestfloat3_date_commit 2019-01-17 13:11:38 -0500

%define ovmf_revision_full b24306f15daa2ff8510b06702114724b33895d3c
%define ovmf_revision_short b24306f15d
%define ovmf_date_unix 1645456780
%define ovmf_date_commit 2022-02-21 15:19:40 +0000

Patch1603198935: qemu.ec87b5daca761039bbcf781eedbe4987f790836f.patch
Patch1626679059: qemu.GCRYPT_VERSION_NUMBER.patch
Patch1641636465: qemu.gnutls.patch
Patch1641636664: qemu.glib.patch
Patch1657698978: qemu.libpng.patch
Patch1710931424: qemu.ui-dbus.patch
%if %suse_version > 1110
BuildRequires: python(abi) > 3.0
%endif
Patch1683105390: seabios.be7e899350caa7b74d8271a34264c3b4aef25ab0.patch
%define seabios_version 3208b098f51a9ef96d0dfa71d5ec3a3eaec88f0a
Patch1484818598: ipxe.stable-build-id.patch
%define ipxe_version 0336e2987c3e671298af8c2817ec17aa67e98065
%define sgabios_version cbaee52287e5f32373181cff50a00b6c4ac9015a
%define keycodemapdb_version d21009b1c9f94b740ea66be8e48a1d8ad8124023
%define btestfloat3_version 5a59dcec19327396a011a17fd924aed4fec416b3
%define bsoftfloat3_version b64af41c3276f97f0e181920400ee056b9c88037
Patch1648123474: ovmf.7b005f344e533cd913c3ca05b266f9872df886d1.patch
Patch1648123475: ovmf.85021f8cf22d1bd4114803c6c610dea5ef0059f1.patch
Patch1737362431: ovmf.e063f8b8a53861043b9872cc35b08a3dc03b0942.patch
Patch1680906047: ovmf.BUILD_CFLAGS.patch
Patch1617269159: ovmf.Disable-brotli.patch
%define ovmf_version b24306f15daa2ff8510b06702114724b33895d3c
%define openssl_version 52c587d60be67c337364b830dd3fdc15404a2f04
%define meson_version 3a9b285a55b91b53b2acda987192274352ecb5be
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:  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(libxml-2.0)
BuildRequires:  pkgconfig(ncursesw)
BuildRequires:  pkgconfig(pixman-1)
BuildRequires:  python(abi) >= 3.5
%if %{with spice}
BuildRequires:  pkgconfig(spice-protocol)
BuildRequires:  pkgconfig(spice-server)
%endif
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)
BuildRequires:  xfsprogs-devel

%description

%prep
rm -rf %_builddir/%name-%version
mv %_sourcedir/%name-%version %_builddir/%name-%version
%setup -c -T -D
pushd '.'
%patch -P 1603198935 -p1
%patch -P 1626679059 -p1
%patch -P 1641636465 -p1
%patch -P 1641636664 -p1
%patch -P 1657698978 -p1
%patch -P 1710931424 -p1
popd

rm -rf './roms/seabios'
mkdir -vp './roms'
mv -v '%_sourcedir/seabios-%seabios_version' './roms/seabios'
pushd './roms/seabios'
%patch -P 1683105390 -p1
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/sgabios'
mkdir -vp './roms'
mv -v '%_sourcedir/sgabios-%sgabios_version' './roms/sgabios'

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

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

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

rm -rf './roms/edk2'
mkdir -vp './roms'
mv -v '%_sourcedir/ovmf-%ovmf_version' './roms/edk2'
pushd './roms/edk2'
%patch -P 1648123474 -p1
%patch -P 1648123475 -p1
%patch -P 1737362431 -p1
%patch -P 1680906047 -p1
%patch -P 1617269159 -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 './meson'
mkdir -vp '.'
mv -v '%_sourcedir/meson-%meson_version' './meson'

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.7 \
	python3.6 \
	python3.5 \
	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" && exit 1
	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" && exit 1
	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 \
	--with-git="$(type -P false)" \
	\
	\
	--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-debug-info \
	--disable-debug-mutex \
	--disable-debug-tcg \
	--with-default-devices \
	--disable-docs \
	--enable-fdt \
	--enable-gcrypt \
	--enable-gettext \
	--with-git-submodules=ignore \
	--disable-glusterfs \
	--enable-gnutls \
%if %{with qemu_gtk3_22}
	--enable-gtk \
%endif
	--disable-guest-agent \
	--disable-guest-agent-msi \
	--disable-hax \
	--disable-hvf \
	--enable-iconv \
	--enable-jack \
	--disable-keyring \
	--enable-kvm \
	--disable-libdaxctl \
	--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 \
	--disable-virtiofsd \
	--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
nopie='-fno-pie'
make -C roms ${V} "CC=${CC}" "CPP=${CPP}" sgabios \
	'BUILD_DATE=\"date\"' \
	'BUILD_SHORT_DATE=\"short_date\"' \
	'BUILD_HOST=\"host\"' \
	'BUILD_USER=\"user\"' \
	%nil
%make_build -C roms ${V} "CC=${CC}" "CPP=${CPP}" bios seavgabios pxerom efirom \
	"EDK2_BASETOOLS_OPTFLAGS=${nopie}" \
	"EDK2_BASETOOLS_LDFLAGS=${nopie}" \
	"EDK2_PYTHON_COMMAND=${PYTHON}" \
	"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