From 968c005760b6465306e3499b8a7e3e8c2d67dac1 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Wed, 2 Dec 2020 23:43:43 +0100 Subject: [PATCH] build: use WLR_HAS_* to decide whether suid is required Maybe systemd/elogind is found but wlroots was built without them. Print the warning message depending on the WLR_HAS_* defines instead. While at it, don't print the message if wlroots has been build with libseat. --- meson.build | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/meson.build b/meson.build index 4c58c452..ee2fdaaa 100644 --- a/meson.build +++ b/meson.build @@ -67,19 +67,31 @@ wlroots_proj = subproject( required: false, version: wlroots_version, ) +wlroots_features = { + 'xwayland': false, + 'systemd': false, + 'elogind': false, + 'libseat': false, +} if wlroots_proj.found() wlroots = wlroots_proj.get_variable('wlroots') wlroots_conf = wlroots_proj.get_variable('conf_data') - wlroots_has_xwayland = wlroots_conf.get('WLR_HAS_XWAYLAND') == 1 + foreach name, _ : wlroots_features + has = wlroots_conf.get('WLR_HAS_' + name.to_upper()) == 1 + wlroots_features += { name: has } + endforeach else wlroots = dependency('wlroots', version: wlroots_version) - wlroots_has_xwayland = cc.get_define('WLR_HAS_XWAYLAND', prefix: '#include ', dependencies: wlroots) == '1' + foreach name, _ : wlroots_features + has = cc.get_define('WLR_HAS_' + name.to_upper(), prefix: '#include ', dependencies: wlroots) == '1' + wlroots_features += { name: has } + endforeach endif -if get_option('xwayland').enabled() and not wlroots_has_xwayland +if get_option('xwayland').enabled() and not wlroots_features['xwayland'] error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') endif -have_xwayland = xcb.found() and wlroots_has_xwayland +have_xwayland = xcb.found() and wlroots_features['xwayland'] tray_deps_found = systemd.found() or elogind.found() if get_option('tray').enabled() and not tray_deps_found @@ -285,7 +297,7 @@ summary({ 'man-pages': scdoc.found(), }, bool_yn: true) -if not systemd.found() and not elogind.found() - warning('The sway binary must be setuid when compiled without (e)logind') +if not wlroots_features['systemd'] and not wlroots_features['elogind'] and not wlroots_features['libseat'] + warning('The sway binary must be setuid when compiled without (e)logind or libseat') warning('You must do this manually post-install: chmod a+s /path/to/sway') endif