std.Build.Step.ConfigHeader: make header_text optional, no default
The default header_text added as a comment at the top of the generated file assumes C or ASM syntax, whereas we could be generating any type of file. This change makes no header_text the default, and allows users to specify one if they desire, including their own comment syntax as necessary.
https://github.com/ziglang/zig/issues/19272
- For the flavors where the comment syntax is known, make it continue to default to including the "generated by..." line.
- For the "blank" flavor, make it fail the configure phase (i.e. panic) with a message that tells the user to either specify the header text, or to explicitly set it to the empty string.
Actually one can't rely on the Style types / flavors here, as this field mixes two different informations:
- which syntax to use as variable replacement, if any (autoconf, cmake, or no replacement / blank input)
- what type of file to output (C for autoconf and cmake, ASM for nasm, anything for blank)
As for me, I am using ConfigHeader with cmake syntax to output a Lua file from a Lua input file containing CMake-style variables. I wouldn't be able to specify this with your solution.
In my opinion we should split the style option into two: syntax, defaulting to none (no replacement), and header_text, compulsory. We could add a third such as output_format, and make header_text optional, and panic if there's neither header_text nor output_format, but it seems a tad convoluted to me.
I think I've added what you suggested. It's working for me with Lua input and specifying a Lua comment in header_text.