| ... | ... | @@ -4542,9 +4542,22 @@ fn cmdTranslateC( |
| 4542 | 4542 | assert(comp.c_source_files.len == 1); |
| 4543 | 4543 | const c_source_file = comp.c_source_files[0]; |
| 4544 | 4544 | |
| 4545 | | var argv: std.ArrayListUnmanaged([]const u8) = .empty; |
| 4546 | | try argv.append(arena, c_source_file.src_path); |
| 4545 | var zig_cache_tmp_dir = try comp.dirs.local_cache.handle.makeOpenPath("tmp", .{}); |
| 4546 | defer zig_cache_tmp_dir.close(); |
| 4547 | |
| 4548 | const ext = Compilation.classifyFileExt(c_source_file.src_path); |
| 4549 | const out_dep_path: ?[]const u8 = blk: { |
| 4550 | if (comp.disable_c_depfile) break :blk null; |
| 4551 | const c_src_basename = fs.path.basename(c_source_file.src_path); |
| 4552 | const dep_basename = try std.fmt.allocPrint(arena, "{s}.d", .{c_src_basename}); |
| 4553 | const out_dep_path = try comp.tmpFilePath(arena, dep_basename); |
| 4554 | break :blk out_dep_path; |
| 4555 | }; |
| 4547 | 4556 | |
| 4557 | var argv = std.ArrayList([]const u8).init(arena); |
| 4558 | try argv.append("arocc"); |
| 4559 | try comp.addTranslateCCArgs(arena, &argv, ext, out_dep_path, comp.root_mod); |
| 4560 | try argv.append(c_source_file.src_path); |
| 4548 | 4561 | if (comp.verbose_cc) Compilation.dump_argv(argv.items); |
| 4549 | 4562 | |
| 4550 | 4563 | try jitCmd(comp.gpa, arena, argv.items, .{ |
| ... | ... | @@ -4553,6 +4566,23 @@ fn cmdTranslateC( |
| 4553 | 4566 | .depend_on_aro = true, |
| 4554 | 4567 | .progress_node = prog_node, |
| 4555 | 4568 | }); |
| 4569 | |
| 4570 | if (out_dep_path) |dep_file_path| { |
| 4571 | const dep_basename = fs.path.basename(dep_file_path); |
| 4572 | // Add the files depended on to the cache system. |
| 4573 | //man.addDepFilePost(zig_cache_tmp_dir, dep_basename) catch |err| switch (err) { |
| 4574 | // error.FileNotFound => { |
| 4575 | // // Clang didn't emit the dep file; nothing to add to the manifest. |
| 4576 | // break :add_deps; |
| 4577 | // }, |
| 4578 | // else => |e| return e, |
| 4579 | //}; |
| 4580 | // Just to save disk space, we delete the file because it is never needed again. |
| 4581 | zig_cache_tmp_dir.deleteFile(dep_basename) catch |err| { |
| 4582 | warn("failed to delete '{s}': {t}", .{ dep_file_path, err }); |
| 4583 | }; |
| 4584 | } |
| 4585 | |
| 4556 | 4586 | return cleanExit(); |
| 4557 | 4587 | } |
| 4558 | 4588 | |
| ... | ... | @@ -5512,12 +5542,13 @@ fn jitCmd( |
| 5512 | 5542 | child_argv.appendSliceAssumeCapacity(args); |
| 5513 | 5543 | |
| 5514 | 5544 | if (process.can_execv and options.capture == null) { |
| 5545 | if (EnvVar.ZIG_DEBUG_CMD.isSet()) { |
| 5546 | const cmd = try std.mem.join(arena, " ", child_argv.items); |
| 5547 | std.debug.print("{s}\n", .{cmd}); |
| 5548 | } |
| 5515 | 5549 | const err = process.execv(gpa, child_argv.items); |
| 5516 | 5550 | const cmd = try std.mem.join(arena, " ", child_argv.items); |
| 5517 | | fatal("the following command failed to execve with '{s}':\n{s}", .{ |
| 5518 | | @errorName(err), |
| 5519 | | cmd, |
| 5520 | | }); |
| 5551 | fatal("the following command failed to execve with '{t}':\n{s}", .{ err, cmd }); |
| 5521 | 5552 | } |
| 5522 | 5553 | |
| 5523 | 5554 | if (!process.can_spawn) { |