Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for Zig breaking change: per-Module #47

Closed
moderation opened this issue Jan 9, 2024 · 1 comment
Closed

Update for Zig breaking change: per-Module #47

moderation opened this issue Jan 9, 2024 · 1 comment

Comments

@moderation
Copy link
Contributor

No longer able to build on latest Zig - ziglang/zig#18160

@moderation
Copy link
Contributor Author

moderation commented Jan 9, 2024

This is working for me but it may but removes the platform check that would prevent building on MacOS

diff --git a/build.zig b/build.zig
index 263a1f9..b2622e7 100644
--- a/build.zig
+++ b/build.zig
@@ -7,15 +7,14 @@ pub fn build(b: *std.Build) void {
     const exe = b.addExecutable(.{
         .name = "poop",
         .root_source_file = .{ .path = "src/main.zig" },
+        .strip = b.option(bool, "strip", "strip the binary") orelse switch (optimize) {
+            .Debug, .ReleaseSafe => false,
+            .ReleaseFast, .ReleaseSmall => true,
+        },
         .target = target,
         .optimize = optimize,
     });

-    exe.strip = b.option(bool, "strip", "strip the binary") orelse switch (optimize) {
-        .Debug, .ReleaseSafe => false,
-        .ReleaseFast, .ReleaseSmall => true,
-    };
-
     b.installArtifact(exe);

     const release = b.step("release", "make an upstream binary release");
@@ -26,12 +25,9 @@ pub fn build(b: *std.Build) void {
         const rel_exe = b.addExecutable(.{
             .name = "poop",
             .root_source_file = .{ .path = "src/main.zig" },
-            .target = std.zig.CrossTarget.parse(.{
-                .arch_os_abi = target_string,
-            }) catch unreachable,
+            .target = target,
             .optimize = .ReleaseSafe,
         });
-        rel_exe.strip = true;

         const install = b.addInstallArtifact(rel_exe, .{});
         install.dest_dir = .prefix;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant