From fae2ef851deea7ee791ac044e2b201cdef62bc89 Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Mon, 14 Apr 2025 22:07:22 -0400 Subject: [PATCH] app-emulation/qemu: avoid automagic deps on gtk+[X,wayland] e.g. the upstream code checks whether GDK_WINDOWING_WAYLAND is defined by the gtk headers, and if so will compile against the wayland symbols it provides. This means that qemu built on a system with gtk+[-wayland] will be compatible with anything, but when built on a system with gtk+[wayland], requires that at runtime. Use a Gentoo-specific macro hack to hide the GTK implementations when we don't want it, alongside new USE flags to control the dependency usage. Signed-off-by: Eli Schwartz --- .../qemu/{qemu-9.1.2.ebuild => qemu-9.1.2-r1.ebuild} | 10 +++++++--- .../qemu/{qemu-9.1.3.ebuild => qemu-9.1.3-r1.ebuild} | 10 +++++++--- .../qemu/{qemu-9.2.3.ebuild => qemu-9.2.3-r1.ebuild} | 10 +++++++--- app-emulation/qemu/qemu-9999.ebuild | 10 +++++++--- 4 files changed, 28 insertions(+), 12 deletions(-) rename app-emulation/qemu/{qemu-9.1.2.ebuild => qemu-9.1.2-r1.ebuild} (98%) rename app-emulation/qemu/{qemu-9.1.3.ebuild => qemu-9.1.3-r1.ebuild} (98%) rename app-emulation/qemu/{qemu-9.2.3.ebuild => qemu-9.2.3-r1.ebuild} (98%) diff --git a/app-emulation/qemu/qemu-9.1.2.ebuild b/app-emulation/qemu/qemu-9.1.2-r1.ebuild similarity index 98% rename from app-emulation/qemu/qemu-9.1.2.ebuild rename to app-emulation/qemu/qemu-9.1.2-r1.ebuild index c999dbdbb8653..56ee61fd2f46b 100644 --- a/app-emulation/qemu/qemu-9.1.2.ebuild +++ b/app-emulation/qemu/qemu-9.1.2-r1.ebuild @@ -18,7 +18,7 @@ PYTHON_REQ_USE="ensurepip(-),ncurses,readline" FIRMWARE_ABI_VERSION="7.2.0" -inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \ +inherit flag-o-matic linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \ pax-utils xdg-utils if [[ ${PV} == *9999* ]]; then @@ -66,7 +66,7 @@ IUSE="accessibility +aio alsa bpf bzip2 capstone +curl debug ${QEMU_DOC_USEFLAG} plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux +slirp smartcard snappy spice ssh static-user systemtap test udev usb - usbredir vde +vhost-net virgl virtfs +vnc vte xattr xdp xen + usbredir vde +vhost-net virgl virtfs +vnc vte wayland X xattr xdp xen zstd" COMMON_TARGETS=" @@ -185,7 +185,7 @@ SOFTMMU_TOOLS_DEPEND=" dev-libs/nettle:=[static-libs(+)] ) gtk? ( - x11-libs/gtk+:3 + x11-libs/gtk+:3[wayland?,X?] vte? ( x11-libs/vte:2.91 ) ) infiniband? ( sys-cluster/rdma-core[static-libs(+)] ) @@ -480,6 +480,10 @@ src_prepare() { tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS export WINDRES=${CHOST}-windres + # defang automagic dependencies + use X || append-cppflags -DGENTOO_GTK_HIDE_X11 + use wayland || append-cppflags -DGENTOO_GTK_HIDE_WAYLAND + # Workaround for bug #938302 if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then cat >> "${S}"/configs/meson/linux.txt <<-EOF || die diff --git a/app-emulation/qemu/qemu-9.1.3.ebuild b/app-emulation/qemu/qemu-9.1.3-r1.ebuild similarity index 98% rename from app-emulation/qemu/qemu-9.1.3.ebuild rename to app-emulation/qemu/qemu-9.1.3-r1.ebuild index 132cd093619a2..22a0b0889e8e0 100644 --- a/app-emulation/qemu/qemu-9.1.3.ebuild +++ b/app-emulation/qemu/qemu-9.1.3-r1.ebuild @@ -18,7 +18,7 @@ PYTHON_REQ_USE="ensurepip(-),ncurses,readline" FIRMWARE_ABI_VERSION="7.2.0" -inherit linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \ +inherit flag-o-matic linux-info toolchain-funcs python-r1 udev fcaps readme.gentoo-r1 \ pax-utils xdg-utils if [[ ${PV} == *9999* ]]; then @@ -66,7 +66,7 @@ IUSE="accessibility +aio alsa bpf bzip2 capstone +curl debug ${QEMU_DOC_USEFLAG} plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux +slirp smartcard snappy spice ssh static-user systemtap test udev usb - usbredir vde +vhost-net virgl virtfs +vnc vte xattr xdp xen + usbredir vde +vhost-net virgl virtfs +vnc vte wayland X xattr xdp xen zstd" COMMON_TARGETS=" @@ -185,7 +185,7 @@ SOFTMMU_TOOLS_DEPEND=" dev-libs/nettle:=[static-libs(+)] ) gtk? ( - x11-libs/gtk+:3 + x11-libs/gtk+:3[wayland?,X?] vte? ( x11-libs/vte:2.91 ) ) infiniband? ( sys-cluster/rdma-core[static-libs(+)] ) @@ -480,6 +480,10 @@ src_prepare() { tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS export WINDRES=${CHOST}-windres + # defang automagic dependencies + use X || append-cppflags -DGENTOO_GTK_HIDE_X11 + use wayland || append-cppflags -DGENTOO_GTK_HIDE_WAYLAND + # Workaround for bug #938302 if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then cat >> "${S}"/configs/meson/linux.txt <<-EOF || die diff --git a/app-emulation/qemu/qemu-9.2.3.ebuild b/app-emulation/qemu/qemu-9.2.3-r1.ebuild similarity index 98% rename from app-emulation/qemu/qemu-9.2.3.ebuild rename to app-emulation/qemu/qemu-9.2.3-r1.ebuild index dbf0d977e96cc..2d0a48c6f7a53 100644 --- a/app-emulation/qemu/qemu-9.2.3.ebuild +++ b/app-emulation/qemu/qemu-9.2.3-r1.ebuild @@ -18,7 +18,7 @@ PYTHON_REQ_USE="ensurepip(-),ncurses,readline" FIRMWARE_ABI_VERSION="7.2.0" -inherit eapi9-ver linux-info toolchain-funcs python-r1 udev fcaps \ +inherit eapi9-ver flag-o-matic linux-info toolchain-funcs python-r1 udev fcaps \ readme.gentoo-r1 pax-utils xdg-utils if [[ ${PV} == *9999* ]]; then @@ -66,7 +66,7 @@ IUSE="accessibility +aio alsa bpf bzip2 capstone +curl debug ${QEMU_DOC_USEFLAG} plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux +slirp smartcard snappy spice ssh static-user systemtap test udev usb - usbredir vde +vhost-net virgl virtfs +vnc vte xattr xdp xen + usbredir vde +vhost-net virgl virtfs +vnc vte wayland X xattr xdp xen zstd" COMMON_TARGETS=" @@ -184,7 +184,7 @@ SOFTMMU_TOOLS_DEPEND=" dev-libs/nettle:=[static-libs(+)] ) gtk? ( - x11-libs/gtk+:3 + x11-libs/gtk+:3[wayland?,X?] vte? ( x11-libs/vte:2.91 ) ) infiniband? ( sys-cluster/rdma-core[static-libs(+)] ) @@ -477,6 +477,10 @@ src_prepare() { tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS export WINDRES=${CHOST}-windres + # defang automagic dependencies + use X || append-flags -DGENTOO_GTK_HIDE_X11 + use wayland || append-flags -DGENTOO_GTK_HIDE_WAYLAND + # Workaround for bug #938302 if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then cat >> "${S}"/configs/meson/linux.txt <<-EOF || die diff --git a/app-emulation/qemu/qemu-9999.ebuild b/app-emulation/qemu/qemu-9999.ebuild index 3bca5a4feb430..de7e47d664655 100644 --- a/app-emulation/qemu/qemu-9999.ebuild +++ b/app-emulation/qemu/qemu-9999.ebuild @@ -18,7 +18,7 @@ PYTHON_REQ_USE="ensurepip(-),ncurses,readline" FIRMWARE_ABI_VERSION="7.2.0" -inherit eapi9-ver linux-info toolchain-funcs python-r1 udev fcaps \ +inherit eapi9-ver flag-o-matic linux-info toolchain-funcs python-r1 udev fcaps \ readme.gentoo-r1 pax-utils xdg-utils if [[ ${PV} == *9999* ]]; then @@ -66,7 +66,7 @@ IUSE="accessibility +aio alsa bpf bzip2 capstone +curl debug ${QEMU_DOC_USEFLAG} plugins +png pulseaudio python rbd sasl +seccomp sdl sdl-image selinux +slirp smartcard snappy spice ssh static-user systemtap test udev usb - usbredir vde +vhost-net virgl virtfs +vnc vte xattr xdp xen + usbredir vde +vhost-net virgl virtfs +vnc vte wayland X xattr xdp xen zstd" COMMON_TARGETS=" @@ -184,7 +184,7 @@ SOFTMMU_TOOLS_DEPEND=" dev-libs/nettle:=[static-libs(+)] ) gtk? ( - x11-libs/gtk+:3 + x11-libs/gtk+:3[wayland?,X?] vte? ( x11-libs/vte:2.91 ) ) infiniband? ( sys-cluster/rdma-core[static-libs(+)] ) @@ -477,6 +477,10 @@ src_prepare() { tc-export AR AS LD NM OBJCOPY PKG_CONFIG RANLIB STRINGS export WINDRES=${CHOST}-windres + # defang automagic dependencies + use X || append-flags -DGENTOO_GTK_HIDE_X11 + use wayland || append-flags -DGENTOO_GTK_HIDE_WAYLAND + # Workaround for bug #938302 if use systemtap && has_version "dev-debug/systemtap[-dtrace-symlink(+)]" ; then cat >> "${S}"/configs/meson/linux.txt <<-EOF || die