aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Simon Ser <contact@emersion.fr>2020-12-02 23:43:43 +0100
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2020-12-09 17:39:20 -0500
commit968c005760b6465306e3499b8a7e3e8c2d67dac1 (patch)
tree60be20597b7a052167e6dbcbff107f8cbd98f6c4
parentHandle secondary headless backend failures (diff)
downloadsway-968c005760b6465306e3499b8a7e3e8c2d67dac1.tar.gz
sway-968c005760b6465306e3499b8a7e3e8c2d67dac1.tar.zst
sway-968c005760b6465306e3499b8a7e3e8c2d67dac1.zip
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.
-rw-r--r--meson.build24
1 files 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(
67 required: false, 67 required: false,
68 version: wlroots_version, 68 version: wlroots_version,
69) 69)
70wlroots_features = {
71 'xwayland': false,
72 'systemd': false,
73 'elogind': false,
74 'libseat': false,
75}
70if wlroots_proj.found() 76if wlroots_proj.found()
71 wlroots = wlroots_proj.get_variable('wlroots') 77 wlroots = wlroots_proj.get_variable('wlroots')
72 wlroots_conf = wlroots_proj.get_variable('conf_data') 78 wlroots_conf = wlroots_proj.get_variable('conf_data')
73 wlroots_has_xwayland = wlroots_conf.get('WLR_HAS_XWAYLAND') == 1 79 foreach name, _ : wlroots_features
80 has = wlroots_conf.get('WLR_HAS_' + name.to_upper()) == 1
81 wlroots_features += { name: has }
82 endforeach
74else 83else
75 wlroots = dependency('wlroots', version: wlroots_version) 84 wlroots = dependency('wlroots', version: wlroots_version)
76 wlroots_has_xwayland = cc.get_define('WLR_HAS_XWAYLAND', prefix: '#include <wlr/config.h>', dependencies: wlroots) == '1' 85 foreach name, _ : wlroots_features
86 has = cc.get_define('WLR_HAS_' + name.to_upper(), prefix: '#include <wlr/config.h>', dependencies: wlroots) == '1'
87 wlroots_features += { name: has }
88 endforeach
77endif 89endif
78 90
79if get_option('xwayland').enabled() and not wlroots_has_xwayland 91if get_option('xwayland').enabled() and not wlroots_features['xwayland']
80 error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support') 92 error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
81endif 93endif
82have_xwayland = xcb.found() and wlroots_has_xwayland 94have_xwayland = xcb.found() and wlroots_features['xwayland']
83 95
84tray_deps_found = systemd.found() or elogind.found() 96tray_deps_found = systemd.found() or elogind.found()
85if get_option('tray').enabled() and not tray_deps_found 97if get_option('tray').enabled() and not tray_deps_found
@@ -285,7 +297,7 @@ summary({
285 'man-pages': scdoc.found(), 297 'man-pages': scdoc.found(),
286}, bool_yn: true) 298}, bool_yn: true)
287 299
288if not systemd.found() and not elogind.found() 300if not wlroots_features['systemd'] and not wlroots_features['elogind'] and not wlroots_features['libseat']
289 warning('The sway binary must be setuid when compiled without (e)logind') 301 warning('The sway binary must be setuid when compiled without (e)logind or libseat')
290 warning('You must do this manually post-install: chmod a+s /path/to/sway') 302 warning('You must do this manually post-install: chmod a+s /path/to/sway')
291endif 303endif