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 {...@@ -57,6 +57,7 @@ pub const Builder = struct {
57 exe_dir: []const u8,57 exe_dir: []const u8,
58 h_dir: []const u8,58 h_dir: []const u8,
59 install_path: []const u8,59 install_path: []const u8,
60 sysroot: ?[]const u8 = null,
60 search_prefixes: ArrayList([]const u8),61 search_prefixes: ArrayList([]const u8),
61 libc_file: ?[]const u8 = null,62 libc_file: ?[]const u8 = null,
62 installed_files: ArrayList(InstalledFile),63 installed_files: ArrayList(InstalledFile),
...@@ -2601,6 +2602,10 @@ pub const LibExeObjStep = struct {...@@ -2601,6 +2602,10 @@ pub const LibExeObjStep = struct {
2601 }2602 }
2602 }2603 }
26032604
2605 if (builder.sysroot) |sysroot| {
2606 try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot });
2607 }
2608
2604 for (builder.search_prefixes.items) |search_prefix| {2609 for (builder.search_prefixes.items) |search_prefix| {
2605 try zig_args.append("-L");2610 try zig_args.append("-L");
2606 try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{2611 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 {...@@ -87,6 +87,12 @@ pub fn main() !void {
87 warn("Expected argument after {s}\n\n", .{arg});87 warn("Expected argument after {s}\n\n", .{arg});
88 return usageAndErr(builder, false, stderr_stream);88 return usageAndErr(builder, false, stderr_stream);
89 };89 };
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;
90 } else if (mem.eql(u8, arg, "--search-prefix")) {96 } else if (mem.eql(u8, arg, "--search-prefix")) {
91 const search_prefix = nextArg(args, &arg_idx) orelse {97 const search_prefix = nextArg(args, &arg_idx) orelse {
92 warn("Expected argument after --search-prefix\n\n", .{});98 warn("Expected argument after --search-prefix\n\n", .{});
...@@ -195,6 +201,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void...@@ -195,6 +201,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
195 \\ -h, --help Print this help and exit201 \\ -h, --help Print this help and exit
196 \\ --verbose Print commands before executing them202 \\ --verbose Print commands before executing them
197 \\ -p, --prefix [path] Override default install prefix203 \\ -p, --prefix [path] Override default install prefix
204 \\ --sysroot [path] Set the system root directory (usually /)
198 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers205 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
199 \\ --libc [file] Provide a file which specifies libc paths206 \\ --libc [file] Provide a file which specifies libc paths
200 \\ --color [auto|off|on] Enable or disable colored error messages207 \\ --color [auto|off|on] Enable or disable colored error messages