From 5f2a630b4a6cbdb00410d166580f87c07fa2b312 Mon Sep 17 00:00:00 2001 From: Vincent Rischmann Date: Sun, 22 Dec 2024 04:03:30 +0100 Subject: [PATCH] make the build work with zig 0.13.0 --- build.zig | 32 +++++++++++--------------------- 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/build.zig b/build.zig index 27f5f18..5e8a59b 100644 --- a/build.zig +++ b/build.zig @@ -15,26 +15,21 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); - const mod = b.createModule(.{ + const lib = b.addStaticLibrary(.{ + .name = "picohttpparser", .target = target, .optimize = optimize, .link_libc = true, .single_threaded = true, - .sanitize_c = true, }); - mod.addIncludePath(b.path(".")); - mod.addCSourceFiles(.{ + lib.addIncludePath(b.path(".")); + lib.addCSourceFiles(.{ .root = upstream.path("."), .files = &[_][]const u8{ "picohttpparser.c", }, .flags = c_flags, }); - - const lib = b.addStaticLibrary(.{ - .name = "picohttpparser", - .root_module = mod, - }); lib.linkLibC(); lib.installHeader(upstream.path("picohttpparser.h"), "picohttpparser.h"); b.installArtifact(lib); @@ -58,24 +53,24 @@ pub fn build(b: *std.Build) void { const wf = b.addWriteFiles(); _ = wf.addCopyFile(picotest.path("picotest.h"), "picotest/picotest.h"); - const test_module = b.createModule(.{ + const test_bin = b.addExecutable(.{ + .name = "test-bin", .target = target, .optimize = optimize, .link_libc = true, .single_threaded = true, - .sanitize_c = true, }); - test_module.linkLibrary(lib); - test_module.addIncludePath(upstream.path(".")); - test_module.addIncludePath(wf.getDirectory()); - test_module.addCSourceFiles(.{ + test_bin.linkLibrary(lib); + test_bin.addIncludePath(upstream.path(".")); + test_bin.addIncludePath(wf.getDirectory()); + test_bin.addCSourceFiles(.{ .root = picotest.path("."), .files = &[_][]const u8{ "picotest.c", }, .flags = c_flags, }); - test_module.addCSourceFiles(.{ + test_bin.addCSourceFiles(.{ .root = upstream.path("."), .files = &[_][]const u8{ "test.c", @@ -83,11 +78,6 @@ pub fn build(b: *std.Build) void { .flags = c_flags, }); - const test_bin = b.addExecutable(.{ - .name = "test-bin", - .root_module = test_module, - }); - const run_tests = b.addRunArtifact(test_bin); run_tests.step.dependOn(&wf.step);