Commit 3e4f3a1924
2021-06-13 06:49:54
1 parent
9394082Changed files (2)
lib
std
special
lib/std/special/build_runner.zig
@@ -93,6 +93,12 @@ pub fn main() !void {
return usageAndErr(builder, false, stderr_stream);
};
builder.addSearchPrefix(search_prefix);
+ } else if (mem.eql(u8, arg, "--libc")) {
+ const libc_file = nextArg(args, &arg_idx) orelse {
+ warn("Expected argument after --libc\n\n", .{});
+ return usageAndErr(builder, false, stderr_stream);
+ };
+ builder.libc_file = libc_file;
} else if (mem.eql(u8, arg, "--color")) {
const next_arg = nextArg(args, &arg_idx) orelse {
warn("expected [auto|on|off] after --color", .{});
@@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
\\ --verbose Print commands before executing them
\\ -p, --prefix [path] Override default install prefix
\\ --search-prefix [path] Add a path to look for binaries, libraries, headers
+ \\ --libc [file] Provide a file which specifies libc paths
\\ --color [auto|off|on] Enable or disable colored error messages
\\
\\Project-Specific Options:
lib/std/build.zig
@@ -58,6 +58,7 @@ pub const Builder = struct {
h_dir: []const u8,
install_path: []const u8,
search_prefixes: ArrayList([]const u8),
+ libc_file: ?[]const u8 = null,
installed_files: ArrayList(InstalledFile),
build_root: []const u8,
cache_root: []const u8,
@@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct {
if (self.libc_file) |libc_file| {
try zig_args.append("--libc");
try zig_args.append(builder.pathFromRoot(libc_file));
+ } else if (builder.libc_file) |libc_file| {
+ try zig_args.append("--libc");
+ try zig_args.append(libc_file);
}
switch (self.build_mode) {