mirror of
https://github.com/zigzap/zap.git
synced 2025-10-20 23:24:09 +00:00
fix build for latest zig master
This commit is contained in:
parent
869a7b8138
commit
31bf768b96
3 changed files with 25 additions and 24 deletions
21
build.zig
21
build.zig
|
@ -1,7 +1,7 @@
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
const build_facilio = @import("facil.io/build.zig").build_facilio;
|
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(.{});
|
const target = b.standardTargetOptions(.{});
|
||||||
// Standard release options allow the person running `zig build` to select
|
// Standard release options allow the person running `zig build` to select
|
||||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
// 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.
|
// create a module to be used internally.
|
||||||
const zap_module = b.createModule(.{
|
const zap_module = b.addModule("zap", .{
|
||||||
.source_file = .{ .path = "src/zap.zig" },
|
.root_source_file = .{ .path = "src/zap.zig" },
|
||||||
});
|
});
|
||||||
|
|
||||||
// register the module so it can be referenced using the package manager.
|
// 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);
|
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,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
example.root_module.addImport("zap", zap_module);
|
||||||
example.linkLibrary(facilio);
|
example.linkLibrary(facilio);
|
||||||
example.addModule("zap", zap_module);
|
|
||||||
|
|
||||||
// const example_run = example.run();
|
// const example_run = example.run();
|
||||||
const example_run = b.addRunArtifact(example);
|
const example_run = b.addRunArtifact(example);
|
||||||
|
@ -131,7 +131,7 @@ pub fn build(b: *std.build.Builder) !void {
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
auth_tests.linkLibrary(facilio);
|
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 run_auth_tests = b.addRunArtifact(auth_tests);
|
||||||
const install_auth_tests = b.addInstallArtifact(auth_tests, .{});
|
const install_auth_tests = b.addInstallArtifact(auth_tests, .{});
|
||||||
|
@ -144,7 +144,7 @@ pub fn build(b: *std.build.Builder) !void {
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
mustache_tests.linkLibrary(facilio);
|
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 run_mustache_tests = b.addRunArtifact(mustache_tests);
|
||||||
const install_mustache_tests = b.addInstallArtifact(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.linkLibrary(facilio);
|
||||||
httpparams_tests.addModule("zap", zap_module);
|
httpparams_tests.root_module.addImport("zap", zap_module);
|
||||||
|
|
||||||
const run_httpparams_tests = b.addRunArtifact(httpparams_tests);
|
const run_httpparams_tests = b.addRunArtifact(httpparams_tests);
|
||||||
// TODO: for some reason, tests aren't run more than once unless
|
// TODO: for some reason, tests aren't run more than once unless
|
||||||
// dependencies have changed.
|
// dependencies have changed.
|
||||||
|
@ -175,7 +176,7 @@ pub fn build(b: *std.build.Builder) !void {
|
||||||
});
|
});
|
||||||
|
|
||||||
sendfile_tests.linkLibrary(facilio);
|
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 run_sendfile_tests = b.addRunArtifact(sendfile_tests);
|
||||||
const install_sendfile_tests = b.addInstallArtifact(sendfile_tests, .{});
|
const install_sendfile_tests = b.addInstallArtifact(sendfile_tests, .{});
|
||||||
|
|
||||||
|
@ -229,7 +230,7 @@ pub fn build(b: *std.build.Builder) !void {
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
docserver_exe.linkLibrary(facilio);
|
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");
|
var docserver_step = b.step("docserver", "Build docserver");
|
||||||
const docserver_build_step = b.addInstallArtifact(docserver_exe, .{});
|
const docserver_build_step = b.addInstallArtifact(docserver_exe, .{});
|
||||||
docserver_step.dependOn(&docserver_build_step.step);
|
docserver_step.dependOn(&docserver_build_step.step);
|
||||||
|
|
|
@ -2,11 +2,11 @@ const std = @import("std");
|
||||||
|
|
||||||
pub fn build_facilio(
|
pub fn build_facilio(
|
||||||
comptime subdir: []const u8,
|
comptime subdir: []const u8,
|
||||||
b: *std.build.Builder,
|
b: *std.Build,
|
||||||
target: std.zig.CrossTarget,
|
target: std.Build.ResolvedTarget,
|
||||||
optimize: std.builtin.OptimizeMode,
|
optimize: std.builtin.OptimizeMode,
|
||||||
use_openssl: bool,
|
use_openssl: bool,
|
||||||
) !*std.build.CompileStep {
|
) !*std.Build.Step.Compile {
|
||||||
const lib = b.addStaticLibrary(.{
|
const lib = b.addStaticLibrary(.{
|
||||||
.name = "facil.io",
|
.name = "facil.io",
|
||||||
.target = target,
|
.target = target,
|
||||||
|
@ -15,7 +15,7 @@ pub fn build_facilio(
|
||||||
|
|
||||||
// Generate flags
|
// Generate flags
|
||||||
var flags = std.ArrayList([]const u8).init(std.heap.page_allocator);
|
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("-Wno-return-type-c-linkage");
|
||||||
try flags.append("-fno-sanitize=undefined");
|
try flags.append("-fno-sanitize=undefined");
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ pub fn build_facilio(
|
||||||
//
|
//
|
||||||
|
|
||||||
try flags.append("-DFIO_HTTP_EXACT_LOGGING");
|
try flags.append("-DFIO_HTTP_EXACT_LOGGING");
|
||||||
if (target.getAbi() == .musl)
|
if (target.result.abi == .musl)
|
||||||
try flags.append("-D_LARGEFILE64_SOURCE");
|
try flags.append("-D_LARGEFILE64_SOURCE");
|
||||||
if (use_openssl)
|
if (use_openssl)
|
||||||
try flags.append("-DHAVE_OPENSSL -DFIO_TLS_FOUND");
|
try flags.append("-DHAVE_OPENSSL -DFIO_TLS_FOUND");
|
||||||
|
|
18
flake.lock
generated
18
flake.lock
generated
|
@ -92,11 +92,11 @@
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"dir": "contrib",
|
"dir": "contrib",
|
||||||
"lastModified": 1703884419,
|
"lastModified": 1704461694,
|
||||||
"narHash": "sha256-Cth9deiBGnMhW0+QgaPJ/axiRZT1vGBZOlwLkquucMI=",
|
"narHash": "sha256-dQc9Bkh5uf0R4po3NWnCGx+3eqOZR7iSR4jmRvNNm+E=",
|
||||||
"owner": "neovim",
|
"owner": "neovim",
|
||||||
"repo": "neovim",
|
"repo": "neovim",
|
||||||
"rev": "c5e9acca6471280e32fbcaa30849aa68358155ca",
|
"rev": "c509f4907bf7405c9c2ae3f7eff76c5d552944cc",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -108,11 +108,11 @@
|
||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703875886,
|
"lastModified": 1704290814,
|
||||||
"narHash": "sha256-WJ0s5WWOBUnXAfPwxLm0cI4XjeLXPdI95Znwjrsfd2A=",
|
"narHash": "sha256-LWvKHp7kGxk/GEtlrGYV68qIvPHkU9iToomNFGagixU=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "0fce51a5077927de454b94ffae41c2749fa15ba2",
|
"rev": "70bdadeb94ffc8806c0570eb5c2695ad29f0e421",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -184,11 +184,11 @@
|
||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1703636531,
|
"lastModified": 1704456535,
|
||||||
"narHash": "sha256-gaXmic+so/NhvsXwoiM759HxE41tdFdjuepFmgXhpQE=",
|
"narHash": "sha256-hR5ACOZ59qg2Ghop+fp5DJHfZHy4Mz/7xootwnVoxd0=",
|
||||||
"owner": "mitchellh",
|
"owner": "mitchellh",
|
||||||
"repo": "zig-overlay",
|
"repo": "zig-overlay",
|
||||||
"rev": "d6cc5ac1207d2e4ae717515737fc47a705e57d76",
|
"rev": "b97c02c5de441db91f6de78db1e0077b36e3c869",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
|
Loading…
Add table
Reference in a new issue