Skip to content

std.Build: fix issue with emit_h outputting to cwd #15725

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

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
4 changes: 3 additions & 1 deletion lib/std/Build/Step/Compile.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1440,7 +1440,9 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
if (self.emit_llvm_bc.getArg(b, "emit-llvm-bc")) |arg| try zig_args.append(arg);
if (self.emit_llvm_ir.getArg(b, "emit-llvm-ir")) |arg| try zig_args.append(arg);

if (self.emit_h) try zig_args.append("-femit-h");
if (self.emit_h) {
try zig_args.append(try std.fmt.allocPrint(b.allocator, "-femit-h={s}", .{ self.out_h_filename }));
}

try addFlag(&zig_args, "strip", self.strip);
try addFlag(&zig_args, "unwind-tables", self.unwind_tables);
Expand Down
13 changes: 0 additions & 13 deletions lib/std/Build/Step/InstallArtifact.zig
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ pub fn create(owner: *std.Build, artifact: *Step.Compile) *InstallArtifact {
if (self.pdb_dir) |pdb_dir| {
owner.pushInstalledFile(pdb_dir, artifact.out_pdb_filename);
}
if (self.h_dir) |h_dir| {
owner.pushInstalledFile(h_dir, artifact.out_h_filename);
}
return self;
}

Expand Down Expand Up @@ -114,16 +111,6 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
};
all_cached = all_cached and p == .fresh;
}
if (self.h_dir) |h_dir| {
const full_src_path = self.artifact.getOutputHSource().getPath(src_builder);
const full_h_path = dest_builder.getInstallPath(h_dir, self.artifact.out_h_filename);
const p = fs.Dir.updateFile(cwd, full_src_path, cwd, full_h_path, .{}) catch |err| {
return step.fail("unable to update file from '{s}' to '{s}': {s}", .{
full_src_path, full_h_path, @errorName(err),
});
};
all_cached = all_cached and p == .fresh;
}
self.artifact.installed_path = full_dest_path;
step.result_cached = all_cached;
}