build: switch to the Zig package manager
No more git submodules!
This commit is contained in:
39
PACKAGING.md
39
PACKAGING.md
@ -26,6 +26,45 @@ and is only compatible with that release and any patch releases. At the time
|
||||
of writing for example river is compatible with Zig 0.9.0 and 0.9.1 but
|
||||
not Zig 0.8.0 or 0.10.0.
|
||||
|
||||
## Zig Package Manager
|
||||
|
||||
River uses the built-in Zig package manager for its (few) Zig dependencies.
|
||||
By default, running `zig build` will fetch river's Zig dependencies from the
|
||||
internet and store them in the global zig cache before building river. Since
|
||||
accessing the internet is forbidden or at least frowned upon by most distro
|
||||
packaging infrastructure, there are ways to fetch the Zig dependencies in a
|
||||
separate step before building river:
|
||||
|
||||
1. Fetch step with internet access:
|
||||
|
||||
For each package in the `build.zig.zon` manifest file run the following command
|
||||
with the tarball URL in the `build.zig.zon`:
|
||||
|
||||
```
|
||||
zig fetch --global-cache-dir /tmp/foobar $URL
|
||||
```
|
||||
|
||||
This command will download and unpack the tarball, hash the contents of the
|
||||
tarball, and store the contents in the `/tmp/foobar/p/$HASH` directory. This
|
||||
hash should match the corresponding hash field in the `build.zig.zon`.
|
||||
|
||||
2. Build step with no internet access:
|
||||
|
||||
The `--system` flag for `zig build` takes a path to an arbitrary directory in
|
||||
which zig packages stored in subdirectories matching their hash can be found.
|
||||
|
||||
```
|
||||
zig build --system /tmp/foobar/p/ ...
|
||||
```
|
||||
|
||||
This flag will disable all internet access and error if a package is not found
|
||||
in the provided directory.
|
||||
|
||||
It is also possible for distros to distribute Zig package manager packages as
|
||||
distro packages, although there are still some rough edges as the support for
|
||||
this is not yet mature. See this patchset for Chimera Linux for an example of
|
||||
how this can work: https://github.com/chimera-linux/cports/pull/1395
|
||||
|
||||
## Build options
|
||||
|
||||
River is built using the Zig build system. To see all available build
|
||||
|
Reference in New Issue
Block a user