From fce9abb22793505fbb09eccd0b1e24b5d578dbcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 27 Jul 2021 19:32:35 +0200 Subject: [PATCH 1/4] meson: use a/b instead of join_paths(a,b) It is nicer and shorter. --- hwdb.d/meson.build | 2 +- man/meson.build | 12 +- meson.build | 232 +++++++++---------- network/meson.build | 2 +- shell-completion/bash/meson.build | 2 +- shell-completion/zsh/meson.build | 2 +- src/boot/efi/meson.build | 18 +- src/core/meson.build | 6 +- src/cryptsetup/cryptsetup-tokens/meson.build | 2 +- src/fundamental/meson.build | 4 +- src/journal-remote/meson.build | 2 +- src/kernel-install/meson.build | 2 +- src/libsystemd/meson.build | 2 +- src/libudev/meson.build | 4 +- src/locale/meson.build | 4 +- src/portable/meson.build | 8 +- src/systemd/meson.build | 2 +- src/udev/meson.build | 4 +- sysctl.d/meson.build | 2 +- test/meson.build | 2 +- tmpfiles.d/meson.build | 3 +- units/meson.build | 10 +- 22 files changed, 163 insertions(+), 164 deletions(-) diff --git a/hwdb.d/meson.build b/hwdb.d/meson.build index 0a96b5553a..4f3560e37f 100644 --- a/hwdb.d/meson.build +++ b/hwdb.d/meson.build @@ -49,7 +49,7 @@ if conf.get('ENABLE_HWDB') == 1 if install_sysconfdir meson.add_install_script('sh', '-c', - mkdir_p.format(join_paths(sysconfdir, 'udev/hwdb.d'))) + mkdir_p.format(sysconfdir / 'udev/hwdb.d')) meson.add_install_script('sh', '-c', 'test -n "$DESTDIR" || @0@/systemd-hwdb update'.format(rootbindir)) diff --git a/man/meson.build b/man/meson.build index 900bb2a3af..bb00b6e3dd 100644 --- a/man/meson.build +++ b/man/meson.build @@ -54,7 +54,7 @@ foreach tuple : xsltproc.found() ? manpages : [] htmlaliases += alias + '.html' endforeach - mandirn = join_paths(get_option('mandir'), 'man' + section) + mandirn = get_option('mandir') / ('man' + section) if condition == '' or conf.get(condition) == 1 p1 = custom_target( @@ -74,7 +74,7 @@ foreach tuple : xsltproc.found() ? manpages : [] output : htmlalias, command : [ln, '-fs', html, '@OUTPUT@']) if want_html - dst = join_paths(docdir, 'html', htmlalias) + dst = docdir / 'html' / htmlalias cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst) meson.add_install_script('sh', '-c', cmd) p2 += link @@ -89,7 +89,7 @@ foreach tuple : xsltproc.found() ? manpages : [] command : xslt_cmd + [custom_html_xsl, '@INPUT@'], depends : [custom_entities_ent, p2], install : want_html, - install_dir : join_paths(docdir, 'html')) + install_dir : docdir / 'html') html_pages += p3 file = files(tuple[0] + '.xml') @@ -132,7 +132,7 @@ foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directiv html = stem + '.html' man = stem + '.' + section - mandirn = join_paths(get_option('mandir'), 'man' + section) + mandirn = get_option('mandir') / ('man' + section) p1 = custom_target( man, @@ -152,7 +152,7 @@ foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directiv output : htmlalias, command : [ln, '-fs', html, '@OUTPUT@']) if want_html - dst = join_paths(docdir, 'html', htmlalias) + dst = docdir / 'html' / htmlalias cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst) meson.add_install_script('sh', '-c', cmd) p2 += link @@ -167,7 +167,7 @@ foreach tuple : xsltproc.found() ? [['systemd.directives', '7', systemd_directiv command : xslt_cmd + [custom_html_xsl, '@INPUT@'], depends : [custom_entities_ent, p2], install : want_html and have_lxml, - install_dir : join_paths(docdir, 'html')) + install_dir : docdir / 'html') html_pages += p3 endforeach diff --git a/meson.build b/meson.build index 5ba92bdf6f..e3b2b816c2 100644 --- a/meson.build +++ b/meson.build @@ -101,9 +101,9 @@ conf.set10('BUMP_PROC_SYS_FS_FILE_MAX', get_option('bump-proc-sys-fs-file-max')) conf.set10('BUMP_PROC_SYS_FS_NR_OPEN', get_option('bump-proc-sys-fs-nr-open')) conf.set('HIGH_RLIMIT_NOFILE', 512*1024) -# join_paths ignores the preceding arguments if an absolute component is -# encountered, so this should canonicalize various paths when they are -# absolute or relative. +# Meson ignores the preceding arguments when joining paths if an absolute +# component is encountered, so this should canonicalize various paths when they +# are absolute or relative. prefixdir = get_option('prefix') if not prefixdir.startswith('/') error('Prefix is not absolute: "@0@"'.format(prefixdir)) @@ -113,105 +113,105 @@ if prefixdir != rootprefixdir and rootprefixdir != '/' and not prefixdir.strip(' rootprefixdir, prefixdir)) endif -bindir = join_paths(prefixdir, get_option('bindir')) -libdir = join_paths(prefixdir, get_option('libdir')) -sysconfdir = join_paths(prefixdir, get_option('sysconfdir')) -includedir = join_paths(prefixdir, get_option('includedir')) -datadir = join_paths(prefixdir, get_option('datadir')) -localstatedir = join_paths('/', get_option('localstatedir')) +bindir = prefixdir / get_option('bindir') +libdir = prefixdir / get_option('libdir') +sysconfdir = prefixdir / get_option('sysconfdir') +includedir = prefixdir / get_option('includedir') +datadir = prefixdir / get_option('datadir') +localstatedir = '/' / get_option('localstatedir') -rootbindir = join_paths(rootprefixdir, 'bin') -rootsbindir = join_paths(rootprefixdir, split_bin ? 'sbin' : 'bin') -rootlibexecdir = join_paths(rootprefixdir, 'lib/systemd') +rootbindir = rootprefixdir / 'bin' +rootsbindir = rootprefixdir / (split_bin ? 'sbin' : 'bin') +rootlibexecdir = rootprefixdir / 'lib/systemd' rootlibdir = get_option('rootlibdir') if rootlibdir == '' - rootlibdir = join_paths(rootprefixdir, libdir.split('/')[-1]) + rootlibdir = rootprefixdir / libdir.split('/')[-1] endif install_sysconfdir = get_option('install-sysconfdir') != 'false' install_sysconfdir_samples = get_option('install-sysconfdir') == 'true' # Dirs of external packages -pkgconfigdatadir = get_option('pkgconfigdatadir') == '' ? join_paths(datadir, 'pkgconfig') : get_option('pkgconfigdatadir') -pkgconfiglibdir = get_option('pkgconfiglibdir') == '' ? join_paths(libdir, 'pkgconfig') : get_option('pkgconfiglibdir') -polkitpolicydir = join_paths(datadir, 'polkit-1/actions') -polkitrulesdir = join_paths(datadir, 'polkit-1/rules.d') -polkitpkladir = join_paths(localstatedir, 'lib/polkit-1/localauthority/10-vendor.d') -xinitrcdir = get_option('xinitrcdir') == '' ? join_paths(sysconfdir, 'X11/xinit/xinitrc.d') : get_option('xinitrcdir') +pkgconfigdatadir = get_option('pkgconfigdatadir') != '' ? get_option('pkgconfigdatadir') : datadir / 'pkgconfig' +pkgconfiglibdir = get_option('pkgconfiglibdir') != '' ? get_option('pkgconfiglibdir') : libdir / 'pkgconfig' +polkitpolicydir = datadir / 'polkit-1/actions' +polkitrulesdir = datadir / 'polkit-1/rules.d' +polkitpkladir = localstatedir / 'lib/polkit-1/localauthority/10-vendor.d' +xinitrcdir = get_option('xinitrcdir') != '' ? get_option('xinitrcdir') : sysconfdir / 'X11/xinit/xinitrc.d' rpmmacrosdir = get_option('rpmmacrosdir') if rpmmacrosdir != 'no' - rpmmacrosdir = join_paths(prefixdir, rpmmacrosdir) + rpmmacrosdir = prefixdir / rpmmacrosdir endif -modprobedir = join_paths(rootprefixdir, 'lib/modprobe.d') +modprobedir = rootprefixdir / 'lib/modprobe.d' # Our own paths -pkgdatadir = join_paths(datadir, 'systemd') -environmentdir = join_paths(prefixdir, 'lib/environment.d') -pkgsysconfdir = join_paths(sysconfdir, 'systemd') -userunitdir = join_paths(prefixdir, 'lib/systemd/user') -userpresetdir = join_paths(prefixdir, 'lib/systemd/user-preset') -tmpfilesdir = join_paths(prefixdir, 'lib/tmpfiles.d') -sysusersdir = join_paths(prefixdir, 'lib/sysusers.d') -sysctldir = join_paths(prefixdir, 'lib/sysctl.d') -binfmtdir = join_paths(prefixdir, 'lib/binfmt.d') -modulesloaddir = join_paths(prefixdir, 'lib/modules-load.d') -networkdir = join_paths(rootprefixdir, 'lib/systemd/network') -pkgincludedir = join_paths(includedir, 'systemd') -systemgeneratordir = join_paths(rootlibexecdir, 'system-generators') -usergeneratordir = join_paths(prefixdir, 'lib/systemd/user-generators') -systemenvgeneratordir = join_paths(prefixdir, 'lib/systemd/system-environment-generators') -userenvgeneratordir = join_paths(prefixdir, 'lib/systemd/user-environment-generators') -systemshutdowndir = join_paths(rootlibexecdir, 'system-shutdown') -systemsleepdir = join_paths(rootlibexecdir, 'system-sleep') -systemunitdir = join_paths(rootprefixdir, 'lib/systemd/system') -systempresetdir = join_paths(rootprefixdir, 'lib/systemd/system-preset') -udevlibexecdir = join_paths(rootprefixdir, 'lib/udev') -udevrulesdir = join_paths(udevlibexecdir, 'rules.d') -udevhwdbdir = join_paths(udevlibexecdir, 'hwdb.d') -catalogdir = join_paths(prefixdir, 'lib/systemd/catalog') -kernelinstalldir = join_paths(prefixdir, 'lib/kernel/install.d') -factorydir = join_paths(datadir, 'factory') -bootlibdir = join_paths(prefixdir, 'lib/systemd/boot/efi') -testsdir = join_paths(prefixdir, 'lib/systemd/tests') -systemdstatedir = join_paths(localstatedir, 'lib/systemd') -catalogstatedir = join_paths(systemdstatedir, 'catalog') -randomseeddir = join_paths(localstatedir, 'lib/systemd') -profiledir = join_paths(rootlibexecdir, 'portable', 'profile') -ntpservicelistdir = join_paths(rootprefixdir, 'lib/systemd/ntp-units.d') +pkgdatadir = datadir / 'systemd' +environmentdir = prefixdir / 'lib/environment.d' +pkgsysconfdir = sysconfdir / 'systemd' +userunitdir = prefixdir / 'lib/systemd/user' +userpresetdir = prefixdir / 'lib/systemd/user-preset' +tmpfilesdir = prefixdir / 'lib/tmpfiles.d' +sysusersdir = prefixdir / 'lib/sysusers.d' +sysctldir = prefixdir / 'lib/sysctl.d' +binfmtdir = prefixdir / 'lib/binfmt.d' +modulesloaddir = prefixdir / 'lib/modules-load.d' +networkdir = rootprefixdir / 'lib/systemd/network' +pkgincludedir = includedir / 'systemd' +systemgeneratordir = rootlibexecdir / 'system-generators' +usergeneratordir = prefixdir / 'lib/systemd/user-generators' +systemenvgeneratordir = prefixdir / 'lib/systemd/system-environment-generators' +userenvgeneratordir = prefixdir / 'lib/systemd/user-environment-generators' +systemshutdowndir = rootlibexecdir / 'system-shutdown' +systemsleepdir = rootlibexecdir / 'system-sleep' +systemunitdir = rootprefixdir / 'lib/systemd/system' +systempresetdir = rootprefixdir / 'lib/systemd/system-preset' +udevlibexecdir = rootprefixdir / 'lib/udev' +udevrulesdir = udevlibexecdir / 'rules.d' +udevhwdbdir = udevlibexecdir / 'hwdb.d' +catalogdir = prefixdir / 'lib/systemd/catalog' +kernelinstalldir = prefixdir / 'lib/kernel/install.d' +factorydir = datadir / 'factory' +bootlibdir = prefixdir / 'lib/systemd/boot/efi' +testsdir = prefixdir / 'lib/systemd/tests' +systemdstatedir = localstatedir / 'lib/systemd' +catalogstatedir = systemdstatedir / 'catalog' +randomseeddir = localstatedir / 'lib/systemd' +profiledir = rootlibexecdir / 'portable' / 'profile' +ntpservicelistdir = rootprefixdir / 'lib/systemd/ntp-units.d' docdir = get_option('docdir') if docdir == '' - docdir = join_paths(datadir, 'doc/systemd') + docdir = datadir / 'doc/systemd' endif dbuspolicydir = get_option('dbuspolicydir') if dbuspolicydir == '' - dbuspolicydir = join_paths(datadir, 'dbus-1/system.d') + dbuspolicydir = datadir / 'dbus-1/system.d' endif dbussessionservicedir = get_option('dbussessionservicedir') if dbussessionservicedir == '' - dbussessionservicedir = join_paths(datadir, 'dbus-1/services') + dbussessionservicedir = datadir / 'dbus-1/services' endif dbussystemservicedir = get_option('dbussystemservicedir') if dbussystemservicedir == '' - dbussystemservicedir = join_paths(datadir, 'dbus-1/system-services') + dbussystemservicedir = datadir / 'dbus-1/system-services' endif pamlibdir = get_option('pamlibdir') if pamlibdir == '' - pamlibdir = join_paths(rootlibdir, 'security') + pamlibdir = rootlibdir / 'security' endif pamconfdir = get_option('pamconfdir') if pamconfdir == '' - pamconfdir = join_paths(prefixdir, 'lib/pam.d') + pamconfdir = prefixdir / 'lib/pam.d' endif libcryptsetup_plugins_dir = get_option('libcryptsetup-plugins-dir') if libcryptsetup_plugins_dir == '' - libcryptsetup_plugins_dir = join_paths(rootlibdir, 'cryptsetup') + libcryptsetup_plugins_dir = rootlibdir / 'cryptsetup' endif memory_accounting_default = get_option('memory-accounting-default') @@ -219,19 +219,19 @@ status_unit_format_default = get_option('status-unit-format-default') conf.set_quoted('BINFMT_DIR', binfmtdir) conf.set_quoted('BOOTLIBDIR', bootlibdir) -conf.set_quoted('CATALOG_DATABASE', join_paths(catalogstatedir, 'database')) +conf.set_quoted('CATALOG_DATABASE', catalogstatedir / 'database') conf.set_quoted('CERTIFICATE_ROOT', get_option('certificate-root')) conf.set_quoted('DOC_DIR', docdir) -conf.set_quoted('DOCUMENT_ROOT', join_paths(pkgdatadir, 'gatewayd')) +conf.set_quoted('DOCUMENT_ROOT', pkgdatadir / 'gatewayd') conf.set_quoted('ENVIRONMENT_DIR', environmentdir) conf.set_quoted('INCLUDE_DIR', includedir) conf.set_quoted('LIBDIR', libdir) conf.set_quoted('MODPROBE_DIR', modprobedir) conf.set_quoted('MODULESLOAD_DIR', modulesloaddir) conf.set_quoted('PKGSYSCONFDIR', pkgsysconfdir) -conf.set_quoted('POLKIT_AGENT_BINARY_PATH', join_paths(bindir, 'pkttyagent')) +conf.set_quoted('POLKIT_AGENT_BINARY_PATH', bindir / 'pkttyagent') conf.set_quoted('PREFIX', prefixdir) -conf.set_quoted('RANDOM_SEED', join_paths(randomseeddir, 'random-seed')) +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('ROOTBINDIR', rootbindir) @@ -241,29 +241,29 @@ conf.set_quoted('ROOTPREFIX', rootprefixdir) conf.set_quoted('ROOTPREFIX_NOSLASH', rootprefixdir_noslash) conf.set_quoted('SYSCONF_DIR', sysconfdir) conf.set_quoted('SYSCTL_DIR', sysctldir) -conf.set_quoted('SYSTEMCTL_BINARY_PATH', join_paths(rootbindir, 'systemctl')) -conf.set_quoted('SYSTEMD_BINARY_PATH', join_paths(rootlibexecdir, 'systemd')) +conf.set_quoted('SYSTEMCTL_BINARY_PATH', rootbindir / 'systemctl') +conf.set_quoted('SYSTEMD_BINARY_PATH', rootlibexecdir / 'systemd') conf.set_quoted('SYSTEMD_CATALOG_DIR', catalogdir) -conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', join_paths(rootlibexecdir, 'systemd-cgroups-agent')) -conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', join_paths(rootlibexecdir, 'systemd-cryptsetup')) -conf.set_quoted('SYSTEMD_EXPORT_PATH', join_paths(rootlibexecdir, 'systemd-export')) -conf.set_quoted('SYSTEMD_FSCK_PATH', join_paths(rootlibexecdir, 'systemd-fsck')) -conf.set_quoted('SYSTEMD_GROWFS_PATH', join_paths(rootlibexecdir, 'systemd-growfs')) -conf.set_quoted('SYSTEMD_HOMEWORK_PATH', join_paths(rootlibexecdir, 'systemd-homework')) -conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', join_paths(rootlibexecdir, 'systemd-import-fs')) -conf.set_quoted('SYSTEMD_IMPORT_PATH', join_paths(rootlibexecdir, 'systemd-import')) -conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', join_paths(pkgdatadir, 'kbd-model-map')) -conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', join_paths(pkgdatadir, 'language-fallback-map')) -conf.set_quoted('SYSTEMD_MAKEFS_PATH', join_paths(rootlibexecdir, 'systemd-makefs')) -conf.set_quoted('SYSTEMD_PULL_PATH', join_paths(rootlibexecdir, 'systemd-pull')) -conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', join_paths(rootlibexecdir, 'systemd-shutdown')) -conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', join_paths(bindir, 'systemd-stdio-bridge')) -conf.set_quoted('SYSTEMD_TEST_DATA', join_paths(testsdir, 'testdata')) -conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', join_paths(rootbindir, 'systemd-tty-ask-password-agent')) -conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', join_paths(rootlibexecdir, 'systemd-update-helper')) -conf.set_quoted('SYSTEMD_USERWORK_PATH', join_paths(rootlibexecdir, 'systemd-userwork')) -conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', join_paths(rootlibexecdir, 'systemd-veritysetup')) -conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'system')) +conf.set_quoted('SYSTEMD_CGROUPS_AGENT_PATH', rootlibexecdir / 'systemd-cgroups-agent') +conf.set_quoted('SYSTEMD_CRYPTSETUP_PATH', rootlibexecdir / 'systemd-cryptsetup') +conf.set_quoted('SYSTEMD_EXPORT_PATH', rootlibexecdir / 'systemd-export') +conf.set_quoted('SYSTEMD_FSCK_PATH', rootlibexecdir / 'systemd-fsck') +conf.set_quoted('SYSTEMD_GROWFS_PATH', rootlibexecdir / 'systemd-growfs') +conf.set_quoted('SYSTEMD_HOMEWORK_PATH', rootlibexecdir / 'systemd-homework') +conf.set_quoted('SYSTEMD_IMPORT_FS_PATH', rootlibexecdir / 'systemd-import-fs') +conf.set_quoted('SYSTEMD_IMPORT_PATH', rootlibexecdir / 'systemd-import') +conf.set_quoted('SYSTEMD_KBD_MODEL_MAP', pkgdatadir / 'kbd-model-map') +conf.set_quoted('SYSTEMD_LANGUAGE_FALLBACK_MAP', pkgdatadir / 'language-fallback-map') +conf.set_quoted('SYSTEMD_MAKEFS_PATH', rootlibexecdir / 'systemd-makefs') +conf.set_quoted('SYSTEMD_PULL_PATH', rootlibexecdir / 'systemd-pull') +conf.set_quoted('SYSTEMD_SHUTDOWN_BINARY_PATH', rootlibexecdir / 'systemd-shutdown') +conf.set_quoted('SYSTEMD_STDIO_BRIDGE_BINARY_PATH', bindir / 'systemd-stdio-bridge') +conf.set_quoted('SYSTEMD_TEST_DATA', testsdir / 'testdata') +conf.set_quoted('SYSTEMD_TTY_ASK_PASSWORD_AGENT_BINARY_PATH', rootbindir / 'systemd-tty-ask-password-agent') +conf.set_quoted('SYSTEMD_UPDATE_HELPER_PATH', rootlibexecdir / 'systemd-update-helper') +conf.set_quoted('SYSTEMD_USERWORK_PATH', rootlibexecdir / 'systemd-userwork') +conf.set_quoted('SYSTEMD_VERITYSETUP_PATH', rootlibexecdir / 'systemd-veritysetup') +conf.set_quoted('SYSTEM_CONFIG_UNIT_DIR', pkgsysconfdir / 'system') conf.set_quoted('SYSTEM_DATA_UNIT_DIR', systemunitdir) conf.set_quoted('SYSTEM_ENV_GENERATOR_DIR', systemenvgeneratordir) conf.set_quoted('SYSTEM_GENERATOR_DIR', systemgeneratordir) @@ -278,13 +278,13 @@ conf.set_quoted('UDEVLIBEXECDIR', udevlibexecdir) conf.set_quoted('UDEV_HWDB_DIR', udevhwdbdir) conf.set_quoted('UDEV_RULES_DIR', udevrulesdir) conf.set_quoted('UPDATE_HELPER_USER_TIMEOUT', get_option('update-helper-user-timeout')) -conf.set_quoted('USER_CONFIG_UNIT_DIR', join_paths(pkgsysconfdir, 'user')) +conf.set_quoted('USER_CONFIG_UNIT_DIR', pkgsysconfdir / 'user') conf.set_quoted('USER_DATA_UNIT_DIR', userunitdir) conf.set_quoted('USER_ENV_GENERATOR_DIR', userenvgeneratordir) conf.set_quoted('USER_GENERATOR_DIR', usergeneratordir) -conf.set_quoted('USER_KEYRING_PATH', join_paths(pkgsysconfdir, 'import-pubring.gpg')) +conf.set_quoted('USER_KEYRING_PATH', pkgsysconfdir / 'import-pubring.gpg') conf.set_quoted('USER_PRESET_DIR', userpresetdir) -conf.set_quoted('VENDOR_KEYRING_PATH', join_paths(rootlibexecdir, 'import-pubring.gpg')) +conf.set_quoted('VENDOR_KEYRING_PATH', rootlibexecdir / 'import-pubring.gpg') conf.set('ANSI_OK_COLOR', 'ANSI_' + get_option('ok-color').underscorify().to_upper()) conf.set10('ENABLE_URLIFY', get_option('urlify')) @@ -1857,7 +1857,7 @@ foreach tuple : [['myhostname', 'ENABLE_NSS_MYHOSTNAME'], module = tuple[0] sym = 'src/nss-@0@/nss-@0@.sym'.format(module) - version_script_arg = join_paths(project_source_root, sym) + version_script_arg = project_source_root / sym sources = ['src/nss-@0@/nss-@0@.c'.format(module)] if tuple.length() > 2 @@ -1922,8 +1922,8 @@ executable( install_dir : rootlibexecdir) meson.add_install_script(meson_make_symlink, - join_paths(rootlibexecdir, 'systemd'), - join_paths(rootsbindir, 'init')) + rootlibexecdir / 'systemd', + rootsbindir / 'init') public_programs += executable( 'systemd-analyze', @@ -2028,8 +2028,8 @@ if conf.get('ENABLE_ENVIRONMENT_D') == 1 install_dir : userenvgeneratordir) meson.add_install_script(meson_make_symlink, - join_paths(sysconfdir, 'environment'), - join_paths(environmentdir, '99-environment.conf')) + sysconfdir / 'environment', + environmentdir / '99-environment.conf') endif if conf.get('ENABLE_HIBERNATE') == 1 @@ -2100,12 +2100,12 @@ if conf.get('ENABLE_RESOLVE') == 1 install : true) meson.add_install_script(meson_make_symlink, - join_paths(bindir, 'resolvectl'), - join_paths(rootsbindir, 'resolvconf')) + bindir / 'resolvectl', + rootsbindir / 'resolvconf') meson.add_install_script(meson_make_symlink, - join_paths(bindir, 'resolvectl'), - join_paths(bindir, 'systemd-resolve')) + bindir / 'resolvectl', + bindir / 'systemd-resolve') endif if conf.get('ENABLE_LOGIND') == 1 @@ -2144,7 +2144,7 @@ if conf.get('ENABLE_LOGIND') == 1 install_dir : rootbindir) if conf.get('HAVE_PAM') == 1 - version_script_arg = join_paths(project_source_root, pam_systemd_sym) + version_script_arg = project_source_root / pam_systemd_sym pam_systemd = shared_library( 'pam_systemd', pam_systemd_c, @@ -2362,7 +2362,7 @@ if conf.get('ENABLE_HOMED') == 1 install_dir : rootbindir) if conf.get('HAVE_PAM') == 1 - version_script_arg = join_paths(project_source_root, pam_systemd_home_sym) + version_script_arg = project_source_root / pam_systemd_home_sym pam_systemd = shared_library( 'pam_systemd_home', pam_systemd_home_c, @@ -2385,13 +2385,13 @@ endif foreach alias : (['halt', 'poweroff', 'reboot', 'shutdown'] + (conf.get('HAVE_SYSV_COMPAT') == 1 ? ['runlevel', 'telinit'] : [])) meson.add_install_script(meson_make_symlink, - join_paths(rootbindir, 'systemctl'), - join_paths(rootsbindir, alias)) + rootbindir / 'systemctl', + rootsbindir / alias) endforeach meson.add_install_script(meson_make_symlink, - join_paths(rootbindir, 'udevadm'), - join_paths(rootlibexecdir, 'systemd-udevd')) + rootbindir / 'udevadm', + rootlibexecdir / 'systemd-udevd') if conf.get('ENABLE_BACKLIGHT') == 1 executable( @@ -2828,7 +2828,7 @@ if conf.get('ENABLE_BINFMT') == 1 mkdir_p.format(binfmtdir)) if install_sysconfdir meson.add_install_script('sh', '-c', - mkdir_p.format(join_paths(sysconfdir, 'binfmt.d'))) + mkdir_p.format(sysconfdir / 'binfmt.d')) endif endif @@ -3105,7 +3105,7 @@ public_programs += executable( install : true) meson.add_install_script(meson_make_symlink, - 'systemd-mount', join_paths(bindir, 'systemd-umount')) + 'systemd-mount', bindir / 'systemd-umount') public_programs += executable( 'systemd-run', @@ -3307,7 +3307,7 @@ if conf.get('HAVE_KMOD') == 1 mkdir_p.format(modulesloaddir)) if install_sysconfdir meson.add_install_script('sh', '-c', - mkdir_p.format(join_paths(sysconfdir, 'modules-load.d'))) + mkdir_p.format(sysconfdir / 'modules-load.d')) endif endif @@ -3387,8 +3387,8 @@ custom_target( output : 'systemd-runtest.env', command : [sh, '-c', '{ echo SYSTEMD_TEST_DATA=@0@; echo SYSTEMD_CATALOG_DIR=@1@; } >@OUTPUT@'.format( - join_paths(project_source_root, 'test'), - join_paths(project_build_root, 'catalog'))], + project_source_root / 'test', + project_build_root / 'catalog')], build_by_default : true) test_cflags = ['-DTEST_CODE=1'] @@ -3430,7 +3430,7 @@ foreach tuple : tests build_by_default : want_tests != 'false', install_rpath : rootlibexecdir, install : install_tests, - install_dir : join_paths(testsdir, type)) + install_dir : testsdir / type) if type == 'manual' message('@0@ is a manual test'.format(name)) @@ -3546,7 +3546,7 @@ foreach tuple : fuzzers if b == name test('@0@_@1@'.format(b, c), exe, - args : [join_paths(project_source_root, p)]) + args : [project_source_root / p]) endif endforeach endif @@ -3608,8 +3608,8 @@ if get_option('mode') == 'developer' and want_tests != 'false' and jekyll.found( test('github-pages', jekyll, args : ['build', - '--source', join_paths(project_source_root, 'docs'), - '--destination', join_paths(project_build_root, '_site')]) + '--source', project_source_root / 'docs', + '--destination', project_build_root / '_site']) endif ############################################################ @@ -3659,7 +3659,7 @@ foreach tuple : sanitizers output : name, depends : build, command : [ln, '-fs', - join_paths(build.full_path(), b), + build.full_path() / b, '@OUTPUT@'], build_by_default : true) else @@ -3674,7 +3674,7 @@ foreach tuple : sanitizers env : ['UBSAN_OPTIONS=print_stacktrace=1:print_summary=1:halt_on_error=1'], timeout : 60, args : [exe.full_path(), - join_paths(project_source_root, p)]) + project_source_root / p]) endif endforeach endif diff --git a/network/meson.build b/network/meson.build index b0e60f7217..ccfd79e8da 100644 --- a/network/meson.build +++ b/network/meson.build @@ -12,7 +12,7 @@ if conf.get('ENABLE_NETWORKD') == 1 if install_sysconfdir meson.add_install_script('sh', '-c', - mkdir_p.format(join_paths(sysconfdir, 'systemd/network'))) + mkdir_p.format(sysconfdir / 'systemd/network')) endif endif diff --git a/shell-completion/bash/meson.build b/shell-completion/bash/meson.build index c26b413d92..0946bc5b54 100644 --- a/shell-completion/bash/meson.build +++ b/shell-completion/bash/meson.build @@ -6,7 +6,7 @@ if bashcompletiondir == '' if bash_completion.found() bashcompletiondir = bash_completion.get_pkgconfig_variable('completionsdir') else - bashcompletiondir = join_paths(datadir, 'bash-completion/completions') + bashcompletiondir = datadir / 'bash-completion/completions' endif endif diff --git a/shell-completion/zsh/meson.build b/shell-completion/zsh/meson.build index f5f9b0f993..ce3a304d45 100644 --- a/shell-completion/zsh/meson.build +++ b/shell-completion/zsh/meson.build @@ -2,7 +2,7 @@ zshcompletiondir = get_option('zshcompletiondir') if zshcompletiondir == '' - zshcompletiondir = join_paths(datadir, 'zsh/site-functions') + zshcompletiondir = datadir / 'zsh/site-functions' endif custom_target( diff --git a/src/boot/efi/meson.build b/src/boot/efi/meson.build index 62d826bec6..0a96a72d6e 100644 --- a/src/boot/efi/meson.build +++ b/src/boot/efi/meson.build @@ -71,14 +71,14 @@ if conf.get('ENABLE_EFI') == 1 and get_option('gnu-efi') != 'false' efi_libdir = get_option('efi-libdir') if efi_libdir == '' # New location first introduced with gnu-efi 3.0.11 - efi_libdir = join_paths('/usr/lib/gnuefi', EFI_MACHINE_TYPE_NAME) + efi_libdir = '/usr/lib/gnuefi' / EFI_MACHINE_TYPE_NAME cmd = run_command(test, '-e', efi_libdir) if cmd.returncode() != 0 # Fall back to the old approach cmd = run_command(efi_cc + ['-print-multi-os-directory']) if cmd.returncode() == 0 - path = join_paths('/usr/lib', cmd.stdout().strip()) + path = '/usr/lib' / cmd.stdout().strip() cmd = run_command(env, 'realpath', '-e', path) if cmd.returncode() == 0 efi_libdir = cmd.stdout().strip() @@ -148,13 +148,13 @@ if have_gnu_efi efi_location_map = [ # New locations first introduced with gnu-efi 3.0.11 - [join_paths(efi_libdir, 'efi.lds'), - join_paths(efi_libdir, 'crt0.o')], + [efi_libdir / 'efi.lds', + efi_libdir / 'crt0.o'], # Older locations... - [join_paths(efi_libdir, 'gnuefi', 'elf_@0@_efi.lds'.format(gnu_efi_path_arch)), - join_paths(efi_libdir, 'gnuefi', 'crt0-efi-@0@.o'.format(gnu_efi_path_arch))], - [join_paths(efi_libdir, 'elf_@0@_efi.lds'.format(gnu_efi_path_arch)), - join_paths(efi_libdir, 'crt0-efi-@0@.o'.format(gnu_efi_path_arch))]] + [efi_libdir / 'gnuefi' / 'elf_@0@_efi.lds'.format(gnu_efi_path_arch), + efi_libdir / 'gnuefi' / 'crt0-efi-@0@.o'.format(gnu_efi_path_arch)], + [efi_libdir / 'elf_@0@_efi.lds'.format(gnu_efi_path_arch), + efi_libdir / 'crt0-efi-@0@.o'.format(gnu_efi_path_arch)]] efi_lds = '' foreach location : efi_location_map if efi_lds == '' @@ -191,7 +191,7 @@ if have_gnu_efi '-nostdlib', '-std=gnu99', '-isystem', efi_incdir, - '-isystem', join_paths(efi_incdir, gnu_efi_path_arch), + '-isystem', efi_incdir / gnu_efi_path_arch, '-I', fundamental_path, '-DSD_BOOT', '-include', efi_config_h, diff --git a/src/core/meson.build b/src/core/meson.build index 1c364a53e2..1941081972 100644 --- a/src/core/meson.build +++ b/src/core/meson.build @@ -210,9 +210,9 @@ meson.add_install_script('sh', '-c', mkdir_p.format(systemgeneratordir)) meson.add_install_script('sh', '-c', mkdir_p.format(usergeneratordir)) if install_sysconfdir - meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'system'))) - meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(pkgsysconfdir, 'user'))) - meson.add_install_script('sh', '-c', mkdir_p.format(join_paths(sysconfdir, 'xdg/systemd'))) + meson.add_install_script('sh', '-c', mkdir_p.format(pkgsysconfdir / 'system')) + meson.add_install_script('sh', '-c', mkdir_p.format(pkgsysconfdir / 'user')) + meson.add_install_script('sh', '-c', mkdir_p.format(sysconfdir / 'xdg/systemd')) endif ############################################################ diff --git a/src/cryptsetup/cryptsetup-tokens/meson.build b/src/cryptsetup/cryptsetup-tokens/meson.build index 61c879c768..8061997205 100644 --- a/src/cryptsetup/cryptsetup-tokens/meson.build +++ b/src/cryptsetup/cryptsetup-tokens/meson.build @@ -5,7 +5,7 @@ if conf.get('HAVE_LIBCRYPTSETUP_PLUGINS') == 1 cryptsetup_token_c_args = ['-fvisibility=hidden'] cryptsetup_token_sym = files('cryptsetup-token.sym') -cryptsetup_token_sym_path = join_paths(meson.current_source_dir(), 'cryptsetup-token.sym') +cryptsetup_token_sym_path = meson.current_source_dir() / 'cryptsetup-token.sym' if conf.get('HAVE_TPM2') == 1 cryptsetup_token_systemd_tpm2_sources = files(''' diff --git a/src/fundamental/meson.build b/src/fundamental/meson.build index 40b9ab8e2c..3c43081cf6 100644 --- a/src/fundamental/meson.build +++ b/src/fundamental/meson.build @@ -14,8 +14,8 @@ sources = ''' # for sd-boot fundamental_source_paths = [] -foreach s : sources - fundamental_source_paths += join_paths(meson.current_source_dir(), s) +foreach source : sources + fundamental_source_paths += meson.current_source_dir() / source endforeach # for libbasic diff --git a/src/journal-remote/meson.build b/src/journal-remote/meson.build index d516fbabf7..5670d55ec5 100644 --- a/src/journal-remote/meson.build +++ b/src/journal-remote/meson.build @@ -62,7 +62,7 @@ endforeach if conf.get('ENABLE_REMOTE') == 1 and conf.get('HAVE_MICROHTTPD') == 1 install_data('browse.html', - install_dir : join_paths(pkgdatadir, 'gatewayd')) + install_dir : pkgdatadir / 'gatewayd') if get_option('create-log-dirs') meson.add_install_script('sh', '-c', diff --git a/src/kernel-install/meson.build b/src/kernel-install/meson.build index 4117188f14..893832461e 100644 --- a/src/kernel-install/meson.build +++ b/src/kernel-install/meson.build @@ -15,7 +15,7 @@ if want_kernel_install if install_sysconfdir meson.add_install_script('sh', '-c', - mkdir_p.format(join_paths(sysconfdir, 'kernel/install.d'))) + mkdir_p.format(sysconfdir / 'kernel/install.d')) endif endif diff --git a/src/libsystemd/meson.build b/src/libsystemd/meson.build index 154d9acd2a..479b81b352 100644 --- a/src/libsystemd/meson.build +++ b/src/libsystemd/meson.build @@ -171,7 +171,7 @@ libsystemd_static = static_library( c_args : libsystemd_c_args) libsystemd_sym = files('libsystemd.sym') -libsystemd_sym_path = join_paths(meson.current_source_dir(), 'libsystemd.sym') +libsystemd_sym_path = meson.current_source_dir() / 'libsystemd.sym' static_libsystemd = get_option('static-libsystemd') static_libsystemd_pic = static_libsystemd == 'true' or static_libsystemd == 'pic' diff --git a/src/libudev/meson.build b/src/libudev/meson.build index 61e7cc20a6..130374d14f 100644 --- a/src/libudev/meson.build +++ b/src/libudev/meson.build @@ -19,10 +19,10 @@ libudev_sources = files( libudev_includes = [includes, include_directories('.')] libudev_sym = files('libudev.sym') -libudev_sym_path = join_paths(meson.current_source_dir(), 'libudev.sym') +libudev_sym_path = meson.current_source_dir() / 'libudev.sym' install_headers('libudev.h') -libudev_h_path = join_paths(meson.current_source_dir(), 'libudev.h') +libudev_h_path = meson.current_source_dir() / 'libudev.h' libudev_basic = static_library( 'udev-basic', diff --git a/src/locale/meson.build b/src/locale/meson.build index 757d4457e9..a2ff2a9873 100644 --- a/src/locale/meson.build +++ b/src/locale/meson.build @@ -20,8 +20,8 @@ endif # If you know a way that allows the same variables to be used # in sources list and concatenated to a string for test_env, # let me know. -kbd_model_map = join_paths(meson.current_source_dir(), 'kbd-model-map') -language_fallback_map = join_paths(meson.current_source_dir(), 'language-fallback-map') +kbd_model_map = meson.current_source_dir() / 'kbd-model-map' +language_fallback_map = meson.current_source_dir() / 'language-fallback-map' if conf.get('ENABLE_LOCALED') == 1 install_data('kbd-model-map', diff --git a/src/portable/meson.build b/src/portable/meson.build index 8f866f57e4..de82f5bff7 100644 --- a/src/portable/meson.build +++ b/src/portable/meson.build @@ -22,8 +22,8 @@ if conf.get('ENABLE_PORTABLED') == 1 install_data('org.freedesktop.portable1.policy', install_dir : polkitpolicydir) - install_data('profile/default/service.conf', install_dir : join_paths(profiledir, 'default')) - install_data('profile/nonetwork/service.conf', install_dir : join_paths(profiledir, 'nonetwork')) - install_data('profile/strict/service.conf', install_dir : join_paths(profiledir, 'strict')) - install_data('profile/trusted/service.conf', install_dir : join_paths(profiledir, 'trusted')) + install_data('profile/default/service.conf', install_dir : profiledir / 'default') + install_data('profile/nonetwork/service.conf', install_dir : profiledir / 'nonetwork') + install_data('profile/strict/service.conf', install_dir : profiledir / 'strict') + install_data('profile/trusted/service.conf', install_dir : profiledir / 'trusted') endif diff --git a/src/systemd/meson.build b/src/systemd/meson.build index e01281f454..6cae6a5767 100644 --- a/src/systemd/meson.build +++ b/src/systemd/meson.build @@ -77,7 +77,7 @@ foreach header : _systemd_headers + _not_installed_headers + [libudev_h_path] check_compilation_sh, args : cc.cmd_array() + ['-c', '-x'] + opt + ['-Werror', '-include', - join_paths(meson.current_source_dir(), header)]) + meson.current_source_dir() / header]) endif endforeach endforeach diff --git a/src/udev/meson.build b/src/udev/meson.build index 0527403398..87bb341a56 100644 --- a/src/udev/meson.build +++ b/src/udev/meson.build @@ -153,7 +153,7 @@ endforeach if install_sysconfdir_samples install_data('udev.conf', - install_dir : join_paths(sysconfdir, 'udev')) + install_dir : sysconfdir / 'udev') endif custom_target( @@ -167,7 +167,7 @@ custom_target( if install_sysconfdir meson.add_install_script('sh', '-c', - mkdir_p.format(join_paths(sysconfdir, 'udev/rules.d'))) + mkdir_p.format(sysconfdir / 'udev/rules.d')) endif fuzzers += [ diff --git a/sysctl.d/meson.build b/sysctl.d/meson.build index 6f3db59554..b058f9364b 100644 --- a/sysctl.d/meson.build +++ b/sysctl.d/meson.build @@ -23,5 +23,5 @@ custom_target( if install_sysconfdir meson.add_install_script('sh', '-c', - mkdir_p.format(join_paths(sysconfdir, 'sysctl.d'))) + mkdir_p.format(sysconfdir / 'sysctl.d')) endif diff --git a/test/meson.build b/test/meson.build index c39d2ab7ac..a21230a4a8 100644 --- a/test/meson.build +++ b/test/meson.build @@ -140,7 +140,7 @@ if want_tests != 'false' and dmi_arches.contains(host_machine.cpu_family()) endif foreach p : out.stdout().split() - source = join_paths(project_source_root, p) + source = project_source_root / p name = 'dmidecode_' + p.split('/')[-1].split('.')[0] test(name, diff --git a/tmpfiles.d/meson.build b/tmpfiles.d/meson.build index e0e339cd42..de36f5743d 100644 --- a/tmpfiles.d/meson.build +++ b/tmpfiles.d/meson.build @@ -52,6 +52,5 @@ endforeach if enable_tmpfiles and install_sysconfdir meson.add_install_script( - 'sh', '-c', - mkdir_p.format(join_paths(sysconfdir, 'tmpfiles.d'))) + 'sh', '-c', mkdir_p.format(sysconfdir / 'tmpfiles.d')) endif diff --git a/units/meson.build b/units/meson.build index 17e9ead9c1..64da9efaaf 100644 --- a/units/meson.build +++ b/units/meson.build @@ -307,17 +307,17 @@ install_data('user-.slice.d/10-defaults.conf', if install_sysconfdir meson.add_install_script(meson_make_symlink, - join_paths(pkgsysconfdir, 'user'), - join_paths(sysconfdir, 'xdg/systemd/user')) + pkgsysconfdir / 'user', + sysconfdir / 'xdg/systemd/user') endif meson.add_install_script(meson_make_symlink, - join_paths(dbussystemservicedir, 'org.freedesktop.systemd1.service'), - join_paths(dbussessionservicedir, 'org.freedesktop.systemd1.service')) + dbussystemservicedir / 'org.freedesktop.systemd1.service', + dbussessionservicedir / 'org.freedesktop.systemd1.service') if conf.get('HAVE_SYSV_COMPAT') == 1 foreach i : [1, 2, 3, 4, 5] meson.add_install_script( 'sh', '-c', - mkdir_p.format(join_paths(systemunitdir, 'runlevel@0@.target.wants'.format(i)))) + mkdir_p.format(systemunitdir / 'runlevel@0@.target.wants'.format(i))) endforeach endif From 6839ce3318dc200c42d43ea06ecd94cb118b3c00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 27 Jul 2021 19:58:55 +0200 Subject: [PATCH 2/4] meson: use alias_target in one place It was added in meson 0.52.0, and fits very nicely here. See https://mesonbuild.com/Release-notes-for-0-52-0.html#alias_target. --- meson.build | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/meson.build b/meson.build index e3b2b816c2..e9a506e163 100644 --- a/meson.build +++ b/meson.build @@ -3552,10 +3552,7 @@ foreach tuple : fuzzers endif endforeach -run_target( - 'fuzzers', - depends : fuzzer_exes, - command : ['true']) +alias_target('fuzzers', fuzzer_exes) ############################################################ From f12c5d36a9a162f833987b03fbf0b65248581cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 27 Jul 2021 20:11:41 +0200 Subject: [PATCH 3/4] meson: use alias_target for doc update commands This undoes part of 4c890ad3cc7b3445683d7b52bc00e4a58bef5e94: the implementations of update-dbus-docs and update-man-rules are moved back to man/meson.build, and alias_target() is used to keep the visible target names unchanged. The rules for man pages are reworked so that it's possible to invoke the targets even if xstlproc is not available. After all, xsltproc is only needed for the final formatted output, and not other processing. --- man/meson.build | 98 ++++++++++++++++++++++++++++++------------------- meson.build | 29 +-------------- 2 files changed, 63 insertions(+), 64 deletions(-) diff --git a/man/meson.build b/man/meson.build index bb00b6e3dd..4132f826a8 100644 --- a/man/meson.build +++ b/man/meson.build @@ -37,7 +37,7 @@ man_pages = [] html_pages = [] source_xml_files = [] dbus_docs = [] -foreach tuple : xsltproc.found() ? manpages : [] +foreach tuple : manpages stem = tuple[0] section = tuple[1] aliases = tuple[2] @@ -57,46 +57,47 @@ foreach tuple : xsltproc.found() ? manpages : [] mandirn = get_option('mandir') / ('man' + section) if condition == '' or conf.get(condition) == 1 - p1 = custom_target( - man, - input : xml, - output : [man] + manaliases, - command : xslt_cmd + [custom_man_xsl, '@INPUT@'], - depends : custom_entities_ent, - install : want_man, - install_dir : mandirn) - man_pages += p1 - - p2 = [] - foreach htmlalias : htmlaliases - link = custom_target( - htmlalias, - output : htmlalias, - command : [ln, '-fs', html, '@OUTPUT@']) - if want_html - dst = docdir / 'html' / htmlalias - cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst) - meson.add_install_script('sh', '-c', cmd) - p2 += link - endif - html_pages += link - endforeach - - p3 = custom_target( - html, - input : xml, - output : html, - command : xslt_cmd + [custom_html_xsl, '@INPUT@'], - depends : [custom_entities_ent, p2], - install : want_html, - install_dir : docdir / 'html') - html_pages += p3 - file = files(tuple[0] + '.xml') - source_xml_files += file if tuple[0].startswith('org.freedesktop.') dbus_docs += file endif + + if xsltproc.found() + p1 = custom_target( + man, + input : xml, + output : [man] + manaliases, + command : xslt_cmd + [custom_man_xsl, '@INPUT@'], + depends : custom_entities_ent, + install : want_man, + install_dir : mandirn) + man_pages += p1 + + p2 = [] + foreach htmlalias : htmlaliases + link = custom_target( + htmlalias, + output : htmlalias, + command : [ln, '-fs', html, '@OUTPUT@']) + if want_html + dst = docdir / 'html' / htmlalias + cmd = 'ln -fs @0@ $DESTDIR@1@'.format(html, dst) + meson.add_install_script('sh', '-c', cmd) + p2 += link + endif + html_pages += link + endforeach + + p3 = custom_target( + html, + input : xml, + output : html, + command : xslt_cmd + [custom_html_xsl, '@INPUT@'], + depends : [custom_entities_ent, p2], + install : want_html, + install_dir : docdir / 'html') + html_pages += p3 + endif else message('Skipping @0@.@1@ because @2@ is false'.format(stem, section, condition)) endif @@ -213,3 +214,26 @@ configure_file( input : 'html.in', output : 'html', configuration : buildroot_substs) + +############################################################ + +update_dbus_docs = custom_target( + 'update-dbus-docs', + output : 'update-dbus-docs', + command : [update_dbus_docs_py, '--build-dir', project_build_root, '@INPUT@'], + input : dbus_docs) + +if conf.get('BUILD_MODE_DEVELOPER') == 1 + test('dbus-docs-fresh', + update_dbus_docs_py, + args : ['--build-dir', project_build_root, '--test', dbus_docs]) +endif + +update_man_rules = custom_target( + 'update-man-rules', + output : 'update-man-rules', + command : [sh, '-c', + 'cd @0@ && '.format(project_build_root) + + 'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) + + 'mv t @0@/rules/meson.build'.format(meson.current_source_dir())], + depends : custom_entities_ent) diff --git a/meson.build b/meson.build index e9a506e163..ad336c60ea 100644 --- a/meson.build +++ b/meson.build @@ -3731,33 +3731,8 @@ run_target( depends : [man, libsystemd, libudev], command : [check_api_docs_sh, libsystemd.full_path(), libudev.full_path()]) -############################################################ - -if dbus_docs.length() > 0 - custom_target( - 'update-dbus-docs', - output : 'update-dbus-docs', - command : [update_dbus_docs_py, - '--build-dir=@0@'.format(project_build_root), - '@INPUT@'], - input : dbus_docs) - - if conf.get('BUILD_MODE_DEVELOPER') == 1 - test('dbus-docs-fresh', - update_dbus_docs_py, - args : ['--build-dir=@0@'.format(project_build_root), - '--test'] + dbus_docs) - endif -endif - -custom_target( - 'update-man-rules', - output : 'update-man-rules', - command : [sh, '-c', - 'cd @0@ && '.format(meson.build_root()) + - 'python3 @0@/tools/update-man-rules.py $(find @0@ -wholename "*/man/*.xml") >t && '.format(project_source_root) + - 'mv t @0@/man/rules/meson.build'.format(meson.current_source_dir())], - depends : custom_entities_ent) +alias_target('update-dbus-docs', update_dbus_docs) +alias_target('update-man-rules', update_man_rules) ############################################################ watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog From 12085ebb406ddc2ba18ee458c168f9204ec86d42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 28 Jul 2021 10:04:01 +0200 Subject: [PATCH 4/4] meson: use meson's summary() The output is similar to our hand-crafted status message, but it's nice to use the built-in functionality. After all, it was amended during development to support our use case. --- meson.build | 144 ++++++++++++++++++++++++---------------------------- 1 file changed, 67 insertions(+), 77 deletions(-) diff --git a/meson.build b/meson.build index ad336c60ea..33107d2423 100644 --- a/meson.build +++ b/meson.build @@ -3735,72 +3735,63 @@ alias_target('update-dbus-docs', update_dbus_docs) alias_target('update-man-rules', update_man_rules) ############################################################ -watchdog_opt = service_watchdog == '' ? 'disabled' : service_watchdog - -status = [ - '@0@ @1@'.format(meson.project_name(), meson.project_version()), - - 'build mode: @0@'.format(get_option('mode')), - 'split /usr: @0@'.format(split_usr), - 'split bin-sbin: @0@'.format(split_bin), - 'prefix directory: @0@'.format(prefixdir), - 'rootprefix directory: @0@'.format(rootprefixdir), - 'sysconf directory: @0@'.format(sysconfdir), - 'include directory: @0@'.format(includedir), - 'lib directory: @0@'.format(libdir), - 'rootlib directory: @0@'.format(rootlibdir), - 'SysV init scripts: @0@'.format(sysvinit_path), - 'SysV rc?.d directories: @0@'.format(sysvrcnd_path), - 'PAM modules directory: @0@'.format(pamlibdir), - 'PAM configuration directory: @0@'.format(pamconfdir), - 'libcryptsetup plugins directory: @0@'.format(libcryptsetup_plugins_dir), - 'RPM macros directory: @0@'.format(rpmmacrosdir), - 'modprobe.d directory: @0@'.format(modprobedir), - 'D-Bus policy directory: @0@'.format(dbuspolicydir), - 'D-Bus session directory: @0@'.format(dbussessionservicedir), - 'D-Bus system directory: @0@'.format(dbussystemservicedir), - 'bash completions directory: @0@'.format(bashcompletiondir), - 'zsh completions directory: @0@'.format(zshcompletiondir), - 'extra start script: @0@'.format(get_option('rc-local')), - 'debug shell: @0@ @ @1@'.format(get_option('debug-shell'), - get_option('debug-tty')), - 'system UIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'), - conf.get('SYSTEM_ALLOC_UID_MIN')), - 'system GIDs: <=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'), - conf.get('SYSTEM_ALLOC_GID_MIN')), - 'dynamic UIDs: @0@…@1@'.format(dynamic_uid_min, dynamic_uid_max), - 'container UID bases: @0@…@1@'.format(container_uid_base_min, container_uid_base_max), - 'static UID/GID allocations: @0@'.format(' '.join(static_ugids)), - '/dev/kvm access mode: @0@'.format(get_option('dev-kvm-mode')), - 'render group access mode: @0@'.format(get_option('group-render-mode')), - 'certificate root directory: @0@'.format(get_option('certificate-root')), - 'support URL: @0@'.format(support_url), - 'nobody user name: @0@'.format(nobody_user), - 'nobody group name: @0@'.format(nobody_group), - 'fallback hostname: @0@'.format(get_option('fallback-hostname')), - - 'default DNSSEC mode: @0@'.format(default_dnssec), - 'default DNS-over-TLS mode: @0@'.format(default_dns_over_tls), - 'default mDNS mode: @0@'.format(default_mdns), - 'default LLMNR mode: @0@'.format(default_llmnr), - 'default cgroup hierarchy: @0@'.format(default_hierarchy), - '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 != '' ? default_user_path : '(same as system services)'), - 'systemd service watchdog: @0@'.format(watchdog_opt)] - -alt_dns_servers = '\n '.join(dns_servers.split(' ')) -alt_ntp_servers = '\n '.join(ntp_servers.split(' ')) -status += [ - 'default DNS servers: @0@'.format(alt_dns_servers), - 'default NTP servers: @0@'.format(alt_ntp_servers)] alt_time_epoch = run_command('date', '-Is', '-u', '-d', '@@0@'.format(time_epoch)).stdout().strip() -status += [ - 'time epoch: @0@ (@1@)'.format(time_epoch, alt_time_epoch)] + +summary({ + 'build mode' : get_option('mode'), + 'split /usr' : split_usr, + 'split bin-sbin' : split_bin, + 'prefix directory' : prefixdir, + 'rootprefix directory' : rootprefixdir, + 'sysconf directory' : sysconfdir, + 'include directory' : includedir, + 'lib directory' : libdir, + 'rootlib directory' : rootlibdir, + 'SysV init scripts' : sysvinit_path, + 'SysV rc?.d directories' : sysvrcnd_path, + 'PAM modules directory' : pamlibdir, + 'PAM configuration directory' : pamconfdir, + 'libcryptsetup plugins directory' : libcryptsetup_plugins_dir, + 'RPM macros directory' : rpmmacrosdir, + 'modprobe.d directory' : modprobedir, + 'D-Bus policy directory' : dbuspolicydir, + 'D-Bus session directory' : dbussessionservicedir, + 'D-Bus system directory' : dbussystemservicedir, + 'bash completions directory' : bashcompletiondir, + 'zsh completions directory' : zshcompletiondir, + 'extra start script' : get_option('rc-local'), + 'debug shell' : '@0@ @ @1@'.format(get_option('debug-shell'), + get_option('debug-tty')), + 'system UIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_UID_MAX'), + conf.get('SYSTEM_ALLOC_UID_MIN')), + 'system GIDs' : '<=@0@ (alloc >=@1@)'.format(conf.get('SYSTEM_GID_MAX'), + conf.get('SYSTEM_ALLOC_GID_MIN')), + 'dynamic UIDs' : '@0@…@1@'.format(dynamic_uid_min, dynamic_uid_max), + 'container UID bases' : '@0@…@1@'.format(container_uid_base_min, container_uid_base_max), + 'static UID/GID allocations' : ' '.join(static_ugids), + '/dev/kvm access mode' : get_option('dev-kvm-mode'), + 'render group access mode' : get_option('group-render-mode'), + 'certificate root directory' : get_option('certificate-root'), + 'support URL' : support_url, + 'nobody user name' : nobody_user, + 'nobody group name' : nobody_group, + 'fallback hostname' : get_option('fallback-hostname'), + 'default DNSSEC mode' : default_dnssec, + 'default DNS-over-TLS mode' : default_dns_over_tls, + 'default mDNS mode' : default_mdns, + '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 locale' : default_locale, + 'default user $PATH' : + default_user_path != '' ? default_user_path : '(same as system services)', + 'systemd service watchdog' : service_watchdog == '' ? 'disabled' : service_watchdog, + 'time epoch' : '@0@ (@1@)'.format(time_epoch, alt_time_epoch)}) # TODO: # CFLAGS: ${OUR_CFLAGS} ${CFLAGS} @@ -3808,15 +3799,17 @@ status += [ # LDFLAGS: ${OUR_LDFLAGS} ${LDFLAGS} if conf.get('ENABLE_EFI') == 1 - status += 'efi arch: @0@'.format(efi_arch) + summary({'efi arch' : efi_arch}, + section : 'Extensible Firmware Interface') if have_gnu_efi - status += [ - 'EFI machine type: @0@'.format(EFI_MACHINE_TYPE_NAME), - 'EFI CC @0@'.format(' '.join(efi_cc)), - 'EFI lds: @0@'.format(efi_lds), - 'EFI crt0: @0@'.format(efi_crt0), - 'EFI include directory: @0@'.format(efi_incdir)] + summary({ + 'EFI machine type' : EFI_MACHINE_TYPE_NAME, + 'EFI CC' : '@0@'.format(' '.join(efi_cc)), + 'EFI lds' : efi_lds, + 'EFI crt0' : efi_crt0, + 'EFI include directory' : efi_incdir}, + section : 'Extensible Firmware Interface') endif endif @@ -3971,13 +3964,10 @@ else missing += 'DNS-over-TLS' endif -status += [ - '', - 'enabled features: @0@'.format(', '.join(found)), - '', - 'disabled features: @0@'.format(', '.join(missing)), - ''] -message('\n '.join(status)) +summary({ + 'enabled' : ', '.join(found), + 'disabled' : ', '.join(missing)}, + section : 'Features') if rootprefixdir != rootprefix_default warning('\n' +