]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
meson: simplify the BUILD_MODE conditional
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 14 Apr 2021 11:17:22 +0000 (13:17 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 14 Apr 2021 14:19:54 +0000 (16:19 +0200)
Using a enum is all nice and generic, but at this point it seems unlikely that
we'll add further build modes. But having an enum means that we need to include
the header file with the enumeration whenerever the conditional is used. I want
to use the conditional in log.h, which makes it hard to avoid circular imports.

15 files changed:
meson.build
src/analyze/analyze.c
src/basic/build.h
src/basic/missing_capability.h
src/import/curl-util.c
src/journal-remote/journal-upload.c
src/libudev/test-libudev.c
src/stdio-bridge/stdio-bridge.c
src/test/test-cgroup-setup.c
src/test/test-cgroup-util.c
src/test/test-udev.c
src/udev/dmi_memory_id/dmi_memory_id.c
src/udev/scsi_id/scsi_id.c
src/udev/udevadm.h
src/udev/udevd.c

index fa929370bd505849f8fe788d2e71584e5972e3cc..7d9f2d3d4c63da32784de22e9892bc79e2b8e615 100644 (file)
@@ -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.set('BUILD_MODE', 'BUILD_MODE_' + get_option('mode').to_upper(),
-         description : 'tailor build to development or release builds')
+conf.set10('BUILD_MODE_DEVELOPER', get_option('mode') == 'developer',
+           description : 'tailor build to development or release builds')
 
 want_ossfuzz = get_option('oss-fuzz')
 want_libfuzzer = get_option('llvm-fuzz')
@@ -1117,7 +1117,7 @@ else
         libcurl = []
 endif
 conf.set10('HAVE_LIBCURL', have)
-conf.set10('CURL_NO_OLDIES', get_option('mode') == 'developer')
+conf.set10('CURL_NO_OLDIES', conf.get('BUILD_MODE_DEVELOPER') == 1)
 
 want_libidn = get_option('libidn')
 want_libidn2 = get_option('libidn2')
@@ -3640,7 +3640,7 @@ if dbus_docs.length() > 0
                            '@INPUT@'],
                 input : dbus_docs)
 
