Skip to content

Commit 80b48e9

Browse files
build: Use Xwayland pkg-config if available (#682)
1 parent 38919a8 commit 80b48e9

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

meson.build

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,9 +381,15 @@ endif
381381

382382
have_xwayland_initfd = false
383383
if have_wayland
384+
xwayland_dep = dependency('xwayland', required: false)
385+
384386
xwayland_path = get_option('xwayland_path')
385387
if xwayland_path == ''
386-
xwayland_path = find_program('Xwayland').path()
388+
if xwayland_dep.found()
389+
xwayland_path = xwayland_dep.get_pkgconfig_variable('xwayland')
390+
else
391+
xwayland_path = find_program('Xwayland').path()
392+
endif
387393
endif
388394
cdata.set_quoted('XWAYLAND_PATH', xwayland_path)
389395

@@ -398,9 +404,15 @@ if have_wayland
398404

399405
# For Xwayland -initfd usage
400406
use_initfd = get_option('xwayland_initfd')
407+
if xwayland_dep.found()
408+
xwayland_supports_initfd = xwayland_dep.get_pkgconfig_variable('have_initfd') == 'true'
409+
else
410+
xwayland_options = run_command(xwayland_path, '-help')
411+
xwayland_supports_initfd = xwayland_options.stderr().contains('-initfd')
412+
endif
413+
401414
if use_initfd.auto()
402-
xwayland_options = run_command([xwayland_path, '-help'], check: true)
403-
have_xwayland_initfd = xwayland_options.stderr().contains('-initfd')
415+
have_xwayland_initfd = xwayland_supports_initfd
404416
else
405417
have_xwayland_initfd = use_initfd.enabled()
406418
endif

0 commit comments

Comments
 (0)