From b8ee3493a54794ca1bbd84d62b4d9f7041fcfddc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 21 Oct 2020 10:04:23 +0200 Subject: [PATCH] meson: convert developer_mode boolean to an enum I initially changed this to add a third state. But even with two values having an explicit name instead of just 0/1 is mode descriptive. --- man/meson.build | 2 +- meson.build | 4 ++-- meson_options.txt | 2 +- src/basic/build.h | 5 +++++ src/basic/missing_capability.h | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/man/meson.build b/man/meson.build index 3c2c7023ed..d056ad0c71 100644 --- a/man/meson.build +++ b/man/meson.build @@ -207,7 +207,7 @@ if dbus_docs.length() > 0 '@INPUT@'], input : dbus_docs) - if conf.get('DEVELOPER_MODE') == 1 + if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER' test('dbus-docs-fresh', update_dbus_docs_py, args : ['--build-dir=@0@'.format(project_build_root), diff --git a/meson.build b/meson.build index 7c2d4e8b10..307d1bd5f7 100644 --- a/meson.build +++ b/meson.build @@ -38,8 +38,8 @@ relative_source_path = run_command('realpath', project_source_root).stdout().strip() conf.set_quoted('RELATIVE_SOURCE_PATH', relative_source_path) -conf.set10('DEVELOPER_MODE', get_option('mode') == 'developer', - description : 'enable additional checks only suitable in development') +conf.set('BUILD_MODE', 'BUILD_MODE_' + get_option('mode').to_upper(), + description : 'tailor build to development or release builds') want_ossfuzz = get_option('oss-fuzz') want_libfuzzer = get_option('llvm-fuzz') diff --git a/meson_options.txt b/meson_options.txt index 59248c7099..2c10054769 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -5,7 +5,7 @@ option('version-tag', type : 'string', description : 'override the git version string') option('mode', type : 'combo', choices : ['developer', 'release'], - description : 'enable additional checks suitable for systemd development') + description : 'autoenable features suitable for systemd development/release builds') option('split-usr', type : 'combo', choices : ['auto', 'true', 'false'], description : '''/bin, /sbin aren't symlinks into /usr''') diff --git a/src/basic/build.h b/src/basic/build.h index d160af5bc7..e02ad391a9 100644 --- a/src/basic/build.h +++ b/src/basic/build.h @@ -161,3 +161,8 @@ _IDN_FEATURE_ " " \ _PCRE2_FEATURE_ " " \ _CGROUP_HIERARCHY_ + +enum { + BUILD_MODE_DEVELOPER, + BUILD_MODE_RELEASE, +}; diff --git a/src/basic/missing_capability.h b/src/basic/missing_capability.h index c52cd44933..4d37618741 100644 --- a/src/basic/missing_capability.h +++ b/src/basic/missing_capability.h @@ -27,7 +27,7 @@ #ifdef CAP_LAST_CAP # if CAP_LAST_CAP > SYSTEMD_CAP_LAST_CAP -# if DEVELOPER_MODE && defined(TEST_CAPABILITY_C) +# if BUILD_MODE == BUILD_MODE_DEVELOPER && defined(TEST_CAPABILITY_C) # warning "The capability list here is outdated" # endif # else