authorgravatar for garrettlennoxbeck@gmail.comGarrett Beck <garrettlennoxbeck@gmail.com> 2023-09-23 09:33:34-05:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-09-23 17:41:11-07:00
log8b78df403fe71ffdf8c39361dd30a3c1171a1f1c
tree4fcef44b2a7545827e276e17f35ce62c5ffb81ce
parent78ebf8f577d865f6382aea718970034215d0678c

Allow Step.TranslateC to not link libc


1 files changed, 6 insertions(+), 1 deletions(-)

lib/std/Build/Step/TranslateC.zig+6-1
......@@ -16,11 +16,13 @@ out_basename: []const u8,
1616target: CrossTarget,
1717optimize: std.builtin.OptimizeMode,
1818output_file: std.Build.GeneratedFile,
19link_libc: bool,
1920
2021pub const Options = struct {
2122 source_file: std.Build.LazyPath,
2223 target: CrossTarget,
2324 optimize: std.builtin.OptimizeMode,
25 link_libc: bool = true,
2426};
2527
2628pub fn create(owner: *std.Build, options: Options) *TranslateC {
......@@ -40,6 +42,7 @@ pub fn create(owner: *std.Build, options: Options) *TranslateC {
4042 .target = options.target,
4143 .optimize = options.optimize,
4244 .output_file = std.Build.GeneratedFile{ .step = &self.step },
45 .link_libc = options.link_libc,
4346 };
4447 source.addStepDependencies(&self.step);
4548 return self;
......@@ -124,7 +127,9 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
124127 var argv_list = std.ArrayList([]const u8).init(b.allocator);
125128 try argv_list.append(b.zig_exe);
126129 try argv_list.append("translate-c");
127 try argv_list.append("-lc");
130 if (self.link_libc) {
131 try argv_list.append("-lc");
132 }
128133
129134 try argv_list.append("--listen=-");
130135