Re: [PATCH] generate-configlist: collapse depfile for older Ninja
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Apr 22, 2026, 06:36 UTC
- Message-ID
- <aehsikCfPm83M9dN@pks.im>
- In-Reply-To
- <20260421-toon-fix-almalinux8-v1-1-aec1d54addde@iotcl.com>
On Tue, Apr 21, 2026 at 09:17:25PM +0200, Toon Claes wrote:
Show 9 quoted lines
> For the Makefile build system this works great. And since > ebeea3c471 (build: regenerate config-list.h when Documentation changes, > 2026-02-24) this script is also called from the Meson build system. > Nevertheless, on AlmaLinux 8 the following build failure is seen: > > ninja: error: dependency cycle: config-list.h -> config-list.h > > This version of this distro uses Ninja 1.8.2 and it seems to have some > issues with the format of the `config-list.h.d` file.
Right, I can reproduce the issue with that version indeed:
$ meson setup -Ddocs=man build
$ ninja -C build
... successful build ...
$ ninja -C build
ninja: error: dependency cycle: config-list.h -> config-list.hShow 15 quoted lines
> Ninja versions before 1.10.0 do not reset the depfile parser state on > newlines. This causes issues when the depfile has one dependency per > line, like we have in `config-list.h.d`: > > config-list.h: Documentation/config.adoc > config-list.h: Documentation/config/add.adoc > > The parser only recognizes the first "config-list.h:" as a target. On > subsequent lines it is still in dependency-parsing mode, so the repeated > output name is recorded as an input. This causes the error mentioned > above. > > The bug in Ninja is fixed in 1.10, with commit > ninja-build/ninja@1daa7470ab7e (depfile_parser: remove restriction on > multiple outputs, 2019-11-20).
Good find.
Show 9 quoted lines
> To be compatible with older versions of Ninja, add a fourth optional > argument to `generate-configlist.sh` that can be empty or "collapse". > When this argument is "collapse", there is a post-processing step on > `config-list.h.d` to put the dependencies for `config-list.h` on a > single line, like: > > config-list.h: Documentation/config.adoc Documentation/config/add.adoc ... > > This works around the bug in older versions of Ninja.
Do we really have to make the logic conditional? I would expect that this works just fine for newer versions of Ninja and for Make, so it feels rather pointless to me to have two modes to worry about.
So wouldn't the below simplified version be sufficient?
Thanks!
Patrick
diff --git a/tools/generate-configlist.sh b/tools/generate-configlist.sh index e28054f9e0..f5f42492c6 100755 --- a/tools/generate-configlist.sh +++ b/tools/generate-configlist.sh @@ -44,7 +44,9 @@ then { printf '%s\n' "$SOURCE_DIR"/Documentation/*config.adoc \ "$SOURCE_DIR"/Documentation/config/*.adoc | - sed -e 's/[# ]/\\&/g' -e "s/^/$QUOTED_OUTPUT: /" + sed -e 's/[# ]/\\&/g' | + tr '\n' ' ' | + sed -e "s/^/$QUOTED_OUTPUT: /" -e 's/ $/\n/' printf '%s:\n' "$SOURCE_DIR"/Documentation/*config.adoc \ "$SOURCE_DIR"/Documentation/config/*.adoc | sed -e 's/[# ]/\\&/g'