libffi, packaged for the Zig build system.
Supports x86_64, x86, aarch64, and arm on Linux, macOS, and BSDs.
First, update your build.zig.zon:
zig fetch --save git+https://github.com/allyourcodebase/libffi.git
Then in your build.zig:
const libffi = b.dependency("libffi", .{ .target = target, .optimize = optimize });
exe.linkLibrary(libffi.artifact("ffi"));