Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for basu #5856

Merged
merged 3 commits into from
Dec 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .builds/archlinux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ tasks:
sudo ninja -C build install
- setup: |
cd sway
meson build -Dauto_features=enabled
meson build -Dauto_features=enabled -Dsd-bus-provider=libsystemd
- build: |
cd sway
ninja -C build
6 changes: 4 additions & 2 deletions include/swaybar/tray/tray.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
#define _SWAYBAR_TRAY_TRAY_H

#include "config.h"
#ifdef HAVE_SYSTEMD
#ifdef HAVE_LIBSYSTEMD
#include <systemd/sd-bus.h>
#elif HAVE_ELOGIND
#elif HAVE_LIBELOGIND
#include <elogind/sd-bus.h>
#elif HAVE_BASU
#include <basu/sd-bus.h>
#endif
#include <cairo.h>
#include <stdint.h>
Expand Down
61 changes: 47 additions & 14 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,6 @@ pixman = dependency('pixman-1')
glesv2 = dependency('glesv2')
libevdev = dependency('libevdev')
libinput = dependency('libinput', version: '>=1.6.0')
systemd = dependency('libsystemd', version: '>=239', required: false)
elogind = dependency('libelogind', version: '>=239', required: false)
xcb = dependency('xcb', required: get_option('xwayland'))
bash_comp = dependency('bash-completion', required: false)
fish_comp = dependency('fish', required: false)
Expand All @@ -67,32 +65,68 @@ 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 <wlr/config.h>', dependencies: wlroots) == '1'
foreach name, _ : wlroots_features
has = cc.get_define('WLR_HAS_' + name.to_upper(), prefix: '#include <wlr/config.h>', 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']

if get_option('sd-bus-provider') == 'auto'
if not get_option('tray').disabled()
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
endif
sdbus = dependency('libsystemd',
required: false,
version: '>=239',
not_found_message: 'libsystemd not found, trying libelogind',
)
if not sdbus.found()
sdbus = dependency('libelogind',
required: false,
version: '>=239',
not_found_message: 'libelogind not found, trying basu',
)
endif
if not sdbus.found()
sdbus = dependency('basu', required: false)
endif
else
sdbus = dependency(get_option('sd-bus-provider'), required: get_option('tray'))
endif

tray_deps_found = systemd.found() or elogind.found()
tray_deps_found = sdbus.found()
if get_option('tray').enabled() and not tray_deps_found
error('Building with -Dtray=enabled, but libsystemd and libelogind have not been not found')
error('Building with -Dtray=enabled, but sd-bus has not been not found')
endif
have_tray = (not get_option('tray').disabled()) and tray_deps_found

conf_data = configuration_data()

conf_data.set10('HAVE_XWAYLAND', have_xwayland)
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
conf_data.set10('HAVE_SYSTEMD', systemd.found())
conf_data.set10('HAVE_ELOGIND', elogind.found())
conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd')
conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind')
conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu')
conf_data.set10('HAVE_TRAY', have_tray)

scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
Expand Down Expand Up @@ -279,13 +313,12 @@ endif
summary({
'xwayland': have_xwayland,
'gdk-pixbuf': gdk_pixbuf.found(),
'systemd': systemd.found(),
'elogind': elogind.found(),
'sd-bus': sdbus.found(),
'tray': have_tray,
'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
1 change: 1 addition & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ option('xwayland', type: 'feature', value: 'auto', description: 'Enable support
option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray')
option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybg')
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
option('sd-bus-provider', type: 'combo', choices: ['auto', 'libsystemd', 'libelogind', 'basu'], value: 'auto', description: 'Provider of the sd-bus library')
6 changes: 1 addition & 5 deletions swaybar/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@ swaybar_deps = [
wayland_cursor
]
if have_tray
if systemd.found()
swaybar_deps += systemd
elif elogind.found()
swaybar_deps += elogind
endif
swaybar_deps += sdbus
endif

executable(
Expand Down