From cd1039419132c9a8ddd474e4154a6f51dd256bb6 Mon Sep 17 00:00:00 2001 From: alex Date: Sun, 31 Jul 2022 00:56:32 +0200 Subject: [PATCH] produce stripped bin output on demand a resonably good output is now produced with the following: zig build -Drelease-safe -Dstrip --- build.zig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/build.zig b/build.zig index d33af43..d887991 100644 --- a/build.zig +++ b/build.zig @@ -3,6 +3,10 @@ const std = @import("std"); pub fn build(b: *std.build.Builder) void { const target = b.standardTargetOptions(.{}); const mode = b.standardReleaseOptions(); + const do_strip = b.option(bool, "strip", "Strip final output; on for release-small") orelse switch (mode) { + .ReleaseSmall => true, + else => false, + }; const libsegfault = b.addStaticLibrary("segfault", "src/segfault.zig"); libsegfault.setTarget(target); @@ -12,6 +16,7 @@ pub fn build(b: *std.build.Builder) void { const exe = b.addExecutable("st", null); exe.setTarget(target); exe.setBuildMode(mode); + exe.strip = do_strip; exe.install(); exe.linkLibrary(libsegfault); exe.linkSystemLibrary("fontconfig");