From 81a97815cae626f95040d2336c2b76de05ccf710 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Sun, 8 Dec 2024 12:48:51 +0100 Subject: update readme --- README.md | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 1ecf9e4..39273c3 100644 --- a/README.md +++ b/README.md @@ -83,24 +83,10 @@ There are three main ways to include `zig-sqlite` in your project: ## Official package manager -Add this as one of the `.dependencies` inside your `build.zig.zon` file: -```zig -.sqlite = .{ - .url = "https://github.com/vrischmann/zig-sqlite/archive/COMMIT.tar.gz", - .hash = , -}, -``` - -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`. -Every time you want to update zig-sqlite you'll have to update this commit. +Use the following `zig fetch` command: -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)). -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: ``` -Fetch Packages... sqlite... /Users/vincent/dev/perso/projects/zig-sqlite-demo/build.zig.zon:6:11: error: url field is missing corresponding hash field - .url = "https://github.com/vrischmann/zig-sqlite/archive/219faa2a5cd5a268a865a1100e92805df4b84610.tar.gz", - ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -note: expected .hash = "122088f0b73f5adcf07c9af8437c5149ed35c3f16f6393c330a294bdd5f91f069a08", +zig fetch --save git+https://github.com/vrischmann/zig-sqlite ``` Now in your `build.zig` you can access the module like this: @@ -109,11 +95,7 @@ const sqlite = b.dependency("sqlite", .{ .target = target, .optimize = optimize, }); - exe.root_module.addImport("sqlite", sqlite.module("sqlite")); - -// links the bundled sqlite3, so leave this out if you link the system one -exe.linkLibrary(sqlite.artifact("sqlite")); ``` ## zigmod -- cgit v1.2.3