From 30cd24f356b3b25ec3c970ade3c463f4c5f549ec Mon Sep 17 00:00:00 2001 From: Otto Moerbeek Date: Fri, 14 Mar 2025 13:06:34 +0100 Subject: [PATCH] Also take into accounts dnsdist docker and package build scripts --- Dockerfile-dnsdist | 2 +- .../debian/dnsdist/debian-bookworm/rules | 4 +- .../debian/dnsdist/debian-bullseye/rules | 4 +- meson.build | 2 +- meson/libsystemd/meson.build | 11 ++- meson/systemd/meson.build | 99 ++++++++++--------- pdns/dnsdistdist/meson.build | 2 +- pdns/recursordist/meson.build | 2 +- tasks.py | 4 +- 9 files changed, 71 insertions(+), 59 deletions(-) diff --git a/Dockerfile-dnsdist b/Dockerfile-dnsdist index fe146dfdf6..f3471dddfc 100644 --- a/Dockerfile-dnsdist +++ b/Dockerfile-dnsdist @@ -79,7 +79,7 @@ RUN mkdir /build && \ -Dlibsodium=enabled \ -Dquiche=enabled \ -Dre2=enabled \ - -Dsystemd=disabled \ + -Dsystemd-service=disabled \ -Dxsk=enabled && \ meson compile -C ${BUILDDIR} && \ meson install -C ${BUILDDIR} --destdir /build && \ diff --git a/builder-support/debian/dnsdist/debian-bookworm/rules b/builder-support/debian/dnsdist/debian-bookworm/rules index f375b221a8..ee60781ecf 100755 --- a/builder-support/debian/dnsdist/debian-bookworm/rules +++ b/builder-support/debian/dnsdist/debian-bookworm/rules @@ -10,10 +10,10 @@ include /usr/share/dpkg/default.mk # Only enable systemd integration on Linux operating systems ifeq ($(DEB_HOST_ARCH_OS),linux) -MESON_ARGS += -Dsystemd=enabled +MESON_ARGS += -Dsystemd-service=enabled DH_ARGS += --with systemd else -MESON_ARGS += -Dsystemd=disabled +MESON_ARGS += -Dsystemd-service=disabled endif # Only enable BPF/XDP on Linux operating systems diff --git a/builder-support/debian/dnsdist/debian-bullseye/rules b/builder-support/debian/dnsdist/debian-bullseye/rules index 9d108fd3a5..81b9bf7c95 100755 --- a/builder-support/debian/dnsdist/debian-bullseye/rules +++ b/builder-support/debian/dnsdist/debian-bullseye/rules @@ -10,10 +10,10 @@ include /usr/share/dpkg/default.mk # Only enable systemd integration on Linux operating systems ifeq ($(DEB_HOST_ARCH_OS),linux) -MESON_ARGS += -Dsystemd=enabled +MESON_ARGS += -Dsystemd-service=enabled DH_ARGS += --with systemd else -MESON_ARGS += -Dsystemd=disabled +MESON_ARGS += -Dsystemd-service=disabled endif # Only disable luajit on arm64 diff --git a/meson.build b/meson.build index 1441300e43..5011d87048 100644 --- a/meson.build +++ b/meson.build @@ -157,7 +157,7 @@ deps = [ dep_boost_test, ] -if dep_libsystemd.found() +if dep_systemd_prog.found() systemd_service_conf = configuration_data() systemd_service_conf.set('BinDir', get_option('prefix') / get_option('bindir')) systemd_service_conf.set('StaticBinDir', get_option('prefix') / get_option('sbindir')) diff --git a/meson/libsystemd/meson.build b/meson/libsystemd/meson.build index 47b4474873..416c4f1b58 100644 --- a/meson/libsystemd/meson.build +++ b/meson/libsystemd/meson.build @@ -1,9 +1,14 @@ opt_systemd = get_option('systemd-service') -dep_libsystemd = dependency('libsystemd', required: opt_systemd) -conf.set('HAVE_SYSTEMD', dep_libsystemd.found(), description: 'libsystemd') -summary('libsystemd', dep_libsystemd.found(), bool_yn: true, section: 'Configuration') +dep_libsystemd = dependency('', required: false) + +if opt_systemd.allowed() + dep_libsystemd = dependency('libsystemd', required: opt_systemd) +endif +conf.set('HAVE_SYSTEMD', dep_libsystemd.found(), description: 'libsystemd') if dep_libsystemd.found() summary('Lib Version', dep_libsystemd.version(), section: 'Systemd') endif + +summary('libsystemd', dep_libsystemd.found(), bool_yn: true, section: 'Configuration') diff --git a/meson/systemd/meson.build b/meson/systemd/meson.build index ca97f334b5..fe8a594d98 100644 --- a/meson/systemd/meson.build +++ b/meson/systemd/meson.build @@ -1,52 +1,59 @@ opt_systemd = get_option('systemd-service') -dep_systemd_prog = dependency('systemd', required: opt_systemd) -summary('Systemd', dep_systemd_prog.found(), bool_yn: true, section: 'Configuration') - -# Map systemd features to systemd/systemctl version. -systemd_features = { - 'private_tmp': 183, - 'system_call_architectures': 209, - 'private_devices': 209, - 'restrict_address_families': 211, - 'protect_system': 214, - 'protect_home': 214, - 'restrict_realtime': 231, - 'memory_deny_write_execute': 231, - 'protect_control_groups': 232, - 'protect_kernel_modules': 232, - 'protect_kernel_tunables': 232, - 'remove_ipc': 232, - 'dynamic_user': 232, - 'private_users': 232, - 'protect_system_strict': 232, - 'restrict_namespaces': 233, - 'lock_personality': 235, - # while SystemCallFilter is technically available starting with 187, - # we use the pre-defined call filter sets that have been introduced later. - # Initial support for these landed in 231 - # @filesystem @reboot @swap in 233 - # @aio, @sync, @chown, @setuid, @memlock, @signal and @timer in 235 - 'system_call_filter': 235, - 'percent_t': 236, - 'private_mounts': 239, - 'with_runtime_dir_env': 240, - 'protect_hostname': 242, - 'restrict_suidsgid': 242, - 'protect_kernel_logs': 244, - 'protect_clock': 245, - 'protect_proc': 247, - 'private_ipc': 248, -} +dep_systemd_prog = dependency('', required: false) -systemd_version = dep_systemd_prog.version() -foreach feature, version: systemd_features - feature_name = 'have_systemd_' + feature - feature_value = systemd_version.version_compare('>=' + version.to_string()) - set_variable(feature_name, feature_value) - conf.set(feature_name.to_upper(), feature_value, description: 'systemd feature: ' + feature) -endforeach +if opt_systemd.allowed() + dep_systemd_prog = dependency('systemd', required: opt_systemd) +endif if dep_systemd_prog.found() - summary('Version', dep_systemd_prog.version(), section: 'Systemd') + # Map systemd features to systemd/systemctl version. + systemd_features = { + 'private_tmp': 183, + 'system_call_architectures': 209, + 'private_devices': 209, + 'restrict_address_families': 211, + 'protect_system': 214, + 'protect_home': 214, + 'restrict_realtime': 231, + 'memory_deny_write_execute': 231, + 'protect_control_groups': 232, + 'protect_kernel_modules': 232, + 'protect_kernel_tunables': 232, + 'remove_ipc': 232, + 'dynamic_user': 232, + 'private_users': 232, + 'protect_system_strict': 232, + 'restrict_namespaces': 233, + 'lock_personality': 235, + # while SystemCallFilter is technically available starting with 187, + # we use the pre-defined call filter sets that have been introduced later. + # Initial support for these landed in 231 + # @filesystem @reboot @swap in 233 + # @aio, @sync, @chown, @setuid, @memlock, @signal and @timer in 235 + 'system_call_filter': 235, + 'percent_t': 236, + 'private_mounts': 239, + 'with_runtime_dir_env': 240, + 'protect_hostname': 242, + 'restrict_suidsgid': 242, + 'protect_kernel_logs': 244, + 'protect_clock': 245, + 'protect_proc': 247, + 'private_ipc': 248, + } + + systemd_version = dep_systemd_prog.version() + foreach feature, version: systemd_features + feature_name = 'have_systemd_' + feature + feature_value = systemd_version.version_compare('>=' + version.to_string()) + set_variable(feature_name, feature_value) + conf.set(feature_name.to_upper(), feature_value, description: 'systemd feature: ' + feature) + endforeach + + if dep_systemd_prog.found() + summary('Version', dep_systemd_prog.version(), section: 'Systemd') + endif endif + +summary('Systemd', dep_systemd_prog.found(), bool_yn: true, section: 'Configuration') diff --git a/pdns/dnsdistdist/meson.build b/pdns/dnsdistdist/meson.build index bb3a0c14f5..039486d2fc 100644 --- a/pdns/dnsdistdist/meson.build +++ b/pdns/dnsdistdist/meson.build @@ -607,7 +607,7 @@ if get_option('man-pages') and python.found() endif endif -if dep_libsystemd.found() +if dep_systemd_prog.found() systemd_system_unit_dir = dep_systemd_prog.get_variable( 'systemdsystemunitdir', diff --git a/pdns/recursordist/meson.build b/pdns/recursordist/meson.build index e73272f2ea..f1d42b29e1 100644 --- a/pdns/recursordist/meson.build +++ b/pdns/recursordist/meson.build @@ -633,7 +633,7 @@ if python.found() endif endif -if dep_libsystemd.found() +if dep_systemd_prog.found() systemd_system_unit_dir = dep_systemd_prog.get_variable( 'systemdsystemunitdir', ) diff --git a/tasks.py b/tasks.py index 8323439ebd..e9de549026 100644 --- a/tasks.py +++ b/tasks.py @@ -490,7 +490,7 @@ def get_base_configure_cmd_meson(build_dir, additional_c_flags='', additional_cx ]) return " ".join([ f'{env} meson setup {build_dir}', - "-D systemd={}".format("enabled" if enable_systemd else "disabled"), + "-D systemd-service={}".format("enabled" if enable_systemd else "disabled"), "-D signers-libsodium={}".format("enabled" if enable_sodium else "disabled"), "-D hardening-fortify-source=auto", "-D auto-var-init=pattern", @@ -602,7 +602,7 @@ def ci_rec_configure_meson(c, features, build_dir): "-D dns-over-tls=false", "-D dnstap=disabled", "-D nod=false", - "-D system-service=disabled", + "-D systemd-service=disabled", "-D lua=luajit", "-D libcap=disabled", "-D libcurl=disabled", -- 2.47.2