diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:40 +0000 |
commit | fc53809803cd2bc2434e312b19a18fa36776da12 (patch) | |
tree | b4b43bd6538f51965ce32856e9c053d0f90919c8 /meson.build | |
parent | Adding upstream version 255.5. (diff) | |
download | systemd-fc53809803cd2bc2434e312b19a18fa36776da12.tar.xz systemd-fc53809803cd2bc2434e312b19a18fa36776da12.zip |
Adding upstream version 256.upstream/256
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 395 |
1 files changed, 315 insertions, 80 deletions
diff --git a/meson.build b/meson.build index 554765b..ea4e12a 100644 --- a/meson.build +++ b/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1-or-later project('systemd', 'c', - version : '255', + version : files('meson.version'), license : 'LGPLv2+', default_options: [ 'c_std=gnu11', @@ -13,13 +13,14 @@ project('systemd', 'c', meson_version : '>= 0.60.0', ) -libsystemd_version = '0.38.0' -libudev_version = '1.7.8' +libsystemd_version = '0.39.0' +libudev_version = '1.7.9' conf = configuration_data() conf.set_quoted('PROJECT_URL', 'https://systemd.io/') -conf.set('PROJECT_VERSION', meson.project_version(), +conf.set('PROJECT_VERSION', meson.project_version().split('~')[0], description : 'Numerical project version (used where a simple number is expected)') +conf.set_quoted('PROJECT_VERSION_FULL', meson.project_version(), description : 'Full project version') # This is to be used instead of meson.source_root(), as the latter will return # the wrong result when systemd is being built as a meson subproject @@ -65,9 +66,9 @@ summary({'build mode' : get_option('mode')}) ##################################################################### # Try to install the git pre-commit hook -add_git_hook_sh = find_program('tools/add-git-hook.sh', required : false) -if add_git_hook_sh.found() - git_hook = run_command(add_git_hook_sh, check : false) +git_setup_sh = find_program('tools/git-setup.sh', required : false) +if git_setup_sh.found() + git_hook = run_command(git_setup_sh, check : false) if git_hook.returncode() == 0 message(git_hook.stdout().strip()) endif @@ -176,6 +177,7 @@ repartdefinitionsdir = libexecdir / 'repart/definitions' ntpservicelistdir = prefixdir / 'lib/systemd/ntp-units.d' credstoredir = prefixdir / 'lib/credstore' pcrlockdir = prefixdir / 'lib/pcrlock.d' +mimepackagesdir = prefixdir / 'share/mime/packages' configfiledir = get_option('configfiledir') if configfiledir == '' @@ -198,6 +200,22 @@ if pamconfdir == '' pamconfdir = prefixdir / 'lib/pam.d' endif +sshconfdir = get_option('sshconfdir') +if sshconfdir == '' + sshconfdir = sysconfdir / 'ssh/ssh_config.d' +endif +conf.set10('LINK_SSH_PROXY_DROPIN', sshconfdir != 'no' and not sshconfdir.startswith('/usr/')) + +sshdconfdir = get_option('sshdconfdir') +if sshdconfdir == '' + sshdconfdir = sysconfdir / 'ssh/sshd_config.d' +endif +conf.set10('LINK_SSHD_USERDB_DROPIN', sshdconfdir != 'no' and not sshdconfdir.startswith('/usr/')) + +sshdprivsepdir = get_option('sshdprivsepdir') +conf.set10('CREATE_SSHDPRIVSEPDIR', sshdprivsepdir != 'no' and not sshdprivsepdir.startswith('/usr/')) +conf.set('SSHDPRIVSEPDIR', sshdprivsepdir, description : 'SSH privilege separation directory') + libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir') if libcryptsetup_plugins_dir == '' libcryptsetup_plugins_dir = libdir / 'cryptsetup' @@ -230,6 +248,8 @@ conf.set_quoted('PREFIX_NOSLASH', prefixdir_noslash) conf.set_quoted('RANDOM_SEED', randomseeddir / 'random-seed') conf.set_quoted('RANDOM_SEED_DIR', randomseeddir) conf.set_quoted('RC_LOCAL_PATH', get_option('rc-local')) +conf.set_quoted('SSHCONFDIR', sshconfdir) +conf.set_quoted('SSHDCONFDIR', sshdconfdir) conf.set_quoted('SYSCONF_DIR', sysconfdir) conf.set_quoted('SYSCTL_DIR', sysctldir) conf.set_quoted('SYSTEMCTL_BINARY_PATH', bindir / 'systemctl') @@ -254,6 +274,8 @@ conf.set_quoted('SYSTEMD_TEST_DATA', testdata_dir) conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', bindir / 'systemd-tty-ask-password-agent') conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', libexecdir / 'systemd-update-helper') conf.set_quoted('SYSTEMD_USERWORK_PATH', libexecdir / 'systemd-userwork') +conf.set_quoted('SYSTEMD_MOUNTWORK_PATH', libexecdir / 'systemd-mountwork') +conf.set_quoted('SYSTEMD_NSRESOURCEWORK_PATH', libexecdir / 'systemd-nsresourcework') conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', libexecdir / 'systemd-veritysetup') conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system') conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir) @@ -299,8 +321,9 @@ userspace_c_ld_args = [] meson_build_sh = find_program('tools/meson-build.sh') want_tests = get_option('tests') -slow_tests = want_tests != 'false' and get_option('slow-tests') -fuzz_tests = want_tests != 'false' and get_option('fuzz-tests') +want_slow_tests = want_tests != 'false' and get_option('slow-tests') +want_fuzz_tests = want_tests != 'false' and get_option('fuzz-tests') +want_integration_tests = want_tests != 'false' and get_option('integration-tests') install_tests = want_tests != 'false' and get_option('install-tests') if add_languages('cpp', native : false, required : fuzzer_build) @@ -603,11 +626,13 @@ foreach ident : [ ['pidfd_send_signal', '''#include <stdlib.h> #include <unistd.h> #include <signal.h> - #include <sys/wait.h>'''], + #include <sys/wait.h> + #include <sys/pidfd.h>'''], ['pidfd_open', '''#include <stdlib.h> #include <unistd.h> #include <signal.h> - #include <sys/wait.h>'''], + #include <sys/wait.h> + #include <sys/pidfd.h>'''], ['rt_sigqueueinfo', '''#include <stdlib.h> #include <unistd.h> #include <signal.h> @@ -628,6 +653,7 @@ foreach ident : [ ['fsconfig', '''#include <sys/mount.h>'''], ['fsmount', '''#include <sys/mount.h>'''], ['getdents64', '''#include <dirent.h>'''], + ['pidfd_spawn', '''#include <spawn.h>'''], ] have = cc.has_function(ident[0], prefix : ident[1], args : '-D_GNU_SOURCE') @@ -687,13 +713,11 @@ foreach prog : progs conf.set_quoted(name, path) endforeach -conf.set_quoted('TELINIT', get_option('telinit-path')) - if run_command(ln, '--relative', '--help', check : false).returncode() != 0 error('ln does not support --relative (added in coreutils 8.16)') endif -############################################################ +##################################################################### gperf = find_program('gperf') @@ -719,27 +743,28 @@ message('gperf len type is @0@'.format(gperf_len_type)) conf.set('GPERF_LEN_TYPE', gperf_len_type, description : 'The type of gperf "len" parameter') -############################################################ +##################################################################### if not cc.has_header('sys/capability.h') error('POSIX caps headers not found') endif foreach header : ['crypt.h', + 'linux/ioprio.h', 'linux/memfd.h', + 'linux/time_types.h', 'linux/vm_sockets.h', 'sys/auxv.h', + 'sys/sdt.h', 'threads.h', 'valgrind/memcheck.h', 'valgrind/valgrind.h', - 'linux/time_types.h', - 'sys/sdt.h', ] conf.set10('HAVE_' + header.underscorify().to_upper(), cc.has_header(header)) endforeach -############################################################ +##################################################################### fallback_hostname = get_option('fallback-hostname') if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0] == '-' @@ -749,17 +774,6 @@ if fallback_hostname == '' or fallback_hostname[0] == '.' or fallback_hostname[0 endif conf.set_quoted('FALLBACK_HOSTNAME', fallback_hostname) -default_hierarchy = get_option('default-hierarchy') -conf.set_quoted('DEFAULT_HIERARCHY_NAME', default_hierarchy, - description : 'default cgroup hierarchy as string') -if default_hierarchy == 'legacy' - conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_NONE') -elif default_hierarchy == 'hybrid' - conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_SYSTEMD') -else - conf.set('DEFAULT_HIERARCHY', 'CGROUP_UNIFIED_ALL') -endif - extra_net_naming_schemes = [] extra_net_naming_map = [] foreach scheme: get_option('extra-net-naming-schemes').split(',') @@ -928,7 +942,7 @@ foreach option : ['adm-gid', name = option.underscorify().to_upper() val = get_option(option) - # Ensure provided GID argument is numeric, otherwise fall back to default assignment + # Ensure provided GID argument is positive, otherwise fall back to default assignment conf.set(name, val > 0 ? val : '-') if val > 0 static_ugids += '@0@:@1@'.format(option, val) @@ -1046,7 +1060,7 @@ bpf_framework = get_option('bpf-framework') bpf_compiler = get_option('bpf-compiler') libbpf = dependency('libbpf', required : bpf_framework, - version : bpf_compiler == 'gcc' ? '>= 1.0.0' : '>= 0.1.0') + version : bpf_compiler == 'gcc' ? '>= 1.4.0' : '>= 0.1.0') conf.set10('HAVE_LIBBPF', libbpf.found()) if not libbpf.found() @@ -1202,6 +1216,7 @@ libkmod = dependency('libkmod', version : '>= 15', required : get_option('kmod')) conf.set10('HAVE_KMOD', libkmod.found()) +libkmod_cflags = libkmod.partial_dependency(includes: true, compile_args: true) libxenctrl = dependency('xencontrol', version : '>= 4.9', @@ -1247,10 +1262,15 @@ foreach ident : ['crypt_set_metadata_size', 'crypt_token_max', 'crypt_reencrypt_init_by_passphrase', 'crypt_reencrypt', - 'crypt_set_data_offset'] + 'crypt_set_data_offset', + 'crypt_set_keyring_to_link', + 'crypt_resume_by_volume_key'] have_ident = have and cc.has_function( ident, prefix : '#include <libcryptsetup.h>', + # crypt_reencrypt() raises a deprecation warning so make sure -Wno-deprecated-declarations is + # specified otherwise we fail to detect crypt_reencrypt() if -Werror is used. + args : '-Wno-deprecated-declarations', dependencies : libcryptsetup) conf.set10('HAVE_' + ident.to_upper(), have_ident) endforeach @@ -1314,6 +1334,9 @@ if not have # link to neither of the libs if one is not found libgcrypt = [] libgpg_error = [] + libgcrypt_cflags = [] +else + libgcrypt_cflags = libgcrypt.partial_dependency(includes: true, compile_args: true) endif conf.set10('HAVE_GCRYPT', have) @@ -1368,16 +1391,19 @@ conf.set10('HAVE_BZIP2', libbzip2.found()) libxz = dependency('liblzma', required : get_option('xz')) conf.set10('HAVE_XZ', libxz.found()) +libxz_cflags = libxz.partial_dependency(includes: true, compile_args: true) liblz4 = dependency('liblz4', version : '>= 1.3.0', required : get_option('lz4')) conf.set10('HAVE_LZ4', liblz4.found()) +liblz4_cflags = liblz4.partial_dependency(includes: true, compile_args: true) libzstd = dependency('libzstd', version : '>= 1.4.0', required : get_option('zstd')) conf.set10('HAVE_ZSTD', libzstd.found()) +libzstd_cflags = libzstd.partial_dependency(includes: true, compile_args: true) conf.set10('HAVE_COMPRESSION', libxz.found() or liblz4.found() or libzstd.found()) @@ -1399,8 +1425,22 @@ elif compression == 'lz4' and not liblz4.found() elif compression == 'xz' and not libxz.found() error('default-compression=xz requires xz') endif +# In the dlopen ELF note we save the default compression library with a +# higher priority, so that packages can give it priority over the +# secondary libraries. +conf.set_quoted('COMPRESSION_PRIORITY_ZSTD', + compression == 'zstd' ? 'recommended' : 'suggested') +conf.set_quoted('COMPRESSION_PRIORITY_LZ4', + compression == 'lz4' ? 'recommended' : 'suggested') +conf.set_quoted('COMPRESSION_PRIORITY_XZ', + compression == 'xz' ? 'recommended' : 'suggested') conf.set('DEFAULT_COMPRESSION', 'COMPRESSION_@0@'.format(compression.to_upper())) +libarchive = dependency('libarchive', + version : '>= 3.0', + required : get_option('libarchive')) +conf.set10('HAVE_LIBARCHIVE', libarchive.found()) + libxkbcommon = dependency('xkbcommon', version : '>= 0.3.0', required : get_option('xkbcommon')) @@ -1552,7 +1592,8 @@ conf.set10('ENABLE_IMPORTD', have) have = get_option('homed').require( conf.get('HAVE_OPENSSL') == 1 and conf.get('HAVE_LIBFDISK') == 1 and - conf.get('HAVE_LIBCRYPTSETUP') == 1, + conf.get('HAVE_LIBCRYPTSETUP') == 1 and + conf.get('HAVE_CRYPT_RESUME_BY_VOLUME_KEY') == 1, error_message : 'openssl, fdisk and libcryptsetup required').allowed() conf.set10('ENABLE_HOMED', have) @@ -1575,6 +1616,8 @@ conf.set10('ENABLE_REMOTE', have) feature = get_option('vmspawn').disable_auto_if(conf.get('BUILD_MODE_DEVELOPER') == 0) conf.set10('ENABLE_VMSPAWN', feature.allowed()) +conf.set10('DEFAULT_MOUNTFSD_TRUSTED_DIRECTORIES', get_option('default-mountfsd-trusted-directories')) + foreach term : ['analyze', 'backlight', 'binfmt', @@ -1595,8 +1638,10 @@ foreach term : ['analyze', 'localed', 'logind', 'machined', + 'mountfsd', 'networkd', 'nscd', + 'nsresourced', 'nss-myhostname', 'nss-systemd', 'oomd', @@ -1652,15 +1697,18 @@ conf.set10('ENABLE_NSS', enable_nss) conf.set10('ENABLE_TIMEDATECTL', get_option('timedated') or get_option('timesyncd')) -conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', slow_tests) +conf.set10('ENABLE_SSH_PROXY_CONFIG', sshconfdir != 'no') +conf.set10('ENABLE_SSH_USERDB_CONFIG', conf.get('ENABLE_USERDB') == 1 and sshdconfdir != 'no') -############################################################ +conf.set10('SYSTEMD_SLOW_TESTS_DEFAULT', want_slow_tests) + +##################################################################### pymod = import('python') python = pymod.find_installation('python3', required : true, modules : ['jinja2']) python_39 = python.language_version().version_compare('>=3.9') -############################################################ +##################################################################### if conf.get('BPF_FRAMEWORK') == 1 bpf_clang_flags = [ @@ -1685,6 +1733,24 @@ if conf.get('BPF_FRAMEWORK') == 1 '-c', ] + # If c_args contains these flags copy them along with the values, in order to avoid breaking + # reproducible builds and other functionality + propagate_cflags = [ + '-ffile-prefix-map=', + '-fdebug-prefix-map=', + '-fmacro-prefix-map=', + ] + + foreach opt : c_args + foreach flag : propagate_cflags + if opt.startswith(flag) + bpf_clang_flags += [opt] + bpf_gcc_flags += [opt] + break + endif + endforeach + endforeach + # Generate defines that are appropriate to tell the compiler what architecture # we're compiling for. By default we just map meson's cpu_family to __<cpu_family>__. # This dictionary contains the exceptions where this doesn't work. @@ -1697,6 +1763,7 @@ if conf.get('BPF_FRAMEWORK') == 1 'riscv32' : ['-D__riscv', '-D__riscv_xlen=32'], 'riscv64' : ['-D__riscv', '-D__riscv_xlen=64'], 'x86' : ['-D__i386__'], + 's390x' : ['-D__s390__', '-D__s390x__'], # For arm, assume hardware fp is available. 'arm' : ['-D__arm__', '-D__ARM_PCS_VFP'], @@ -1811,9 +1878,82 @@ pefile = pymod.find_installation('python3', required: false, modules : ['pefile' want_ukify = get_option('ukify').require(python_39 and (want_tests != 'true' or pefile.found()), error_message : 'Python >= 3.9 and pefile required').allowed() conf.set10('ENABLE_UKIFY', want_ukify) -############################################################ +##################################################################### check_efi_alignment_py = find_program('tools/check-efi-alignment.py') + +##################################################################### + +use_provided_vmlinux_h = false +use_generated_vmlinux_h = false +provided_vmlinux_h_path = get_option('vmlinux-h-path') + +# For the more complex BPF programs we really want a vmlinux.h (which is arch +# specific, but only somewhat bound to kernel version). Ideally the kernel +# development headers would ship that, but right now they don't. Hence address +# this in two ways: +# +# 1. Provide a vmlinux.h at build time +# 2. Generate the file on the fly where possible (which requires /sys/ to be mounted) +# +# We generally prefer the former (to support reproducible builds), but will +# fallback to the latter. + +if conf.get('BPF_FRAMEWORK') == 1 + enable_vmlinux_h = get_option('vmlinux-h') + + if enable_vmlinux_h == 'auto' + if provided_vmlinux_h_path != '' + use_provided_vmlinux_h = true + elif fs.exists('/sys/kernel/btf/vmlinux') and \ + bpftool.found() and \ + (host_machine.cpu_family() == build_machine.cpu_family()) and \ + host_machine.cpu_family() in ['x86_64', 'aarch64'] + + # We will only generate a vmlinux.h from the running + # kernel if the host and build machine are of the same + # family. Also for now we focus on x86_64 and aarch64, + # since other archs don't seem to be ready yet. + + use_generated_vmlinux_h = true + endif + elif enable_vmlinux_h == 'provided' + use_provided_vmlinux_h = true + elif enable_vmlinux_h == 'generated' + if not fs.exists('/sys/kernel/btf/vmlinux') + error('BTF data from kernel not available (/sys/kernel/btf/vmlinux missing), cannot generate vmlinux.h, but was asked to.') + endif + if not bpftool.found() + error('bpftool not available, cannot generate vmlinux.h, but was asked to.') + endif + use_generated_vmlinux_h = true + endif +endif + +if use_provided_vmlinux_h + if not fs.exists(provided_vmlinux_h_path) + error('Path to provided vmlinux.h does not exist.') + endif + vmlinux_h_dependency = [] + bpf_o_unstripped_cmd += ['-I' + fs.parent(provided_vmlinux_h_path)] + message('Using provided @0@'.format(provided_vmlinux_h_path)) +elif use_generated_vmlinux_h + vmlinux_h_dependency = custom_target( + 'vmlinux.h', + output: 'vmlinux.h', + command : [ bpftool, 'btf', 'dump', 'file', '/sys/kernel/btf/vmlinux', 'format', 'c' ], + capture : true) + + bpf_o_unstripped_cmd += ['-I' + fs.parent(vmlinux_h_dependency.full_path())] + message('Using generated @0@'.format(vmlinux_h_dependency.full_path())) +else + message('Using neither provided nor generated vmlinux.h, some features will not be available.') +endif + +conf.set10('HAVE_VMLINUX_H', use_provided_vmlinux_h or use_generated_vmlinux_h) + +##################################################################### + check_version_history_py = find_program('tools/check-version-history.py') elf2efi_py = find_program('tools/elf2efi.py') export_dbus_interfaces_py = find_program('tools/dbus_exporter.py') @@ -1830,30 +1970,38 @@ update_man_rules_py = find_program('tools/update-man-rules.py') update_syscall_tables_sh = find_program('tools/update-syscall-tables.sh') xml_helper_py = find_program('tools/xml_helper.py') -############################################################ +##################################################################### version_tag = get_option('version-tag') +if version_tag == '' + version_tag = meson.project_version() +endif + +conf.set_quoted('VERSION_TAG', version_tag) + +vcs_tag = get_option('vcs-tag') +command = ['sh', '-c', + vcs_tag and fs.exists(project_source_root / '.git') ? + 'echo "-g$(git -C . describe --abbrev=7 --match="" --always --dirty=^)"' : ':'] version_h = vcs_tag( input : 'src/version/version.h.in', output : 'version.h', - command: [project_source_root / 'tools/meson-vcs-tag.sh', - project_source_root, - meson.project_version(), - version_tag, - ]) + fallback : '', + command : command, +) shared_lib_tag = get_option('shared-lib-tag') if shared_lib_tag == '' - shared_lib_tag = meson.project_version() + shared_lib_tag = meson.project_version().split('~')[0] endif -############################################################ +##################################################################### if get_option('b_coverage') userspace_c_args += ['-include', 'src/basic/coverage.h'] endif -############################################################ +##################################################################### config_h = configure_file( output : 'config.h', @@ -1861,7 +2009,7 @@ config_h = configure_file( userspace_c_args += ['-include', 'config.h'] -jinja2_cmdline = [meson_render_jinja2, config_h, version_h] +jinja2_cmdline = [meson_render_jinja2, config_h] userspace = declare_dependency( compile_args : userspace_c_args, @@ -1871,7 +2019,7 @@ userspace = declare_dependency( man_page_depends = [] -############################################################ +##################################################################### simple_tests = [] libsystemd_tests = [] @@ -1926,10 +2074,10 @@ libsystemd = shared_library( version : libsystemd_version, include_directories : libsystemd_includes, link_args : ['-shared', + # Make sure our library is never deleted from memory, so that our open logging fds don't leak on dlopen/dlclose cycles. + '-z', 'nodelete', '-Wl,--version-script=' + libsystemd_sym_path], - link_with : [libbasic, - libbasic_gcrypt, - libbasic_compress], + link_with : [libbasic], link_whole : [libsystemd_static], dependencies : [librt, threads, @@ -1939,14 +2087,10 @@ libsystemd = shared_library( install_tag: 'libsystemd', install_dir : libdir) -alias_target('libsystemd', libsystemd) - install_libsystemd_static = static_library( 'systemd', libsystemd_sources, basic_sources, - basic_gcrypt_sources, - basic_compress_sources, fundamental_sources, include_directories : libsystemd_includes, build_by_default : static_libsystemd != 'false', @@ -1957,17 +2101,23 @@ install_libsystemd_static = static_library( dependencies : [libblkid, libcap, libdl, - libgcrypt, - liblz4, + libgcrypt_cflags, + liblz4_cflags, libmount, libopenssl, librt, - libxz, - libzstd, + libxz_cflags, + libzstd_cflags, threads, userspace], c_args : libsystemd_c_args + (static_libsystemd_pic ? [] : ['-fno-PIC'])) +if static_libsystemd != 'false' + alias_target('libsystemd', libsystemd, install_libsystemd_static) +else + alias_target('libsystemd', libsystemd) +endif + libudev = shared_library( 'udev', version : libudev_version, @@ -1983,8 +2133,6 @@ libudev = shared_library( install_tag: 'libudev', install_dir : libdir) -alias_target('libudev', libudev) - install_libudev_static = static_library( 'udev', basic_sources, @@ -2004,7 +2152,13 @@ install_libudev_static = static_library( c_args : static_libudev_pic ? [] : ['-fno-PIC'], pic : static_libudev_pic) -############################################################ +if static_libudev != 'false' + alias_target('libudev', libudev, install_libudev_static) +else + alias_target('libudev', libudev) +endif + +##################################################################### runtest_env = custom_target( 'systemd-runtest.env', @@ -2025,7 +2179,7 @@ if '-O2' in c_args and '-flto=auto' in c_args test_cflags += cc.first_supported_argument('-Wno-maybe-uninitialized') endif -############################################################ +##################################################################### executable_template = { 'include_directories' : includes, @@ -2121,7 +2275,7 @@ module_additional_kwargs = { 'dependencies' : userspace, } -############################################################ +##################################################################### # systemd-analyze requires 'libcore' subdir('src/core') @@ -2172,11 +2326,13 @@ subdir('src/locale') subdir('src/login') subdir('src/machine') subdir('src/machine-id-setup') +subdir('src/mountfsd') subdir('src/modules-load') subdir('src/mount') subdir('src/network') subdir('src/notify') subdir('src/nspawn') +subdir('src/nsresourced') subdir('src/nss-myhostname') subdir('src/nss-mymachines') subdir('src/nss-resolve') @@ -2202,6 +2358,7 @@ subdir('src/shutdown') subdir('src/sleep') subdir('src/socket-activate') subdir('src/socket-proxy') +subdir('src/ssh-generator') subdir('src/stdio-bridge') subdir('src/sulogin-shell') subdir('src/sysctl') @@ -2226,6 +2383,7 @@ subdir('src/vconsole') subdir('src/veritysetup') subdir('src/vmspawn') subdir('src/volatile-root') +subdir('src/vpick') subdir('src/xdg-autostart-generator') subdir('src/systemd') @@ -2235,9 +2393,11 @@ subdir('src/fuzz') subdir('src/ukify/test') # needs to be last for test_env variable subdir('test/fuzz') +subdir('mime') + alias_target('devel', libsystemd_pc, libudev_pc, systemd_pc, udev_pc) -############################################################ +##################################################################### foreach test : simple_tests executables += test_template + { 'sources' : [test] } @@ -2374,10 +2534,12 @@ endforeach alias_target('fuzzers', fuzzer_exes) -############################################################ +##################################################################### test_dlopen = executables_by_name.get('test-dlopen') +nss_targets = [] +pam_targets = [] foreach dict : modules name = dict.get('name') is_nss = name.startswith('nss_') @@ -2426,6 +2588,11 @@ foreach dict : modules # Unfortunately shared_library insists on creating the symlink… meson.add_install_script(sh, '-c', 'rm $DESTDIR@0@/lib@1@.so'.format(libdir, name), install_tag : 'nss') + nss_targets += lib + endif + + if is_pam + pam_targets += lib endif if want_tests != 'false' and (is_nss or is_pam) @@ -2438,7 +2605,15 @@ foreach dict : modules endif endforeach -############################################################ +# We need the actual targets to build aliases +if nss_targets.length() > 0 + alias_target('nss', nss_targets) +endif +if pam_targets.length() > 0 + alias_target('pam', pam_targets) +endif + +##################################################################### ukify = custom_target( 'ukify', @@ -2457,12 +2632,56 @@ if want_ukify libexecdir / 'ukify')) endif +##################################################################### + +mkosi = find_program('mkosi', required : false) +if want_integration_tests and not mkosi.found() + error('Could not find mkosi which is required to run the integration tests') +endif + +mkosi_depends = public_programs + +foreach executable : ['systemd-journal-remote', 'systemd-measure'] + if executable in executables_by_name + mkosi_depends += [executables_by_name[executable]] + endif +endforeach + +if mkosi.found() + genkey = custom_target('genkey', + output : ['mkosi.key', 'mkosi.crt'], + command : [mkosi, '--force', 'genkey'], + depends : mkosi_depends, + ) + + custom_target('mkosi', + build_always_stale : true, + build_by_default: false, + console : true, + output : '.', + command : [ + mkosi, + '--directory', meson.current_source_dir(), + '--output-dir', meson.current_build_dir() / 'mkosi.output', + '--cache-dir', meson.current_build_dir() / 'mkosi.cache', + '--build-dir', meson.current_build_dir() / 'mkosi.builddir', + '--secure-boot-key', meson.current_build_dir() / 'mkosi.key', + '--secure-boot-certificate', meson.current_build_dir() / 'mkosi.crt', + '--verity-key', meson.current_build_dir() / 'mkosi.key', + '--verity-certificate', meson.current_build_dir() / 'mkosi.crt', + '--force', + 'build', + ], + depends : mkosi_depends + [genkey], + ) +endif + ############################################################ subdir('rules.d') subdir('test') -############################################################ +##################################################################### subdir('docs/sysvinit') subdir('docs/var-log') @@ -2504,7 +2723,7 @@ install_subdir('LICENSES', install_emptydir(systemdstatedir) -############################################################ +##################################################################### # Ensure that changes to the docs/ directory do not break the # basic Github pages build. But only run it in developer mode, @@ -2520,7 +2739,7 @@ if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found( '--destination', project_build_root / '_site']) endif -############################################################ +##################################################################### check_help = find_program('tools/check-help.sh') check_version = find_program('tools/check-version.sh') @@ -2534,11 +2753,17 @@ foreach exec : public_programs args : exec.full_path(), depends: exec) + version = meson.project_version() + if name == 'udevadm' + # For compatibility reasons we can't use the full version in udevadm. + version = version.split('~')[0] + endif + test('check-version-' + name, check_version, suite : 'dist', args : [exec.full_path(), - meson.project_version()], + version], depends: exec) endif endforeach @@ -2555,7 +2780,7 @@ foreach tuple : fuzz_sanitizers message('Not compiling @0@ because tests is set to false'.format(name)) continue endif - if not fuzz_tests + if not want_fuzz_tests message('Not compiling @0@ because fuzz-tests is set to false'.format(name)) continue endif @@ -2589,7 +2814,7 @@ foreach tuple : fuzz_sanitizers endif endforeach -############################################################ +##################################################################### if git.found() all_files = run_command( @@ -2646,7 +2871,7 @@ if git.found() 'HEAD']) endif -############################################################ +##################################################################### check_api_docs_sh = find_program('tools/check-api-docs.sh') run_target( @@ -2666,7 +2891,15 @@ if not meson.is_cross_build() command : [export_dbus_interfaces_py, '@OUTPUT@', dbus_programs]) endif -############################################################ +meson_extract_unit_files = find_program('tools/meson-extract-unit-files.py') +custom_target('installed-unit-files.txt', + output : 'installed-unit-files.txt', + capture : true, + install : want_tests != 'no' and install_tests, + install_dir : testdata_dir, + command : [meson_extract_unit_files, project_build_root]) + +##################################################################### alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch), check : true).stdout().strip() @@ -2681,6 +2914,9 @@ summary({ 'SysV rc?.d directories' : sysvrcnd_path, 'PAM modules directory' : pamlibdir, 'PAM configuration directory' : pamconfdir, + 'ssh server configuration directory' : sshdconfdir, + 'ssh server privilege separation directory' : sshdprivsepdir, + 'ssh client configuration directory' : sshconfdir, 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir, 'RPM macros directory' : rpmmacrosdir, 'modprobe.d directory' : modprobedir, @@ -2715,9 +2951,8 @@ summary({ 'default LLMNR mode' : default_llmnr, 'default DNS servers' : dns_servers.split(' '), 'default NTP servers' : ntp_servers.split(' '), - 'default cgroup hierarchy' : default_hierarchy, - 'default net.naming-scheme value' : default_net_naming_scheme, - 'default KillUserProcesses value' : kill_user_processes, + 'default net.naming_scheme= value': default_net_naming_scheme, + 'default KillUserProcesses= value': kill_user_processes, 'default locale' : default_locale, 'default nspawn locale' : nspawn_locale, 'default status unit format' : status_unit_format_default, @@ -2844,8 +3079,8 @@ foreach tuple : [ ['debug mmap cache'], ['debug siphash'], ['trace logging', conf.get('LOG_TRACE') == 1], - ['slow tests', slow_tests], - ['fuzz tests', fuzz_tests], + ['slow tests', want_slow_tests], + ['fuzz tests', want_fuzz_tests], ['install tests', install_tests], ['link-udev-shared', get_option('link-udev-shared')], ['link-systemctl-shared', get_option('link-systemctl-shared')], |