Skip to content

Commit fe81658

Browse files
gHashTagona-agent
andcommitted
Fix build_zig15.zig for Zig 0.15.x API changes
- addStaticLibrary -> addLibrary with linkage = .static - addModule -> createModule for library module - Rename targets variable to avoid shadowing Co-authored-by: Ona <no-reply@ona.com>
1 parent 20f7075 commit fe81658

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

build_zig15.zig

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
11
const std = @import("std");
22

3+
// Build file for Zig 0.15.x
4+
// For Zig 0.13.x use build.zig
5+
36
pub fn build(b: *std.Build) void {
47
const target = b.standardTargetOptions(.{});
58
const optimize = b.standardOptimizeOption(.{});
69

7-
// Library module
8-
const trinity_mod = b.addModule("trinity", .{
10+
// Library module for imports
11+
const trinity_mod = b.createModule(.{
912
.root_source_file = b.path("src/trinity.zig"),
1013
.target = target,
1114
.optimize = optimize,
1215
});
1316

1417
// Library artifact
15-
const lib = b.addStaticLibrary(.{
18+
const lib = b.addLibrary(.{
1619
.name = "trinity",
20+
.linkage = .static,
1721
.root_module = b.createModule(.{
1822
.root_source_file = b.path("src/trinity.zig"),
1923
.target = target,
@@ -159,14 +163,14 @@ pub fn build(b: *std.Build) void {
159163
// Cross-platform release builds
160164
const release_step = b.step("release", "Build release binaries for all platforms");
161165

162-
const targets: []const std.Target.Query = &.{
166+
const targets_list: []const std.Target.Query = &.{
163167
.{ .cpu_arch = .x86_64, .os_tag = .linux },
164168
.{ .cpu_arch = .x86_64, .os_tag = .macos },
165169
.{ .cpu_arch = .aarch64, .os_tag = .macos },
166170
.{ .cpu_arch = .x86_64, .os_tag = .windows },
167171
};
168172

169-
for (targets) |t| {
173+
for (targets_list) |t| {
170174
const release_target = b.resolveTargetQuery(t);
171175
const release_exe = b.addExecutable(.{
172176
.name = "firebird",

0 commit comments

Comments
 (0)