diff options
| -rw-r--r-- | README.md | 10 |
1 files changed, 10 insertions, 0 deletions
| @@ -83,12 +83,22 @@ Add this as one of the `.dependencies` inside your `build.zig.zon` file: | |||
| 83 | ```zig | 83 | ```zig |
| 84 | .sqlite = .{ | 84 | .sqlite = .{ |
| 85 | .url = "https://github.com/vrischmann/zig-sqlite/archive/COMMIT.tar.gz", | 85 | .url = "https://github.com/vrischmann/zig-sqlite/archive/COMMIT.tar.gz", |
| 86 | .hash = <hash value>, | ||
| 86 | }, | 87 | }, |
| 87 | ``` | 88 | ``` |
| 88 | 89 | ||
| 89 | This tells zig to fetch zig-sqlite from a tarball provided by GitHub. Make sure to replace the `COMMIT` part with an actual commit SHA in long form, like `219faa2a5cd5a268a865a1100e92805df4b84610`. | 90 | This tells zig to fetch zig-sqlite from a tarball provided by GitHub. Make sure to replace the `COMMIT` part with an actual commit SHA in long form, like `219faa2a5cd5a268a865a1100e92805df4b84610`. |
| 90 | Every time you want to update zig-sqlite you'll have to update this commit. | 91 | Every time you want to update zig-sqlite you'll have to update this commit. |
| 91 | 92 | ||
| 93 | You'll have to provide the `hash` field too which is actually a litte annoying because the hash is of the _content_, not the _archive_ (see [the Zig 0.11 release notes](https://ziglang.org/download/0.11.0/release-notes.html#Package-Management)). | ||
| 94 | The easiest way to get the hash value is to omit it from the file and run `zig build`, it will report an error like this: | ||
| 95 | ``` | ||
| 96 | Fetch Packages... sqlite... /Users/vincent/dev/perso/projects/zig-sqlite-demo/build.zig.zon:6:11: error: url field is missing corresponding hash field | ||
| 97 | .url = "https://github.com/vrischmann/zig-sqlite/archive/219faa2a5cd5a268a865a1100e92805df4b84610.tar.gz", | ||
| 98 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 99 | note: expected .hash = "122088f0b73f5adcf07c9af8437c5149ed35c3f16f6393c330a294bdd5f91f069a08", | ||
| 100 | ``` | ||
| 101 | |||
| 92 | Now in your `build.zig` you can access the module like this: | 102 | Now in your `build.zig` you can access the module like this: |
| 93 | ```zig | 103 | ```zig |
| 94 | const sqlite = b.dependency("sqlite", .{ | 104 | const sqlite = b.dependency("sqlite", .{ |