From 9247df5a8852d11b64a6309d994e3d2afe275250 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 27 Jul 2021 16:16:07 +0200 Subject: [PATCH 1/4] meson: require 0.53.2 and drop some workarounds for old meson Ubuntu Bionic 18.04 has 0.45, so it was below the previously required minimum version already. Focal 20.04 has 0.53.2. Let's require that and use various features that are available. --- meson.build | 13 +++++-------- tmpfiles.d/meson.build | 3 +-- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/meson.build b/meson.build index cb023f7f13..84f288c664 100644 --- a/meson.build +++ b/meson.build @@ -10,7 +10,7 @@ project('systemd', 'c', 'localstatedir=/var', 'warning_level=2', ], - meson_version : '>= 0.47', + meson_version : '>= 0.53.2', ) libsystemd_version = '0.32.0' @@ -382,7 +382,7 @@ if cc.get_id() == 'gcc' endif # --as-needed and --no-undefined are provided by meson by default, -# run mesonconf to see what is enabled +# run 'meson configure' to see what is enabled possible_link_flags = [ '-Wl,-z,relro', '-Wl,-z,now', @@ -597,7 +597,7 @@ test_efi_create_disk_sh = find_program('test/test-efi-create-disk.sh') mkdir_p = 'mkdir -p $DESTDIR/@0@' splash_bmp = files('test/splash.bmp') -# if -Dxxx-path option is found, use that. Otherwise, check in $PATH, +# If -Dxxx-path option is found, use that. Otherwise, check in $PATH, # /usr/sbin, /sbin, and fall back to the default from middle column. progs = [['quotaon', '/usr/sbin/quotaon' ], ['quotacheck', '/usr/sbin/quotacheck' ], @@ -909,10 +909,6 @@ conf.set10('LOG_TRACE', get_option('log-trace')) default_user_path = get_option('user-path') if default_user_path != '' conf.set_quoted('DEFAULT_USER_PATH', default_user_path) - default_user_path_display = default_user_path -else - # meson 0.49 fails when ?: is used in .format() - default_user_path_display = '(same as system services)' endif @@ -3817,7 +3813,8 @@ status = [ 'default net.naming-scheme setting: @0@'.format(default_net_naming_scheme), 'default KillUserProcesses setting: @0@'.format(kill_user_processes), 'default locale: @0@'.format(default_locale), - 'default user $PATH: @0@'.format(default_user_path_display), + 'default user $PATH: @0@'.format( + default_user_path != '' ? default_user_path : '(same as system services)'), 'systemd service watchdog: @0@'.format(watchdog_opt)] alt_dns_servers = '\n '.join(dns_servers.split(' ')) diff --git a/tmpfiles.d/meson.build b/tmpfiles.d/meson.build index 6f8ff09fc8..e0e339cd42 100644 --- a/tmpfiles.d/meson.build +++ b/tmpfiles.d/meson.build @@ -37,8 +37,7 @@ foreach pair : in_files # do nothing elif pair[1] == '' or conf.get(pair[1]) == 1 custom_target( - # XXX: workaround for old meson. Drop when upgrading. - 'tmpfiles+' + pair[0], + pair[0], input : pair[0] + '.in', output: pair[0], command : [meson_render_jinja2, config_h, '@INPUT@'], From 81875efe209cd0b4b836eddb0cebef209017b3dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 27 Jul 2021 16:19:35 +0200 Subject: [PATCH 2/4] meson: use project_build_root As documented in /meson.build where the variable is defined, meson.build_root() doesn't work as expected with project nesting. I have no idea why anyone would want to embed systemd in another meson project, but let's use the variable if we have it. --- src/test/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/meson.build b/src/test/meson.build index 14725248ce..07625ad38c 100644 --- a/src/test/meson.build +++ b/src/test/meson.build @@ -15,7 +15,7 @@ path = run_command(sh, '-c', 'echo "$PATH"').stdout().strip() test_env = environment() test_env.set('SYSTEMD_KBD_MODEL_MAP', kbd_model_map) test_env.set('SYSTEMD_LANGUAGE_FALLBACK_MAP', language_fallback_map) -test_env.set('PATH', '@0@:@1@'.format(meson.build_root(), path)) +test_env.set('PATH', project_build_root + ':' + path) ############################################################ From 68e101da7acd2a595487a1df5c37a23e41383161 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 27 Jul 2021 16:20:40 +0200 Subject: [PATCH 3/4] meson: adjust comment about find_program() usage The FIXME was not correct: with 'dirs' we'd put the fixed path first (see the docs for find_program()). --- meson.build | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index 84f288c664..5ba92bdf6f 100644 --- a/meson.build +++ b/meson.build @@ -948,9 +948,11 @@ if want_bpf_framework == 'false' else clang = find_program('clang', required : bpf_framework_required) llvm_strip = find_program('llvm-strip', required : bpf_framework_required) - # Debian installs this in /usr/sbin/ which is not in $PATH - # FIXME: use the 'dirs' parameter once we bump Meson version to >= 0.53 + + # Debian installs this in /usr/sbin/ which is not in $PATH. + # We check for 'bpftool' first, honouring $PATH, and in /usr/sbin/ for Debian. bpftool = find_program('bpftool', '/usr/sbin/bpftool', required : bpf_framework_required) + bpf_arches = ['x86_64'] deps_found = libbpf.found() and clang.found() and llvm_strip.found() and bpftool.found() # Can build BPF program from source code in restricted C From 0b5f1bd49e6fb6009d189b6bb428224cb7127671 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 27 Jul 2021 17:48:53 +0200 Subject: [PATCH 4/4] meson: use maps for udev program paths --- src/udev/meson.build | 38 ++++++++++++++++++-------------------- test/meson.build | 4 +++- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/udev/meson.build b/src/udev/meson.build index 4e80f9bfd7..0527403398 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -115,42 +115,40 @@ libudevd_core = static_library( link_with : udev_link_with, dependencies : [libblkid, libkmod]) -udev_id_progs = [['ata_id/ata_id.c'], - ['cdrom_id/cdrom_id.c'], - ['fido_id/fido_id.c', - 'fido_id/fido_id_desc.c', - 'fido_id/fido_id_desc.h'], - ['scsi_id/scsi_id.c', - 'scsi_id/scsi_id.h', - 'scsi_id/scsi_serial.c', - 'scsi_id/scsi.h'], - ['v4l_id/v4l_id.c'], - ['mtd_probe/mtd_probe.c', - 'mtd_probe/mtd_probe.h', - 'mtd_probe/probe_smartmedia.c']] +udev_progs = [['ata_id/ata_id.c'], + ['cdrom_id/cdrom_id.c'], + ['fido_id/fido_id.c', + 'fido_id/fido_id_desc.c', + 'fido_id/fido_id_desc.h'], + ['scsi_id/scsi_id.c', + 'scsi_id/scsi_id.h', + 'scsi_id/scsi_serial.c', + 'scsi_id/scsi.h'], + ['v4l_id/v4l_id.c'], + ['mtd_probe/mtd_probe.c', + 'mtd_probe/mtd_probe.h', + 'mtd_probe/probe_smartmedia.c']] dmi_arches = ['x86', 'x86_64', 'aarch64', 'arm', 'ia64', 'mips'] if dmi_arches.contains(host_machine.cpu_family()) - udev_id_progs += [['dmi_memory_id/dmi_memory_id.c']] + udev_progs += [['dmi_memory_id/dmi_memory_id.c']] endif -foreach prog : udev_id_progs +udev_prog_paths = {} +foreach prog : udev_progs name = prog[0].split('/')[0] exe = executable( name, prog, include_directories : includes, - dependencies : [versiondep], + dependencies : versiondep, link_with : udev_link_with, install_rpath : udev_rpath, install : true, install_dir : udevlibexecdir) - # TODO: let's use a dictionary instead as soon as we can depend on meson >= 0.47. - if name == 'dmi_memory_id' - dmi_memory_id_path = exe.full_path() - endif + udev_prog_paths += {name : exe.full_path()} endforeach if install_sysconfdir_samples diff --git a/test/meson.build b/test/meson.build index 47c7f4d49a..c39d2ab7ac 100644 --- a/test/meson.build +++ b/test/meson.build @@ -145,7 +145,9 @@ if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family()) test(name, udev_dmi_memory_id_test, - args : [dmi_memory_id_path, source, source + '.txt']) + args : [udev_prog_paths['dmi_memory_id'], + source, + source + '.txt']) endforeach endif