vezel-dev / graf

A graph-oriented intermediate representation, optimization framework, and machine code generator.
https://docs.vezel.dev/graf
BSD Zero Clause License
18 stars 1 forks source link

Integrate libffi in the build system #19

Closed alexrp closed 5 months ago

alexrp commented 5 months ago

This will be needed for the interpreter to call external functions.

I don't want to take a dependency on the system libffi since that majorly complicates our (currently) simple build process. That said, it should still be possible to use the system libffi for distro maintainers (https://github.com/ziglang/zig/pull/18778). Also, as with Aro, it should be possible to disable libffi support since I expect very few Graf library users will care about the interpreter.

This will likely involve forking libffi, adding a build.zig, and then adding that fork as a lazy build.zig.zon dependency (but note #16).

alexrp commented 5 months ago

Started the work here: https://github.com/alexrp/libffi/commits/master

The script itself mostly works, but I ran into a handful of issues:

Also, I raised the question of upstreaming the build script: https://github.com/libffi/libffi/issues/842

alexrp commented 5 months ago

For now, we'll just have to maintain some logic to disable libffi support on known-broken targets.