authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-07 11:31:07-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-07-07 11:31:07-04:00
logd39dcd6d9db2faf18287b2ff734ffda0d4080e5a
tree3da1f9e69b9bd4d98c0cb4a63d16c5e40a2b958d
parent38ba4127290d860cadcf078eeda7213094f6c3c7
signaturelock-open Commit is signed but in an unrecognized format.

zig build: add setLibCFile API


1 files changed, 12 insertions(+), 0 deletions(-)

std/build.zig+12
...@@ -1053,6 +1053,8 @@ pub const LibExeObjStep = struct {...@@ -1053,6 +1053,8 @@ pub const LibExeObjStep = struct {
1053 installed_path: ?[]const u8,1053 installed_path: ?[]const u8,
1054 install_step: ?*InstallArtifactStep,1054 install_step: ?*InstallArtifactStep,
10551055
1056 libc_file: ?[]const u8,
1057
1056 const LinkObject = union(enum) {1058 const LinkObject = union(enum) {
1057 StaticPath: []const u8,1059 StaticPath: []const u8,
1058 OtherStep: *LibExeObjStep,1060 OtherStep: *LibExeObjStep,
...@@ -1146,6 +1148,7 @@ pub const LibExeObjStep = struct {...@@ -1146,6 +1148,7 @@ pub const LibExeObjStep = struct {
1146 .single_threaded = false,1148 .single_threaded = false,
1147 .installed_path = null,1149 .installed_path = null,
1148 .install_step = null,1150 .install_step = null,
1151 .libc_file = null,
1149 };1152 };
1150 self.computeOutFileNames();1153 self.computeOutFileNames();
1151 return self;1154 return self;
...@@ -1321,6 +1324,10 @@ pub const LibExeObjStep = struct {...@@ -1321,6 +1324,10 @@ pub const LibExeObjStep = struct {
1321 self.disable_gen_h = value;1324 self.disable_gen_h = value;
1322 }1325 }
13231326
1327 pub fn setLibCFile(self: *LibExeObjStep, libc_file: ?[]const u8) void {
1328 self.libc_file = libc_file;
1329 }
1330
1324 /// Unless setOutputDir was called, this function must be called only in1331 /// Unless setOutputDir was called, this function must be called only in
1325 /// the make step, from a step that has declared a dependency on this one.1332 /// the make step, from a step that has declared a dependency on this one.
1326 /// To run an executable built with zig build, use `run`, or create an install step and invoke it.1333 /// 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 {...@@ -1525,6 +1532,11 @@ pub const LibExeObjStep = struct {
1525 try zig_args.append("--single-threaded");1532 try zig_args.append("--single-threaded");
1526 }1533 }
15271534
1535 if (self.libc_file) |libc_file| {
1536 try zig_args.append("--libc");
1537 try zig_args.append(builder.pathFromRoot(libc_file));
1538 }
1539
1528 switch (self.build_mode) {1540 switch (self.build_mode) {
1529 builtin.Mode.Debug => {},1541 builtin.Mode.Debug => {},
1530 builtin.Mode.ReleaseSafe => zig_args.append("--release-safe") catch unreachable,1542 builtin.Mode.ReleaseSafe => zig_args.append("--release-safe") catch unreachable,