On Tue, 3 Jan 2023 09:37:51 -0500 Stefan Hajnoczi <stefa...@gmail.com> wrote:
> I don't understand the issue. Can you describe the steps that cause > meson-buildoptions.sh to become out-of-sync with meson_options.txt? > > This will continue to be a problem in the future. Is there a way to > fix it permanently? In Makefile we have: $(SRC_PATH)/scripts/meson-buildoptions.sh: $(SRC_PATH)/meson_options.txt (Cc'ing Paolo since he's the author of this line) This means make will regenerate `$(SRC_PATH)/scripts/meson-buildoptions.sh` if its last modification date is older than `$(SRC_PATH)/meson_options.txt`. However these files are in the source directory, so this will behave properly only under certain circumstances. For instance if, for some reason, someone committed a new version of `meson_options.txt` but not of `meson-buildoptions.sh`, a fresh clone of the repo will not have the dates set correctly to trigger the Makefile rule above: $ ls -ln scripts/meson* -rw-r--r-- 1 1000 1000 28913 Jan 3 15:58 scripts/meson-buildoptions.sh -rw-r--r-- 1 1000 1000 91 Jan 3 15:58 scripts/meson.build This is because git does not update file dates depending on the last commit changing them. This, on top of the fact that invoking `ninja` does not trigger regeneration (which works for most other use cases), leads to a good chance of forgetting to update meson-buildoptions.sh. We could add the target to ninja to mitigate the risk, but still, the dates problem remains. An alternative solution would be to avoid committing generated files and simply regenerating it every time. On my machine `meson.py introspect --buildoptions` + `scripts/meson-buildoptions.py` take 1.070s. `./configure --help` takes 0.162s, so it's a bit sad. On the other hand an actual invocation of configure can take significantly longer (`./configure` takes 29.150s on my machine). To avoid re-running it every time we could invoke `make update-buildoptions` in `configure` but keep `scripts/meson-buildoptions.sh` in the build directory. -- Alessandro Di Federico rev.ng Labs