From d39dcd6d9db2faf18287b2ff734ffda0d4080e5a Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Sun, 7 Jul 2019 11:31:07 -0400 Subject: zig build: add setLibCFile API --- std/build.zig | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'std') diff --git a/std/build.zig b/std/build.zig index 4cebfb0436..7387bb11ae 100644 --- a/std/build.zig +++ b/std/build.zig @@ -1053,6 +1053,8 @@ pub const LibExeObjStep = struct { installed_path: ?[]const u8, install_step: ?*InstallArtifactStep, + libc_file: ?[]const u8, + const LinkObject = union(enum) { StaticPath: []const u8, OtherStep: *LibExeObjStep, @@ -1146,6 +1148,7 @@ pub const LibExeObjStep = struct { .single_threaded = false, .installed_path = null, .install_step = null, + .libc_file = null, }; self.computeOutFileNames(); return self; @@ -1321,6 +1324,10 @@ pub const LibExeObjStep = struct { self.disable_gen_h = value; } + pub fn setLibCFile(self: *LibExeObjStep, libc_file: ?[]const u8) void { + self.libc_file = libc_file; + } + /// Unless setOutputDir was called, this function must be called only in /// the make step, from a step that has declared a dependency on this one. /// To run an executable built with zig build, use `run`, or create an install step and invoke it. @@ -1525,6 +1532,11 @@ pub const LibExeObjStep = struct { try zig_args.append("--single-threaded"); } + if (self.libc_file) |libc_file| { + try zig_args.append("--libc"); + try zig_args.append(builder.pathFromRoot(libc_file)); + } + switch (self.build_mode) { builtin.Mode.Debug => {}, builtin.Mode.ReleaseSafe => zig_args.append("--release-safe") catch unreachable, -- cgit v1.2.3