~kennylevinsen/seatd-devel

build: remove redundant backend choice v1 NEEDS REVISION

ayaka
ayaka: 1
 build: remove redundant backend choice

 2 files changed, 23 insertions(+), 22 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~kennylevinsen/seatd-devel/patches/22140/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] build: remove redundant backend choice Export this patch

ayaka
This library could support a various of backends.
---
 meson.build       | 39 +++++++++++++++++++++------------------
 meson_options.txt |  6 ++----
 2 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/meson.build b/meson.build
index 7a70cb6..02aafda 100644
--- a/meson.build
+++ b/meson.build
@@ -102,31 +102,35 @@ server_files = [
	'seatd/server.c',
]

with_seatd = get_option('seatd') == 'enabled'
with_builtin = get_option('builtin') == 'enabled'
with_server = get_option('server') == 'enabled'
backends = get_option('backends')

if with_seatd
with_seatd = 'seatd' in backends
with_builtin = 'standalone' in backends

if with_seatd or with_builtin
	private_files += 'libseat/backend/seatd.c'
endif

if with_seatd
	add_project_arguments('-DSEATD_ENABLED=1', language: 'c')
endif

logind = disabler()
logind_provider = ''
if get_option('logind') != 'disabled'
	if get_option('logind') == 'auto' and get_option('auto_features').disabled()
if 'elogind' in backends or 'systemd' in backends or 'auto' in backends
	if 'auto' in backends and get_option('auto_features').disabled()
		# Disable logind
	elif get_option('logind') == 'auto'
		assert(get_option('auto_features').auto(), '-Dlogind must be set to systemd or elogind since auto_features != auto')
		assert(get_option('auto_features').auto(), '-Dbackends must contain systemd or elogind since auto_features != auto')
	else
		foreach logind_provider : ['elogind', 'systemd']
			logind = dependency('lib@0@'.format(logind_provider), required: false)
			if logind.found()
				break
			endif
		  if logind_provider in backends or 'auto' in  backends
		    logind = dependency('lib@0@'.format(logind_provider),
		                         required: not ('auto' in backends))
		    if logind.found()
			break
		    endif
		  endif
		endforeach
	else
		logind_provider = get_option('logind')
		logind = dependency('lib@0@'.format(logind_provider))
	endif

	if logind.found()
@@ -189,7 +193,7 @@ libseat = declare_dependency(
	variables: libseat_vars,
)

if with_server
if with_seatd
	executable(
		'seatd',
		[ server_files, 'seatd/seatd.c' ],
@@ -221,7 +225,7 @@ foreach name, value : tests
		include_directories: [include_directories('.', 'include')]))
endforeach

if with_server
if with_seatd
	scdoc = dependency('scdoc', required: get_option('man-pages'), version: '>= 1.9.7', native: true)
else
	scdoc = disabler()
@@ -252,7 +256,6 @@ endif
summary({
	'seatd': with_seatd,
	'builtin': with_builtin,
	'server': with_server,
	'systemd': logind.found() and logind_provider == 'systemd',
	'elogind': logind.found() and logind_provider == 'elogind',
}, bool_yn: true)
diff --git a/meson_options.txt b/meson_options.txt
index 144ce7a..4a14c23 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -1,7 +1,5 @@
option('logind', type: 'combo', choices: ['auto', 'disabled', 'elogind', 'systemd'], value: 'auto', description: 'logind support')
option('seatd', type: 'combo', choices: ['enabled', 'disabled'], value: 'enabled', description: 'seatd support')
option('builtin', type: 'combo', choices: ['enabled', 'disabled'], value: 'disabled', description: 'builtin seatd server')
option('server', type: 'combo', choices: ['enabled', 'disabled'], value: 'enabled', description: 'seatd server')
option('backends', type: 'array', choices: ['standalone', 'seatd', 'auto', 'elogind', 'systemd'],
       value: ['standalone', 'seatd', 'auto'], description: 'The backends that libseat supports')
option('examples', type: 'combo', choices: ['enabled', 'disabled'], value: 'disabled', description: 'libseat example programs')
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
option('defaultpath', type: 'string', value: '', description: 'Default location for seatd socket (empty for default)')
-- 
2.30.2