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-25 19:13:43+02:00
logf9171bf54295df0bd8f4dbe1ab9698e5940ba445
tree9615e89b6c660ed3b3598f9bc54a7986c08975d3
parent260c5aed86d662d2e2bd03c06d123bef9455053d
signature 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),
......@@ -2701,6 +2702,10 @@ pub const LibExeObjStep = struct {
27012702 }
27022703 }
27032704
2705 if (builder.sysroot) |sysroot| {
2706 try zig_args.appendSlice(&[_][]const u8{ "--sysroot", sysroot });
2707 }
2708
27042709 for (builder.search_prefixes.items) |search_prefix| {
27052710 try zig_args.append("-L");
27062711 try zig_args.append(try fs.path.join(builder.allocator, &[_][]const u8{
lib/std/special/build_runner.zig+7
......@@ -104,6 +104,12 @@ pub fn main() !void {
104104 warn("Expected argument after {s}\n\n", .{arg});
105105 return usageAndErr(builder, false, stderr_stream);
106106 };
107 } else if (mem.eql(u8, arg, "--sysroot")) {
108 const sysroot = nextArg(args, &arg_idx) orelse {
109 warn("Expected argument after --sysroot\n\n", .{});
110 return usageAndErr(builder, false, stderr_stream);
111 };
112 builder.sysroot = sysroot;
107113 } else if (mem.eql(u8, arg, "--search-prefix")) {
108114 const search_prefix = nextArg(args, &arg_idx) orelse {
109115 warn("Expected argument after --search-prefix\n\n", .{});
......@@ -214,6 +220,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void
214220 \\ --prefix-exe-dir [path] Override default executable directory path
215221 \\ --prefix-include-dir [path] Override default include directory path
216222 \\
223 \\ --sysroot [path] Set the system root directory (usually /)
217224 \\ --search-prefix [path] Add a path to look for binaries, libraries, headers
218225 \\ --libc [file] Provide a file which specifies libc paths
219226 \\