mirror of
https://github.com/ziglang/zig.git
synced 2026-02-13 04:48:20 +00:00
std/build: add --sysroot general option
This commit is contained in:
parent
260c5aed86
commit
f9171bf542
@ -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{
|
||||
|
||||
@ -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
|
||||
\\
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user