From 6535490c5e27ccff98597fac5ab69091e6771d7b Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Tue, 28 Jan 2025 09:52:02 +0100 Subject: [PATCH] Use meson feature and not combo options --- .github/workflows/ci-opensuse.yml | 2 +- man/meson.build | 5 ++-- meson.build | 41 +++++++++---------------------- meson_options.txt | 17 +++++-------- 4 files changed, 20 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci-opensuse.yml b/.github/workflows/ci-opensuse.yml index ad71419..f79558f 100644 --- a/.github/workflows/ci-opensuse.yml +++ b/.github/workflows/ci-opensuse.yml @@ -13,7 +13,7 @@ jobs: - name: Install devel packages run: | zypper ref - zypper --non-interactive in --no-recommends meson gcc libeconf-devel systemd-devel sqlite3-devel audit-devel docbook-xsl-stylesheets + zypper --non-interactive in --no-recommends meson gcc libeconf-devel systemd-devel sqlite3-devel audit-devel pam-devel docbook-xsl-stylesheets - name: Setup meson run: meson setup build --auto-features=enabled -Db_sanitize=address,undefined diff --git a/man/meson.build b/man/meson.build index 24a9a85..1c95bdc 100644 --- a/man/meson.build +++ b/man/meson.build @@ -1,6 +1,5 @@ -want_man = get_option('man') -xsltproc_exe = find_program('xsltproc', required : want_man == 'true') -want_man = want_man != 'false' and xsltproc_exe.found() +xsltproc_exe = find_program('xsltproc', required : get_option('man')) +want_man = (get_option('man').enabled() or get_option('man').auto()) and xsltproc_exe.found() xsltproc_flags = [ '--nonet', '--xinclude', diff --git a/meson.build b/meson.build index 3ece53e..8a1a87b 100644 --- a/meson.build +++ b/meson.build @@ -94,39 +94,20 @@ tmpfilesdir = prefixdir / 'lib/tmpfiles.d' libpam = cc.find_library('pam') libsqlite3 = cc.find_library('sqlite3') -want_audit = get_option('audit') -if want_audit != 'false' - libaudit = dependency('audit', required : want_audit == 'true') - have_audit = libaudit.found() -else - have_audit = false - libaudit = [] -endif -conf.set10('HAVE_AUDIT', have_audit) +libaudit = dependency('audit', required : get_option('audit')) +conf.set10('HAVE_AUDIT', libaudit.found()) -want_wtmpdbd = get_option('wtmpdbd') -if want_wtmpdbd != 'false' - libsystemd = dependency('libsystemd', version: '>= 257', required : want_wtmpdbd == 'true') - have_systemd257 = libsystemd.found() -else - have_systemd257 = false - libsystemd = [] -endif -conf.set10('WITH_WTMPDBD', have_systemd257) - -want_systemd = get_option('systemd') -if have_systemd257 == false - if want_systemd != 'false' - libsystemd = dependency('libsystemd', required : want_systemd == 'true') - have_systemd = libsystemd.found() - else - have_systemd = false - libsystemd = [] - endif +libsystemd = dependency('libsystemd', version: '>= 257', required : get_option('wtmpdbd')) +conf.set10('WITH_WTMPDBD', libsystemd.found()) + +if libsystemd.found() + have_systemd257 = true else - have_systemd = true +# for soft-reboot older libsystemd with sd_bus is good enough + have_systemd257 = false + libsystemd = dependency('libsystemd', required : get_option('systemd')) endif -conf.set10('HAVE_SYSTEMD', have_systemd) +conf.set10('HAVE_SYSTEMD', libsystemd.found()) libwtmpdb_c = files('lib/libwtmpdb.c', 'lib/logwtmpdb.c', 'lib/sqlite.c', 'lib/varlink.c', 'lib/mkdir_p.c') libwtmpdb_map = 'lib/libwtmpdb.map' diff --git a/meson_options.txt b/meson_options.txt index b16a56b..568e7f4 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,23 +1,18 @@ -option('wtmpdbd', type : 'combo', choices : ['auto', 'true', 'false'], - value : 'auto', +option('wtmpdbd', type : 'feature', value : 'auto', description : 'build daemon with sd-varlink support') option('split-usr', type : 'combo', choices : ['auto', 'true', 'false'], description : '''/bin, /sbin aren't symlinks into /usr''') option('rootprefix', type : 'string', description : '''override the root prefix [default '/' if split-usr and '/usr' otherwise]''') option('rootlibdir', type : 'string', - description : '''[/usr]/lib/x86_64-linux-gnu or such''') + description : '''[/usr]/lib or such''') option('pamlibdir', type : 'string', description : 'directory for PAM modules') -option('man', type : 'combo', choices : ['auto', 'true', 'false'], - value : 'auto', +option('man', type : 'feature', value : 'auto', description : 'build and install man pages') -option('audit', type : 'combo', choices : ['auto', 'true', 'false'], - value : 'auto', +option('audit', type : 'feature', value : 'auto', description : 'libaudit support') -option('systemd', type : 'combo', choices : ['auto', 'true', 'false'], - value : 'auto', +option('systemd', type : 'feature', value : 'auto', description : 'systemd support to detect soft-reboots') -option('compat-symlink', type : 'boolean', - value : false, +option('compat-symlink', type : 'boolean', value : false, description : 'create last compat symlink')