diff --git a/build.zig b/build.zig index cc85cb4..8090aa9 100644 --- a/build.zig +++ b/build.zig @@ -1,7 +1,7 @@ const std = @import("std"); const build_facilio = @import("facil.io/build.zig").build_facilio; -pub fn build(b: *std.build.Builder) !void { +pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); // Standard release options allow the person running `zig build` to select // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. @@ -16,12 +16,12 @@ pub fn build(b: *std.build.Builder) !void { }; // create a module to be used internally. - const zap_module = b.createModule(.{ - .source_file = .{ .path = "src/zap.zig" }, + const zap_module = b.addModule("zap", .{ + .root_source_file = .{ .path = "src/zap.zig" }, }); // register the module so it can be referenced using the package manager. - try b.modules.put(b.dupe("zap"), zap_module); + // try b.modules.put(b.dupe("zap"), zap_module); const facilio = try build_facilio("facil.io", b, target, optimize, use_openssl); @@ -95,8 +95,8 @@ pub fn build(b: *std.build.Builder) !void { .optimize = optimize, }); + example.root_module.addImport("zap", zap_module); example.linkLibrary(facilio); - example.addModule("zap", zap_module); // const example_run = example.run(); const example_run = b.addRunArtifact(example); @@ -131,7 +131,7 @@ pub fn build(b: *std.build.Builder) !void { .optimize = optimize, }); auth_tests.linkLibrary(facilio); - auth_tests.addModule("zap", zap_module); + auth_tests.root_module.addImport("zap", zap_module); const run_auth_tests = b.addRunArtifact(auth_tests); const install_auth_tests = b.addInstallArtifact(auth_tests, .{}); @@ -144,7 +144,7 @@ pub fn build(b: *std.build.Builder) !void { .optimize = optimize, }); mustache_tests.linkLibrary(facilio); - mustache_tests.addModule("zap", zap_module); + mustache_tests.root_module.addImport("zap", zap_module); const run_mustache_tests = b.addRunArtifact(mustache_tests); const install_mustache_tests = b.addInstallArtifact(mustache_tests, .{}); @@ -158,7 +158,8 @@ pub fn build(b: *std.build.Builder) !void { }); httpparams_tests.linkLibrary(facilio); - httpparams_tests.addModule("zap", zap_module); + httpparams_tests.root_module.addImport("zap", zap_module); + const run_httpparams_tests = b.addRunArtifact(httpparams_tests); // TODO: for some reason, tests aren't run more than once unless // dependencies have changed. @@ -175,7 +176,7 @@ pub fn build(b: *std.build.Builder) !void { }); sendfile_tests.linkLibrary(facilio); - sendfile_tests.addModule("zap", zap_module); + sendfile_tests.root_module.addImport("zap", zap_module); const run_sendfile_tests = b.addRunArtifact(sendfile_tests); const install_sendfile_tests = b.addInstallArtifact(sendfile_tests, .{}); @@ -229,7 +230,7 @@ pub fn build(b: *std.build.Builder) !void { .optimize = optimize, }); docserver_exe.linkLibrary(facilio); - docserver_exe.addModule("zap", zap_module); + docserver_exe.root_module.addImport("zap", zap_module); var docserver_step = b.step("docserver", "Build docserver"); const docserver_build_step = b.addInstallArtifact(docserver_exe, .{}); docserver_step.dependOn(&docserver_build_step.step); diff --git a/facil.io/build.zig b/facil.io/build.zig index 2c2fd80..690eb9a 100644 --- a/facil.io/build.zig +++ b/facil.io/build.zig @@ -2,11 +2,11 @@ const std = @import("std"); pub fn build_facilio( comptime subdir: []const u8, - b: *std.build.Builder, - target: std.zig.CrossTarget, + b: *std.Build, + target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, use_openssl: bool, -) !*std.build.CompileStep { +) !*std.Build.Step.Compile { const lib = b.addStaticLibrary(.{ .name = "facil.io", .target = target, @@ -15,7 +15,7 @@ pub fn build_facilio( // Generate flags var flags = std.ArrayList([]const u8).init(std.heap.page_allocator); - if (lib.optimize != .Debug) try flags.append("-Os"); + if (optimize != .Debug) try flags.append("-Os"); try flags.append("-Wno-return-type-c-linkage"); try flags.append("-fno-sanitize=undefined"); @@ -26,7 +26,7 @@ pub fn build_facilio( // try flags.append("-DFIO_HTTP_EXACT_LOGGING"); - if (target.getAbi() == .musl) + if (target.result.abi == .musl) try flags.append("-D_LARGEFILE64_SOURCE"); if (use_openssl) try flags.append("-DHAVE_OPENSSL -DFIO_TLS_FOUND"); diff --git a/flake.lock b/flake.lock index fc268f1..23ac743 100644 --- a/flake.lock +++ b/flake.lock @@ -92,11 +92,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1703884419, - "narHash": "sha256-Cth9deiBGnMhW0+QgaPJ/axiRZT1vGBZOlwLkquucMI=", + "lastModified": 1704461694, + "narHash": "sha256-dQc9Bkh5uf0R4po3NWnCGx+3eqOZR7iSR4jmRvNNm+E=", "owner": "neovim", "repo": "neovim", - "rev": "c5e9acca6471280e32fbcaa30849aa68358155ca", + "rev": "c509f4907bf7405c9c2ae3f7eff76c5d552944cc", "type": "github" }, "original": { @@ -108,11 +108,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1703875886, - "narHash": "sha256-WJ0s5WWOBUnXAfPwxLm0cI4XjeLXPdI95Znwjrsfd2A=", + "lastModified": 1704290814, + "narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=", "owner": "nixos", "repo": "nixpkgs", - "rev": "0fce51a5077927de454b94ffae41c2749fa15ba2", + "rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421", "type": "github" }, "original": { @@ -184,11 +184,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1703636531, - "narHash": "sha256-gaXmic+so/NhvsXwoiM759HxE41tdFdjuepFmgXhpQE=", + "lastModified": 1704456535, + "narHash": "sha256-hR5ACOZ59qg2Ghop+fp5DJHfZHy4Mz/7xootwnVoxd0=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "d6cc5ac1207d2e4ae717515737fc47a705e57d76", + "rev": "b97c02c5de441db91f6de78db1e0077b36e3c869", "type": "github" }, "original": {