# ZAP Release release-0.0.11-localhost (until zig pkg fetch from GH is fixed)
Pre-release
Pre-release
renerocksai
released this
22 Apr 22:45
·
496 commits
to master
since this release
ZAP Release release-0.0.11-localhost
Latest zig-master has problems handling the recent GitHub
redirects to codeload.github.com
. My work-around for this is as follows:
Change your build.zig.zon
zap dependency to localhost:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap release-0.0.11-localhost
.zap = .{
.url = "http://127.0.0.1:8000/release-0.0.11-localhost.tar.gz",
.hash = "122072531b7983335abffa3f9e66cc7f3153e4a697d3c332ed3811495eb1c75ab3f0",
}
}
}
$ # get dependency required by zap
$ wget https://github.com/zigzap/facil.io/archive/refs/tags/zap-0.0.7.tar.gz
$ # get zap itself
$ wget https://github.com/zigzap/zap/archive/refs/tags/release-0.0.11-localhost.tar.gz
$ # start a http server on port 8000
$ python -m http.server
This hosts the downloaded dependencies locally on port 8000. After the first
zig build
, you can stop the python http server with
CTRL+C.
Generic
To use in your own projects, put this dependency into your build.zig.zon
:
// zap release-0.0.11-localhost
.zap = .{
.url = "http://127.0.0.1:8000/release-0.0.11-localhost.tar.gz",
.hash = "122072531b7983335abffa3f9e66cc7f3153e4a697d3c332ed3811495eb1c75ab3f0",
}
Here is a complete build.zig.zon
example:
.{
.name = "My example project",
.version = "0.0.1",
.dependencies = .{
// zap release-0.0.11-localhost
.zap = .{
.url = "http://127.0.0.1:8000/release-0.0.11-localhost.tar.gz",
.hash = "122072531b7983335abffa3f9e66cc7f3153e4a697d3c332ed3811495eb1c75ab3f0",
}
}
}
Then, in your build.zig
's build
function, add the following before
exe.install()
:
const zap = b.dependency("zap", .{
.target = target,
.optimize = optimize,
});
exe.addModule("zap", zap.module("zap"));
exe.linkLibrary(zap.artifact("facil.io"));