From 3ab42c3f65e889c70024a59cc6dd6d94ab72e616 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Fri, 10 Apr 2026 20:04:22 +0300 Subject: [PATCH] build: don't archive libcombat Signed-off-by: NotAShelf Change-Id: I39a9ff0e253cf277bf4959a16e05fcff6a6a6964 --- build.zig | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build.zig b/build.zig index 807f0af..76a85b1 100644 --- a/build.zig +++ b/build.zig @@ -49,8 +49,10 @@ pub fn build(b: *std.Build) void { // utils.h is co-located with map.c map_lib.addIncludePath(b.path("libs/map")); - // Zig combat library - const combat_lib = b.addLibrary(.{ + // Zig combat library. This must be compiled as an object and linked + // directly to bypassing the archive step, or it yields a corrupt + // archive that forces the user to clear the cache each time. + const combat_obj = b.addObject(.{ .name = "combat", .root_module = b.createModule(.{ .root_source_file = b.path("libs/combat/combat.zig"), @@ -60,8 +62,8 @@ pub fn build(b: *std.Build) void { }), }); // common.h and settings.h live in src/; rng.h exposed bare from libs/rng - combat_lib.addIncludePath(b.path("src")); - combat_lib.addIncludePath(b.path("libs/rng")); + combat_obj.addIncludePath(b.path("src")); + combat_obj.addIncludePath(b.path("libs/rng")); // C sources remaining in src/ const c_sources = [_][]const u8{ @@ -96,7 +98,7 @@ pub fn build(b: *std.Build) void { exe.linkLibrary(rng_lib); exe.linkLibrary(map_lib); - exe.linkLibrary(combat_lib); + exe.addObject(combat_obj); exe.linkSystemLibrary("raylib"); exe.linkSystemLibrary("m"); exe.linkSystemLibrary("pthread");