From 8206949a1005042dac53c5a4f37d09f736c4d60c Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Tue, 3 Oct 2023 17:57:02 -0700 Subject: [PATCH] update build script to zig 0.11.0 --- build.zig | 23 +++++++++++++---------- licenses.txt | 8 ++++++++ zig.mod | 3 +-- zigmod.lock | 6 ++++++ 4 files changed, 28 insertions(+), 12 deletions(-) create mode 100644 licenses.txt create mode 100644 zigmod.lock diff --git a/build.zig b/build.zig index fae1737da00c637ef93a81be0f33cd121ac33bbc..2b59848a2b4252709a55f7d9186d44d62073f105 100644 --- a/build.zig +++ b/build.zig @@ -3,26 +3,29 @@ const deps = @import("./deps.zig"); pub fn build(b: *std.build.Builder) void { const target = b.standardTargetOptions(.{}); - const mode = b.standardReleaseOptions(); - const step = b.option([]const u8, "step", "") orelse "generate"; - b.use_stage1 = true; + const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug; + + const step = b.option([]const u8, "step", "") orelse "run"; if (std.mem.eql(u8, step, "run")) { - addExeStep(b, target, mode, "zig-unicode-ucd", "src/main.zig", "Run the app"); + addExeStep(b, target, mode, "zig-unicode-uca", "src/main.zig", "Run the app"); } if (std.mem.eql(u8, step, "generate")) { addExeStep(b, target, mode, "generate", "generate.zig", "Generate the bindings"); } } -fn addExeStep(b: *std.build.Builder, target: std.zig.CrossTarget, mode: std.builtin.Mode, name: []const u8, root_src: ?[]const u8, sdescription: []const u8) void { - const exe = b.addExecutable(name, root_src); - exe.setTarget(target); - exe.setBuildMode(mode); +fn addExeStep(b: *std.build.Builder, target: std.zig.CrossTarget, mode: std.builtin.Mode, name: []const u8, root_src: []const u8, sdescription: []const u8) void { + const exe = b.addExecutable(.{ + .name = name, + .root_source_file = .{ .path = root_src }, + .target = target, + .optimize = mode, + }); deps.addAllTo(exe); - exe.install(); + b.installArtifact(exe); - const cmd = exe.run(); + const cmd = b.addRunArtifact(exe); cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { cmd.addArgs(args); diff --git a/licenses.txt b/licenses.txt new file mode 100644 index 0000000000000000000000000000000000000000..6c513d2c9af484a0a737dec9d961ec8d17a7f6d9 --- /dev/null +++ b/licenses.txt @@ -0,0 +1,8 @@ +MIT: += https://spdx.org/licenses/MIT +- This +- git https://github.com/nektro/iguanaTLS +- git https://github.com/nektro/zfetch +- git https://github.com/nektro/zig-ansi +- git https://github.com/nektro/zig-fmt-valueliteral +- git https://github.com/truemedian/hzzp diff --git a/zig.mod b/zig.mod index 6b9556c9b8c708c8389a66aa17f511725e7a39a5..93a1b6236e6be65226fcca62c3482eda4c4edbc0 100644 --- a/zig.mod +++ b/zig.mod @@ -4,7 +4,6 @@ main: src/lib.zig license: MIT description: Zig bindings for the Unicode Character Database root_dependencies: - - src: git https://github.com/nektro/iguanaTLS - - src: git https://github.com/truemedian/zfetch + - src: git https://github.com/nektro/zfetch - src: git https://github.com/nektro/zig-ansi - src: git https://github.com/nektro/zig-fmt-valueliteral diff --git a/zigmod.lock b/zigmod.lock new file mode 100644 index 0000000000000000000000000000000000000000..f2dac832d68f910735bd5c83b0de333a83f15409 --- /dev/null +++ b/zigmod.lock @@ -0,0 +1,6 @@ +2 +git https://github.com/nektro/iguanaTLS commit-c932f557865abaa1d06cd88e9b22a9f3e583fa59 +git https://github.com/nektro/zfetch commit-f51277414a2309f776fb79f3d55f26e37f9a54da +git https://github.com/nektro/zig-ansi commit-ac607e4e7ac36d46cc67c8786262578330543a36 +git https://github.com/nektro/zig-fmt-valueliteral commit-ec324a6979145ec8b1b405f5faef811f43ca3726 +git https://github.com/truemedian/hzzp commit-305aca97fce78eb3e787d57691a5eed5512bece7 -- 2.54.0