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@gentoo.org>
This commit is contained in:
Eli Schwartz
2025-04-14 22:07:22 -04:00
parent 2b9e1743a4
commit fae2ef851d
4 changed files with 28 additions and 12 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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

View File

@@ -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