diff options
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/std/build.zig | 5 | ||||
| -rw-r--r-- | lib/std/special/build_runner.zig | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/std/build.zig b/lib/std/build.zig index 8626d660f0..36a71d5061 100644 --- a/lib/std/build.zig +++ b/lib/std/build.zig @@ -57,6 +57,7 @@ pub const Builder = struct { exe_dir: []const u8, h_dir: []const u8, install_path: []const u8, + sysroot: ?[]const u8 = null, search_prefixes: ArrayList([]const u8), libc_file: ?[]const u8 = null, installed_files: ArrayList(InstalledFile), @@ -2701,6 +2702,10 @@ pub const LibExeObjStep = struct { } } + if (builder.sysroot) |sysroot| { + try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot }); + } + for (builder.search_prefixes.items) |search_prefix| { try zig_args.append("-L"); try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{ diff --git a/lib/std/special/build_runner.zig b/lib/std/special/build_runner.zig index 510dd578c3..7530fae4f0 100644 --- a/lib/std/special/build_runner.zig +++ b/lib/std/special/build_runner.zig @@ -104,6 +104,12 @@ pub fn main() !void { warn("Expected argument after {s}\n\n", .{arg}); return usageAndErr(builder, false, stderr_stream); }; + } else if (mem.eql(u8, arg, "--sysroot")) { + const sysroot = nextArg(args, &arg_idx) orelse { + warn("Expected argument after --sysroot\n\n", .{}); + return usageAndErr(builder, false, stderr_stream); + }; + builder.sysroot = sysroot; } else if (mem.eql(u8, arg, "--search-prefix")) { const search_prefix = nextArg(args, &arg_idx) orelse { warn("Expected argument after --search-prefix\n\n", .{}); @@ -214,6 +220,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void \\ --prefix-exe-dir [path] Override default executable directory path \\ --prefix-include-dir [path] Override default include directory path \\ + \\ --sysroot [path] Set the system root directory (usually /) \\ --search-prefix [path] Add a path to look for binaries, libraries, headers \\ --libc [file] Provide a file which specifies libc paths \\ |
