Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ pub fn build(b: *std.Build) !void {
break :blk run.addOutputFileArg("build/browse_py.h");
},
.python = b.option([]const u8, "python", "Python interpreter to use for the browse tool") orelse "python",
.strip_override = b.option(bool, "strip", "Strip the ninja exe"),
};

{
const exe = addNinja(b, target, optimize, config);
const exe = addNinja(b, target, optimize, config, .{ .strip_default = false });
b.installArtifact(exe);
}

Expand Down Expand Up @@ -69,19 +70,22 @@ const zon: struct {
const NinjaConfig = struct {
browse_py_h: std.Build.LazyPath,
python: []const u8,
strip_override: ?bool,
};

fn addNinja(
b: *std.Build,
target: std.Build.ResolvedTarget,
optimize: std.builtin.OptimizeMode,
config: NinjaConfig,
opt: struct { strip_default: bool },
) *std.Build.Step.Compile {
const upstream = b.dependency("upstream", .{});
const exe = b.addExecutable(.{
.name = "ninja",
.target = target,
.optimize = optimize,
.strip = config.strip_override orelse opt.strip_default,
});
switch (target.result.os.tag) {
.windows => {},
Expand Down Expand Up @@ -182,7 +186,7 @@ fn ci(
const target_dest_dir: std.Build.InstallDir = .{ .custom = ci_target_str };
const install = b.step(b.fmt("install-{s}", .{ci_target_str}), "");
ci_step.dependOn(install);
const exe = addNinja(b, target, optimize, config);
const exe = addNinja(b, target, optimize, config, .{ .strip_default = true });
install.dependOn(
&b.addInstallArtifact(exe, .{ .dest_dir = .{ .override = target_dest_dir } }).step,
);
Expand Down Expand Up @@ -217,7 +221,6 @@ fn makeCiArchiveStep(
const zip = b.addRunArtifact(host_zip_exe);
zip.addArg(out_zip_file);
zip.addArg("ninja.exe");
zip.addArg("ninja.pdb");
zip.cwd = .{ .cwd_relative = b.getInstallPath(
target_install_dir,
".",
Expand Down
Loading