build: include pre-generated parser files and manual regeneration target#1003
Conversation
203e980 to
87f92e2
Compare
|
I have a hazy memory that we used to do this once (we also used to use flex back then), then removed it. I believe Debian at least has a policy of generating the files itself (to provide the ability to modify the source code in its preferred form), so the ability will need to be maintained at least. Overall this adds complexity for a rather thin benefit, as bison is pretty close to ubiquitous. But if you want to help @vazub avoid bison, that's OK. Ideally byacc would add the detailed error feature, then we could just restore byacc support... |
ae6e650 to
e6c6de0
Compare
It seems Fedora has some policy about it too. So let’s be a good FLOSS citizen and keep bison requirement by default (see hereinafter). @bluetech By the same reasoning it seems that we should also make the build depend on |
|
I added the build option
There is also a manual target |
5c1441f to
b281fc8
Compare
|
Rebased, changed the meson option name and added a check in the CI to ensure pre-generated files are up-to-date. |
This change introduces pre-generated `parser.c` and `parser.h` files into the source tree and adds a manual mechanism to regenerate them. - Added the initial version of the generated `parser.c` and `parser.h` to allow out-of-the-box compilation without a yacc dependency. - Added the meson option `enable-parser-auto-generation` (enabled by default) to choose between auto-generated and pre-generated parser files. - Implemented the `src/xkbcomp/update-parser` custom target (not built by default) to allow developers to manually sync the pre-generated parser files after a `parser.y` update. - Added a `yacc-wrapper` script to ensure Bison runs from the project root and adds a license header. This also guarantees that `#line` directives in generated files use relative paths, keeping the source tree sanitized and portable. This approach prevents “Bison lock-in” while maintaining the ability to update the grammar as needed.
- Ensure pre-generated parser files work everywhere. - Ensure pre-generated parser files update works on Linux. For some reason the Windows CI fails on the same task and I could not figure out why, so I removed it. - Ensure pre-generated files are up-to-date.
b281fc8 to
0d909d7
Compare
This change introduces pre-generated
parser.candparser.hfiles into the source tree and adds a manual mechanism to regenerate them.yacc-wrapperscript to ensure Bison runs from the project root. This guarantees that `#line`` directives in generated files use relative paths, keeping the source tree sanitized and portable.parser.yupdate.parser.c`` andparser.h` to allow out-of-the-box compilation without a yacc dependency.This approach prevents “Bison lock-in” while maintaining the ability to update the grammar as needed.
Fixes #997
@whot @bluetech @vazub
TODO: