From 5a89c7972a5ce15f299ed867834134c23695b4d9 Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 24 Jan 2021 14:13:02 +0000 Subject: [PATCH 1/2] mkosi: Pass build script arguments to ninja mkosi recently gained support to pass arguments to the build script. Let's take advantage of this in systemd's build script to allow passing which target to build to ninja in the build script. --- mkosi.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkosi.build b/mkosi.build index 0fa0f0aa17..f28c2892c3 100755 --- a/mkosi.build +++ b/mkosi.build @@ -97,7 +97,7 @@ if [ ! -f "$BUILDDIR"/build.ninja ] ; then fi cd "$BUILDDIR" -ninja +ninja $@ if [ "$WITH_TESTS" = 1 ] ; then for id in 1 2 3; do getent group $id > /dev/null || groupadd -g $id testgroup$id From 44bc7f4fcf64429165b93bd0192bfb3ac5e08b0d Mon Sep 17 00:00:00 2001 From: Daan De Meyer Date: Sun, 24 Jan 2021 14:13:58 +0000 Subject: [PATCH 2/2] meson: Fix update-man-rules when the build dir is not a subdir of the project dir Until now, update-man-rules assumed that the build directory was a subdirectory of the project directory. When using mkosi, this is not the case. We use find instead of git ls-files because git ls-files does not seem to support outputting absolute paths. Also, this makes update-man-rules a bit more user-friendly as new manpages don't have to be added to the git staging area before they are processed by update-man-rules.py. --- man/meson.build | 18 ++++++++---------- mkosi.build | 2 +- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/man/meson.build b/man/meson.build index f555d629df..88e06b384a 100644 --- a/man/meson.build +++ b/man/meson.build @@ -217,16 +217,14 @@ endif ############################################################ -if git.found() - 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 $(git ls-files ":/man/*.xml") >t && '.format(project_source_root) + - 'mv t @0@/rules/meson.build'.format(meson.current_source_dir())], - depend_files : custom_entities_ent) -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@/rules/meson.build'.format(meson.current_source_dir())], + depend_files : custom_entities_ent) ############################################################ diff --git a/mkosi.build b/mkosi.build index f28c2892c3..a74fc196be 100755 --- a/mkosi.build +++ b/mkosi.build @@ -97,7 +97,7 @@ if [ ! -f "$BUILDDIR"/build.ninja ] ; then fi cd "$BUILDDIR" -ninja $@ +ninja "$@" if [ "$WITH_TESTS" = 1 ] ; then for id in 1 2 3; do getent group $id > /dev/null || groupadd -g $id testgroup$id