aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore9
-rw-r--r--README.md2
-rw-r--r--build.zig33
-rw-r--r--gyro.zzz14
-rw-r--r--src/lib.zig (renamed from src/nkeys.zig)0
-rw-r--r--zig.mod5
6 files changed, 35 insertions, 28 deletions
diff --git a/.gitignore b/.gitignore
index 29534f3..37727c2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,6 @@
1/zig-cache/ 1zig-cache/
2/zig-out/ 2zig-out/
3.DS_Store 3deps.zig
4.zigmod/
5.gyro/
6gyro.lock
diff --git a/README.md b/README.md
index 74a32b3..22052dd 100644
--- a/README.md
+++ b/README.md
@@ -11,9 +11,7 @@ Contains a tool called `znk` which is a clone of the [`nk` tool](https://github.
11 11
12Zig master works at the time of writing. 12Zig master works at the time of writing.
13 13
14Use `zig build` to build the library.
15Use `zig build znk` to build the `znk` tool. 14Use `zig build znk` to build the `znk` tool.
16
17The `znk` tool can be run by using `zig build run-znk`. 15The `znk` tool can be run by using `zig build run-znk`.
18 16
19Tests for the library can be run by using `zig build test`. 17Tests for the library can be run by using `zig build test`.
diff --git a/build.zig b/build.zig
index b9c837d..f673f6b 100644
--- a/build.zig
+++ b/build.zig
@@ -1,47 +1,34 @@
1const std = @import("std"); 1const std = @import("std");
2 2
3pub fn build(b: *std.build.Builder) !void { 3pub fn build(b: *std.build.Builder) !void {
4 // Standard target options allows the person running `zig build` to choose
5 // what target to build for. Here we do not override the defaults, which
6 // means any target is allowed, and the default is native. Other options
7 // for restricting supported target set are available.
8 const target = b.standardTargetOptions(.{});
9
10 // Standard release options allow the person running `zig build` to select
11 // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
12 const mode = b.standardReleaseOptions(); 4 const mode = b.standardReleaseOptions();
5 const target = b.standardTargetOptions(.{});
13 6
14 const version = "0.1.0-dev"; 7 var lib_tests = b.addTest("src/lib.zig");
15
16 const lib = b.addStaticLibrary("nkeys", "src/nkeys.zig");
17 lib.setBuildMode(mode);
18 lib.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version));
19 lib.install();
20
21 var lib_tests = b.addTest("src/nkeys.zig");
22 lib_tests.setBuildMode(mode); 8 lib_tests.setBuildMode(mode);
23 lib_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version));
24 9
25 const test_step = b.step("test", "Run library tests"); 10 const test_step = b.step("test", "Run library tests");
26 test_step.dependOn(&lib_tests.step); 11 test_step.dependOn(&lib_tests.step);
27 12
13 const znk_version = "0.1.0";
14
28 var znk_tests = b.addTest("tool/znk.zig"); 15 var znk_tests = b.addTest("tool/znk.zig");
29 znk_tests.setBuildMode(mode); 16 znk_tests.setBuildMode(mode);
30 znk_tests.addPackagePath("nkeys", "src/nkeys.zig"); 17 znk_tests.addPackagePath("nkeys", "src/lib.zig");
31 znk_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); 18 znk_tests.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, znk_version));
32 19
33 const znk_test_step = b.step("test-znk", "Run znk tests"); 20 const znk_test_step = b.step("test-znk", "Run znk tests");
34 znk_test_step.dependOn(&znk_tests.step); 21 znk_test_step.dependOn(&znk_tests.step);
35 22
36 const znk = b.addExecutable("znk", "tool/znk.zig"); 23 const znk = b.addExecutable("znk", "tool/znk.zig");
37 znk.setTarget(target);
38 znk.setBuildMode(mode); 24 znk.setBuildMode(mode);
39 znk.addPackagePath("nkeys", "src/nkeys.zig"); 25 znk.setTarget(target);
40 znk.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, version)); 26 znk.addPackagePath("nkeys", "src/lib.zig");
27 znk.addBuildOption([:0]const u8, "version", try b.allocator.dupeZ(u8, znk_version));
41 28
42 const znk_install = b.addInstallArtifact(znk); 29 const znk_install = b.addInstallArtifact(znk);
43 30
44 const znk_step = b.step("znk", "Build only znk"); 31 const znk_step = b.step("znk", "Build znk");
45 znk_step.dependOn(&znk_install.step); 32 znk_step.dependOn(&znk_install.step);
46 33
47 const znk_run_cmd = znk.run(); 34 const znk_run_cmd = znk.run();
diff --git a/gyro.zzz b/gyro.zzz
new file mode 100644
index 0000000..595c89c
--- /dev/null
+++ b/gyro.zzz
@@ -0,0 +1,14 @@
1pkgs:
2 nkeys:
3 version: 0.1.0
4 description: "NKeys support for Zig"
5 license: Apache-2.0
6 source_url: "https://github.com/rutgerbrf/zig-nkeys"
7 tags:
8 nats
9
10 root: src/lib.zig
11 files:
12 README.md
13 LICENSE
14 src/*.zig
diff --git a/src/nkeys.zig b/src/lib.zig
index 05922bd..05922bd 100644
--- a/src/nkeys.zig
+++ b/src/lib.zig
diff --git a/zig.mod b/zig.mod
new file mode 100644
index 0000000..8663e5b
--- /dev/null
+++ b/zig.mod
@@ -0,0 +1,5 @@
1id: vuocvcwmrmaabg3x916i1wnir9c6vuwqv6uwbm7rn5ks9vab
2name: nkeys
3main: src/lib.zig
4license: Apache-2.0
5dependencies: