1
0
mirror of https://github.com/systemd/systemd.git synced 2025-01-09 01:18:19 +03:00

meson: simplify the BUILD_MODE conditional

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2021-04-14 13:17:22 +02:00
parent 5600a26114
commit 47350c5fb6
15 changed files with 16 additions and 22 deletions

View 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),

View 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)

View File

@ -4,8 +4,3 @@
#include "version.h"
extern const char* const systemd_features;
enum {
BUILD_MODE_DEVELOPER,
BUILD_MODE_RELEASE,
};

View 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

View 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;

View 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"

View 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;

View 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"

View 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;

View 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;

View 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 {

View File

@ -45,12 +45,12 @@
#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

View 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' },

View File

@ -3,7 +3,6 @@
#include <stdio.h>
#include "build.h"
#include "macro.h"
int info_main(int argc, char *argv[], void *userdata);

View 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