-        if conf.get('BUILD_MODE') == 'BUILD_MODE_DEVELOPER'
+        if conf.get('BUILD_MODE_DEVELOPER') == 1
                 test('dbus-docs-fresh',
                      update_dbus_docs_py,
                      args : ['--build-dir=@0@'.format(project_build_root),
index 1a38d878a36a0defc0cc2531905f56316a13f116..1ad373185263af47ac99f1861c9b03911fddd759 100644 (file)
@@ -15,7 +15,6 @@
 #include "analyze-condition.h"
 #include "analyze-security.h"
 #include "analyze-verify.h"
-#include "build.h"
 #include "bus-error.h"
 #include "bus-locator.h"
 #include "bus-map-properties.h"
@@ -53,6 +52,7 @@
 #include "unit-name.h"
 #include "util.h"
 #include "verbs.h"
+#include "version.h"
 
 #define SCALE_X (0.1 / 1000.0) /* pixels per us */
 #define SCALE_Y (20.0)
index 3de0d36cc9ff8a98b9baaeb7d80f1cb14a69c0df..87276bf686b426e9b17394ebe0a122982b9907c5 100644 (file)
@@ -4,8 +4,3 @@
 #include "version.h"
 
 extern const char* const systemd_features;
-
-enum {
-        BUILD_MODE_DEVELOPER,
-        BUILD_MODE_RELEASE,
-};
index 4cf31cb839a6ce12980534ab7b6256a570d0609d..5adda554e59aa539e0206024fcb99d24308f02af 100644 (file)
@@ -27,7 +27,7 @@
 
 #ifdef CAP_LAST_CAP
 #  if CAP_LAST_CAP > SYSTEMD_CAP_LAST_CAP
-#    if BUILD_MODE == BUILD_MODE_DEVELOPER && defined(TEST_CAPABILITY_C)
+#    if BUILD_MODE_DEVELOPER && defined(TEST_CAPABILITY_C)
 #      warning "The capability list here is outdated"
 #    endif
 #  else
index e6db8106355c38c7306eaa70e9a3a260997b9195..ed2ac0a654a69c3a832ee15bf34a5e775f63b9c0 100644 (file)
@@ -3,11 +3,11 @@
 #include <fcntl.h>
 
 #include "alloc-util.h"
-#include "build.h"
 #include "curl-util.h"
 #include "fd-util.h"
 #include "locale-util.h"
 #include "string-util.h"
+#include "version.h"
 
 static void curl_glue_check_finished(CurlGlue *g) {
         CURLMsg *msg;
index a8f1f7e5115b4793605d291b34019ad6c9a246eb..d7e45364a6e8a19a4f578729b35ff942c3bad963 100644 (file)
@@ -9,7 +9,6 @@
 #include "sd-daemon.h"
 
 #include "alloc-util.h"
-#include "build.h"
 #include "conf-parser.h"
 #include "daemon-util.h"
 #include "def.h"
@@ -34,6 +33,7 @@
 #include "strv.h"
 #include "tmpfile-util.h"
 #include "util.h"
+#include "version.h"
 
 #define PRIV_KEY_FILE CERTIFICATE_ROOT "/private/journal-upload.pem"
 #define CERT_FILE     CERTIFICATE_ROOT "/certs/journal-upload.pem"
index 12bd0d62994f2daf28b45051c070bbdae4fc3406..a7510567954145197b634246824c32f31a862738 100644 (file)
@@ -6,7 +6,6 @@
 #include <unistd.h>
 
 #include "alloc-util.h"
-#include "build.h"
 #include "fd-util.h"
 #include "libudev-list-internal.h"
 #include "libudev-util.h"
@@ -15,6 +14,7 @@
 #include "stdio-util.h"
 #include "string-util.h"
 #include "tests.h"
+#include "version.h"
 
 static bool arg_monitor = false;
 
index 217bd97ea5e4049acab607b1104b9a4b7ab12d66..b45f7912cbedf90442d818e3e0bb5b15da4a18cb 100644 (file)
@@ -10,7 +10,6 @@
 #include "sd-daemon.h"
 
 #include "alloc-util.h"
-#include "build.h"
 #include "bus-internal.h"
 #include "bus-util.h"
 #include "errno-util.h"
@@ -18,6 +17,7 @@
 #include "log.h"
 #include "main-func.h"
 #include "util.h"
+#include "version.h"
 
 #define DEFAULT_BUS_PATH "unix:path=/run/dbus/system_bus_socket"
 
index 4978a92e4632beb4652cc0eb0ea08ab01aecd8df..37ef66b0fd873b83342a7d325eafd70f3cac0af0 100644 (file)
@@ -3,13 +3,13 @@
 #include <unistd.h>
 
 #include "alloc-util.h"
-#include "build.h"
 #include "cgroup-setup.h"
 #include "errno-util.h"
 #include "log.h"
 #include "proc-cmdline.h"
 #include "string-util.h"
 #include "tests.h"
+#include "version.h"
 
 static void test_is_wanted_print(bool header) {
         _cleanup_free_ char *cmdline = NULL;
index f95832acf61582b1b5234dfcef49444a3f997693..c2adfa07ce02cc6eab869e36e254d014605ca15e 100644 (file)
@@ -1,7 +1,6 @@
 /* SPDX-License-Identifier: LGPL-2.1-or-later */
 
 #include "alloc-util.h"
-#include "build.h"
 #include "cgroup-util.h"
 #include "dirent-util.h"
 #include "errno-util.h"
@@ -17,6 +16,7 @@
 #include "tests.h"
 #include "user-util.h"
 #include "util.h"
+#include "version.h"
 
 static void check_p_d_u(const char *path, int code, const char *result) {
         _cleanup_free_ char *unit = NULL;
index 488b965c822b7663de965de5c197e5df92f079d4..6bb8a9e4fc879477f8d58c0024f595aa591249b1 100644 (file)
@@ -11,7 +11,6 @@
 #include <sys/signalfd.h>
 #include <unistd.h>
 
-#include "build.h"
 #include "device-private.h"
 #include "fs-util.h"
 #include "log.h"
@@ -24,6 +23,7 @@
 #include "string-util.h"
 #include "tests.h"
 #include "udev-event.h"
+#include "version.h"
 
 static int fake_filesystems(void) {
         static const struct fakefs {
index c5bea8c9a8080100bd2f75880cd5e0d62bc44a2a..64eba0d314e34d203920aa8dff5f81672fe6f20c 100644 (file)
 #include <getopt.h>
 
 #include "alloc-util.h"
-#include "build.h"
 #include "fileio.h"
 #include "main-func.h"
 #include "string-util.h"
 #include "udev-util.h"
 #include "unaligned.h"
+#include "version.h"
 
 #define SUPPORTED_SMBIOS_VER 0x030300
 
index d9d897c00cae4517ad2650491c140051b49e3077..41f92b68beaa1b4347c1c0d785d979e10b80fd2a 100644 (file)
@@ -17,7 +17,6 @@
 #include <unistd.h>
 
 #include "alloc-util.h"
-#include "build.h"
 #include "device-nodes.h"
 #include "extract-word.h"
 #include "fd-util.h"
@@ -27,6 +26,7 @@
 #include "strv.h"
 #include "strxcpyx.h"
 #include "udev-util.h"
+#include "version.h"
 
 static const struct option options[] = {
         { "device",             required_argument, NULL, 'd' },
index 162bbb9a43616154ab162a1ce06d57fc3d10383b..75ce633632bf663098aecbf3ca947ebed4dd6bdb 100644 (file)
@@ -3,7 +3,6 @@
 
 #include <stdio.h>
 
-#include "build.h"
 #include "macro.h"
 
 int info_main(int argc, char *argv[], void *userdata);
index 0a44b40a320856505e27d69aaca8236aa412b9fc..2c702d0388d3e33765cc7731aa790c6a82dd47a3 100644 (file)
@@ -28,7 +28,6 @@
 #include "sd-event.h"
 
 #include "alloc-util.h"
-#include "build.h"
 #include "cgroup-util.h"
 #include "cpu-set-util.h"
 #include "dev-setup.h"
@@ -65,6 +64,7 @@
 #include "udev-util.h"
 #include "udev-watch.h"
 #include "user-util.h"
+#include "version.h"
 
 #define WORKER_NUM_MAX 2048U