Skip to content

Commit 62ca20c

Browse files
committed
strip release exes by default
1 parent 28a85bc commit 62ca20c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

build.zig

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,11 @@ pub fn build(b: *std.Build) !void {
1919
break :blk run.addOutputFileArg("build/browse_py.h");
2020
},
2121
.python = b.option([]const u8, "python", "Python interpreter to use for the browse tool") orelse "python",
22+
.strip_override = b.option(bool, "strip", "Strip the ninja exe"),
2223
};
2324

2425
{
25-
const exe = addNinja(b, target, optimize, config);
26+
const exe = addNinja(b, target, optimize, config, .{ .strip_default = false });
2627
b.installArtifact(exe);
2728
}
2829

@@ -69,19 +70,22 @@ const zon: struct {
6970
const NinjaConfig = struct {
7071
browse_py_h: std.Build.LazyPath,
7172
python: []const u8,
73+
strip_override: ?bool,
7274
};
7375

7476
fn addNinja(
7577
b: *std.Build,
7678
target: std.Build.ResolvedTarget,
7779
optimize: std.builtin.OptimizeMode,
7880
config: NinjaConfig,
81+
opt: struct { strip_default: bool },
7982
) *std.Build.Step.Compile {
8083
const upstream = b.dependency("upstream", .{});
8184
const exe = b.addExecutable(.{
8285
.name = "ninja",
8386
.target = target,
8487
.optimize = optimize,
88+
.strip = config.strip_override orelse opt.strip_default,
8589
});
8690
switch (target.result.os.tag) {
8791
.windows => {},
@@ -182,7 +186,7 @@ fn ci(
182186
const target_dest_dir: std.Build.InstallDir = .{ .custom = ci_target_str };
183187
const install = b.step(b.fmt("install-{s}", .{ci_target_str}), "");
184188
ci_step.dependOn(install);
185-
const exe = addNinja(b, target, optimize, config);
189+
const exe = addNinja(b, target, optimize, config, .{ .strip_default = true });
186190
install.dependOn(
187191
&b.addInstallArtifact(exe, .{ .dest_dir = .{ .override = target_dest_dir } }).step,
188192
);

0 commit comments

Comments
 (0)