Don't write to source directory if files did not change
Remove writes to the source directory which cause a meson build failure
if the source directory is read-only.
https://github.com/harfbuzz/harfbuzz/pull/3508
The file is a dependency for the library as a whole, so previously editing the Meson build files at all would force a full rebuild. This will only rebuild it if the version has changed.
The input file is by definition in the source directory, so dirname()
that instead of needing the directory to be passed.
Needed because a follow-up commit will change when this is called, and the
source directory isn't trivially available at that point.
This way it won't ruin incremental builds.
We need a better way to declare source altering tasks
https://github.com/mesonbuild/meson/issues/7156
yet this is good enough despite being not idiomatic.
It is however not that smooth yet as the change may is detected on the
next meson run. One of course can issue ./gen-ragel-artifacts.py
manually for better experience before running meson.
As https://circleci.com/gh/harfbuzz/harfbuzz/140481
Traceback (most recent call last):
File "./gen-hb-version.py", line 14, in <module>
output_file.write (input_file.read ()
File "/usr/lib/python3.4/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 16: ordinal not in range(128)