@kristoff and I have been working together on a guide for the Zig Build System. We plan to eventually merge it into the Zig standard library docs, but in the meantime you can access it directly from the official website.
Something I’ve wondered about and can’t seem to find in any docs is how to access the information inside
build.zig.zon from my
For deps it’s pretty easy, but what about information like the name and version?
Thank you Andrew and Loris for such a useful piece of documentation explaining in one place how zig build system works. It would also help to shed some more light on zig modules and packages. Currently the link to Package Management section does not work for me.
I forgot to mention, Package Management and Wrangling Third-Party Software Dependencies sections coming later.
I have this skeleton drafted out, but since they’re not done, they are omitted for now:
In order to fetch code from an external location, all dependencies must be listed in the
build manifest file -
build.zig.zon. This way, package-related tooling can have a complete list of possible dependencies without the need to execute arbitrary code.
When a project that you depend on uses the Zig Build System, you can refer to
the Package Management section. However, there is plenty of useful software out there whose maintainers have no plan to migrate to Zig. Fortunately, even such projects can be added seamlessly to the Zig ecosystem with the following techniques. Note that bullying the maintainers into using Zig is not listed here!!