commit:     fae2ef851deea7ee791ac044e2b201cdef62bc89
Author:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
AuthorDate: Tue Apr 15 02:07:22 2025 +0000
Commit:     Eli Schwartz <eschwartz <AT> gentoo <DOT> org>
CommitDate: Mon Apr 21 08:28:42 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fae2ef85

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 <eschwartz <AT> gentoo.org>

 app-emulation/qemu/{qemu-9.1.2.ebuild => qemu-9.1.2-r1.ebuild} | 10 +++++++---
 app-emulation/qemu/{qemu-9.1.3.ebuild => qemu-9.1.3-r1.ebuild} | 10 +++++++---
 app-emulation/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(-)

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 c999dbdbb865..56ee61fd2f46 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 132cd093619a..22a0b0889e8e 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 dbf0d977e96c..2d0a48c6f7a5 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 3bca5a4feb43..de7e47d66465 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

Reply via email to