First, you need a zig compiler built with Solana's LLVM fork. See the README of solana-zig-bootstrap on how to build it, or you can download it from the GitHub releases page.
There is also a helper script which will install it to the current directory:
./install-solana-zig.shzig fetch --save https://github.com/joncinque/solana-program-library-zig/archive/refs/tags/v0.15.1.tar.gz
zig fetch --save https://github.com/joncinque/solana-program-sdk-zig/archive/refs/tags/v0.16.2.tar.gz
zig fetch --save https://github.com/joncinque/base58-zig/archive/refs/tags/v0.14.0.tar.gzYou can build the program by running:
../solana-zig/zig build