From 7ceecda3e737ba7d4eaa0f137e97596be8b30633 Mon Sep 17 00:00:00 2001 From: Naoki MATSUMOTO Date: Wed, 17 Jul 2024 23:22:46 +0900 Subject: [PATCH] examples/proxy: use zon --- examples/proxy/build.zig | 4 +--- examples/proxy/build.zig.zon | 39 ++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 examples/proxy/build.zig.zon diff --git a/examples/proxy/build.zig b/examples/proxy/build.zig index 51b90d3..9f5af6b 100644 --- a/examples/proxy/build.zig +++ b/examples/proxy/build.zig @@ -19,9 +19,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); - exe.root_module.addAnonymousImport("tls13-server", .{ - .root_source_file = b.path("../../src/server.zig"), - }); + exe.root_module.addImport("tls13-server", b.dependency("tls13-zig", .{}).module("tls13-server")); // This declares intent for the executable to be installed into the // standard location when the user invokes the "install" step (the default // step when running `zig build`). diff --git a/examples/proxy/build.zig.zon b/examples/proxy/build.zig.zon new file mode 100644 index 0000000..70fcb7c --- /dev/null +++ b/examples/proxy/build.zig.zon @@ -0,0 +1,39 @@ +.{ + // This is the default name used by packages depending on this one. For + // example, when a user runs `zig fetch --save `, this field is used + // as the key in the `dependencies` table. Although the user can choose a + // different name, most users will stick with this provided value. + // + // It is redundant to include "zig" in this name because it is already + // within the Zig package namespace. + .name = "proxy", + + // This is a [Semantic Version](https://semver.org/). + // In a future version of Zig it will be used for package deduplication. + .version = "0.0.0", + + // This field is optional. + // This is currently advisory only; Zig does not yet do anything + // with this value. + //.minimum_zig_version = "0.11.0", + + // This field is optional. + // Each dependency must either provide a `url` and `hash`, or a `path`. + // `zig build --fetch` can be used to fetch all dependencies of a package, recursively. + // Once all dependencies are fetched, `zig build` no longer requires + // internet connectivity. + .dependencies = .{ + .@"tls13-zig" = .{ + .url = "https://github.com/shiguredo/tls13-zig/archive/refs/heads/develop.zip", + .hash = "12205605c99759d35ef65bbe7ea8d2f17aed2e7e63aa354fdb96d94eea7761af5ec9", + }, + }, + .paths = .{ + "build.zig", + "build.zig.zon", + "src", + // For example... + //"LICENSE", + //"README.md", + }, +}