~kennylevinsen/poweralertd

5980677e86678da9d10294181b9d1be7e4836239 — Kenny Levinsen 21 days ago 647e1b2
Support basu as sd-bus impl
2 files changed, 21 insertions(+), 10 deletions(-)

M dbus.h
M meson.build
M dbus.h => dbus.h +6 -4
@@ 1,10 1,12 @@
#ifndef _DBUS_H
#define _DBUS_H

#ifdef HAVE_SYSTEMD
#include <systemd/sd-bus.h>
#elif HAVE_ELOGIND
#if defined(HAVE_BASU)
#include <basu/sd-bus.h>
#elif defined(HAVE_ELOGIND)
#include <elogind/sd-bus.h>
#elif defined(HAVE_SYSTEMD)
#include <systemd/sd-bus.h>
#endif

#endif
\ No newline at end of file
#endif

M meson.build => meson.build +15 -6
@@ 16,9 16,19 @@ add_project_arguments('-Wno-missing-braces', language: 'c')
configuration = configuration_data()
configuration.set('bindir', join_paths(get_option('prefix'), get_option('bindir')))

logind = dependency('libsystemd', required: false)
if logind.found()
basu = dependency('libbasu', required: false)
elogind = dependency('libelogind', required: false)
systemd = dependency('libsystemd', required: false)

if basu.found()
	add_project_arguments('-DHAVE_BASU=1', language: 'c')
	sdbus = basu
elif elogind.found()
	add_project_arguments('-DHAVE_ELOGIND=1', language: 'c')
	sdbus = elogind
elif systemd.found()
	add_project_arguments('-DHAVE_SYSTEMD=1', language: 'c')
	sdbus = systemd

	systemd = dependency('systemd', required: true)
	systemd_units_dir = systemd.get_pkgconfig_variable('systemduserunitdir')


@@ 29,14 39,13 @@ if logind.found()
		install_dir: systemd_units_dir
	)
else
	logind = dependency('libelogind')
	add_project_arguments('-DHAVE_ELOGIND=1', language: 'c')
	dependency('basu')
endif

executable(
	'poweralertd',
	['main.c', 'upower.c', 'notify.c', 'list.c'],
	dependencies: [logind],
	dependencies: [sdbus],
	install: true,
)



@@ 65,4 74,4 @@ if scdoc.found()
			install_dir: '@0@/man@1@'.format(mandir, section)
		)
	endforeach
endif
\ No newline at end of file
endif