From 2cdd85694ede21135a2c2de8846beddc9d69f15f Mon Sep 17 00:00:00 2001 From: Amogh Yermalkar Date: Thu, 5 Jun 2025 22:29:03 +0530 Subject: [PATCH] update: add cmd to save dependency in zon file instead of manually copying. --- README.md | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 36323562..46c50e48 100644 --- a/README.md +++ b/README.md @@ -188,26 +188,19 @@ int main(void) { using the C API to libxev, see the "Build" section. This package works with the Zig package manager introduced in Zig 0.11. -Create a `build.zig.zon` file like this: +Run this command to fetch the latest SHA for the package, it will automatically +save it in the `build.zig.zon` file. -```zig -.{ - .name = "my-project", - .version = "0.0.0", - .dependencies = .{ - .libxev = .{ - .url = "https://github.com/mitchellh/libxev/archive/.tar.gz", - .hash = "12208070233b17de6be05e32af096a6760682b48598323234824def41789e993432c", - }, - }, -} + +```bash +zig fetch --save https://github.com/mitchellh/libxev/archive/.tar.gz ``` And in your `build.zig`: ```zig const xev = b.dependency("libxev", .{ .target = target, .optimize = optimize }); -exe.addModule("xev", xev.module("xev")); +exe.root_module.addImport("xev", xev.module("xev")); ``` ## Documentation