Getting cross compilation to work.
Dridi Boukelmoune
dridi at varni.sh
Mon Apr 20 10:06:41 UTC 2026
On Mon, Apr 20, 2026 at 6:15 AM Per Buer <per.buer at varnish-software.com> wrote:
>
> Hi.
>
> I have a suggestion. Currently, cross-compilation is broken. The biggest problem is the, imo overly clever use of RST (a formatting language) for data. During the build, the C code is compiled, which outputs RST used to build the documentation.
>
> How about moving this into a language made for data rather than formatting? So, with the data in JSON, the Python code will output C struct/array initializers for the binary to use at runtime as well as the RST consumed by the docs.
I would really prefer not to author JSON by hand, and the same goes
for YAML. The advantage of generating code from the documentation is
that we can literally "just write" documentation. As of today with
reasonable formatting constraints like "Readable from:" etc in the
vcl-var manual. Adding an indirection would trade a low pain point for
a high one.
Also, I think that for the most part codegen from RST is already done
in Python: generate.py and vmodtool, plus vsctool and its pseudo-RST.
Off the top of my head what we do with docs in C that requires running
programs during the build is generating RST. So the solution would
actually be to generate more C code from docs, going from docgen in C
to codegen in Python. One example is the large params.h table that
could be generated from RST code.
> The goal is easy cross-compilation. A bonus is that building a standalone configuration compiler would be easier if we ever wanna cross that bridge.
>
> --
> Per Buer
> Varnish Software
> _______________________________________________
> vinyl-dev mailing list
> vinyl-dev at vinyl-cache.org
> https://vinyl-cache.org/lists/mailman/listinfo/vinyl-dev
More information about the vinyl-dev
mailing list