authorgravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-06-25 14:04:38+02:00
committergravatar for mail@isaacfreund.comIsaac Freund <mail@isaacfreund.com> 2021-06-26 12:51:49+02:00
loge75dfbcb3f1892f67fa9a86157bc503fad300772
tree33d2b2e47d9a063eac3707c82564b58d74fcb6f1
parent16228e87d6d7d8929305083e8c76168603780f5f
signaturelock-open Commit is signed but in an unrecognized format.

std/build: add --sysroot general option


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

lib/std/build.zig+5
......@@ -57,6 +57,7 @@ pub const Builder = struct {
5757 exe_dir: []const u8,
5858 h_dir: []const u8,
5959 install_path: []const u8,
60 sysroot: ?[]const u8 = null,
6061 search_prefixes: ArrayList([]const u8),
6162 libc_file: ?[]const u8 = null,
6263 installed_files: ArrayList(InstalledFile),
......@@ -2601,6 +2602,10 @@ pub const LibExeObjStep = struct {
26012602 }
26022603 }
26032604
2605 if (builder.sysroot) |sysroot| {
2606 try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot });
2607 }
2608
26042609 for (builder.search_prefixes.items) |search_prefix| {
26052610 try zig_args.append("-L");
26062611 try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{
lib/std/special/build_runner.zig+7
......@@ -87,6 +87,12 @@ pub fn main() !void {
8787 warn("Expected argument after {s}\n\n", .{arg});
8888 return usageAndErr(builder, false, stderr_stream);
8989 };
90 } else if (mem.eql(u8, arg, "--sysroot")) {
91 const sysroot = nextArg(args, &arg_idx) orelse {
92 warn("Expected argument after --sysroot\n\n", .{});
93 return usageAndErr(builder, false, stderr_stream);
94 };
95 builder.sysroot = sysroot;
9096 } else if (mem.eql(u8, arg, "--search-prefix")) {
9197 const search_prefix = nextArg(args, &arg_idx) orelse {
9298 warn("Expected argument after --search-prefix\n\n", .{});
......@@ -195,6 +201,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
195201 \\ -h, --help Print this help and exit
196202 \\ --verbose Print commands before executing them
197203 \\ -p, --prefix [path] Override default install prefix
204 \\ --sysroot [path] Set the system root directory (usually /)
198205 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
199206 \\ --libc [file] Provide a file which specifies libc paths
200207 \\ --color [auto|off|on] Enable or disable colored error messages