Skip to content

release-0.0.19-localhost

Pre-release
Pre-release
Compare
Choose a tag to compare
@renerocksai renerocksai released this 15 May 10:40
· 448 commits to master since this release

ZAP Release release-0.0.19-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.19-localhost
        .zap = .{
            .url = "http://127.0.0.1:8000/release-0.0.19-localhost.tar.gz",
            .hash = "12201fe4eca3c4b43245d4268c22e5056b5d1b273e44cc9724f807a43c16b9b7b36f",
        }
    }
}
$ # get dependency required by zap
$ wget https://github.com/zigzap/facil.io/archive/refs/tags/zap-0.0.8.tar.gz
$ # get zap itself
$ wget https://github.com/zigzap/zap/archive/refs/tags/release-0.0.19-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 firstzig 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.19-localhost.tar.gz",
            .hash = "12201fe4eca3c4b43245d4268c22e5056b5d1b273e44cc9724f807a43c16b9b7b36f",
        }

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.19-localhost.tar.gz",
            .hash = "12201fe4eca3c4b43245d4268c22e5056b5d1b273e44cc9724f807a43c16b9b7b36f",
        }
    }
}

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"));