From 83ec5ac48e481b9de512c18e7fc3bf26fc4b010c Mon Sep 17 00:00:00 2001 From: Matt Borgerson Date: Wed, 21 Jan 2026 17:20:14 -0700 Subject: [PATCH] meson: Drop gtk dependency --- debian/control | 1 - meson.build | 12 ++++++------ meson_options.txt | 4 ++-- scripts/meson-buildoptions.sh | 6 +++++- 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/debian/control b/debian/control index a59ccdd208..3f58074a74 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,6 @@ Build-Depends: debhelper (>= 11), python3-yaml, python3-venv, ninja-build, - libgtk-3-dev, libepoxy-dev, libpixman-1-dev, libsdl2-dev, diff --git a/meson.build b/meson.build index f07ae214ef..ff7358258a 100644 --- a/meson.build +++ b/meson.build @@ -2001,14 +2001,14 @@ gtkx11 = not_found vte = not_found have_gtk_clipboard = get_option('gtk_clipboard').enabled() -# xemu: GTK is required in Linux builds for file selection interfaces. In the -# future, this may be relaxed in the future with alternative options. -require_gtk = host_os == 'linux' - -if require_gtk +if get_option('gtk') \ + .disable_auto_if(not have_system) \ + .require(pixman.found(), + error_message: 'cannot enable GTK if pixman is not available') \ + .allowed() gtk = dependency('gtk+-3.0', version: '>=3.22.0', method: 'pkg-config', - required: require_gtk or get_option('gtk')) + required: get_option('gtk')) if gtk.found() gtkx11 = dependency('gtk+-x11-3.0', version: '>=3.22.0', method: 'pkg-config', diff --git a/meson_options.txt b/meson_options.txt index fc7e57c8a7..b1e7b3484d 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -214,8 +214,8 @@ option('opengl', type : 'feature', value : 'enabled', description: 'OpenGL support') option('rdma', type : 'feature', value : 'auto', description: 'Enable RDMA-based migration') -# option('gtk', type : 'feature', value : 'auto', -# description: 'GTK+ user interface') +option('gtk', type : 'feature', value : 'auto', + description: 'GTK+ user interface') option('sdl', type : 'feature', value : 'enabled', description: 'SDL user interface') option('sdl_image', type : 'feature', value : 'auto', diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh index 00500ffcf3..b10b0e1f83 100644 --- a/scripts/meson-buildoptions.sh +++ b/scripts/meson-buildoptions.sh @@ -35,7 +35,8 @@ meson_options_help() { printf "%s\n" ' measure coroutine stack usage' printf "%s\n" ' --enable-debug-tcg TCG debugging' printf "%s\n" ' --enable-fdt[=CHOICE] Whether and how to find the libfdt library' - printf "%s\n" ' (choices: auto/disabled/enabled/internal/system)' + printf "%s\n" ' [disabled] (choices:' + printf "%s\n" ' auto/disabled/enabled/internal/system)' printf "%s\n" ' --enable-fuzzing build fuzzing targets' printf "%s\n" ' --enable-gcov Enable coverage tracking.' printf "%s\n" ' --enable-lto Use link time optimization' @@ -125,6 +126,7 @@ meson_options_help() { printf "%s\n" ' gio use libgio for D-Bus support' printf "%s\n" ' glusterfs Glusterfs block device driver' printf "%s\n" ' gnutls GNUTLS cryptography support' + printf "%s\n" ' gtk GTK+ user interface' printf "%s\n" ' gtk-clipboard clipboard support for the gtk UI (EXPERIMENTAL, MAY HANG)' printf "%s\n" ' guest-agent Build QEMU Guest Agent' printf "%s\n" ' guest-agent-msi Build MSI package for the QEMU Guest Agent' @@ -335,6 +337,8 @@ _meson_option_parse() { --disable-glusterfs) printf "%s" -Dglusterfs=disabled ;; --enable-gnutls) printf "%s" -Dgnutls=enabled ;; --disable-gnutls) printf "%s" -Dgnutls=disabled ;; + --enable-gtk) printf "%s" -Dgtk=enabled ;; + --disable-gtk) printf "%s" -Dgtk=disabled ;; --enable-gtk-clipboard) printf "%s" -Dgtk_clipboard=enabled ;; --disable-gtk-clipboard) printf "%s" -Dgtk_clipboard=disabled ;; --enable-guest-agent) printf "%s" -Dguest_agent=enabled ;;