produce stripped bin output on demand

a resonably good output is now produced with the following:

    zig build -Drelease-safe -Dstrip
master
alex 2 years ago
parent b7ac8947d8
commit cd10394191

@ -3,6 +3,10 @@ const std = @import("std");
pub fn build(b: *std.build.Builder) void { pub fn build(b: *std.build.Builder) void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions(); 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"); const libsegfault = b.addStaticLibrary("segfault", "src/segfault.zig");
libsegfault.setTarget(target); libsegfault.setTarget(target);
@ -12,6 +16,7 @@ pub fn build(b: *std.build.Builder) void {
const exe = b.addExecutable("st", null); const exe = b.addExecutable("st", null);
exe.setTarget(target); exe.setTarget(target);
exe.setBuildMode(mode); exe.setBuildMode(mode);
exe.strip = do_strip;
exe.install(); exe.install();
exe.linkLibrary(libsegfault); exe.linkLibrary(libsegfault);
exe.linkSystemLibrary("fontconfig"); exe.linkSystemLibrary("fontconfig");

Loading…
Cancel
Save