| author | |
| committer | |
| log | 3e4f3a1924150e22e0ca87e906681ebadcf8433e |
| tree | 340219e6781f88f6e20b195b8a0bfeeb76db50a2 |
| parent | 939408289cd05ba2f3b90eb626a388b6a5c747c4 |
| signature |
This new option sets a default libc paths file to be used for all
LibExeObjSteps. Setting LibExeObjStep.libc_file overrides this default.
This is required to allow users to cross compile projects linking system
libraries without needing to patch the build.zig.2 files changed, 11 insertions(+), 0 deletions(-)
lib/std/build.zig+4| ... | ... | @@ -58,6 +58,7 @@ pub const Builder = struct { |
| 58 | 58 | h_dir: []const u8, |
| 59 | 59 | install_path: []const u8, |
| 60 | 60 | search_prefixes: ArrayList([]const u8), |
| 61 | libc_file: ?[]const u8 = null, | |
| 61 | 62 | installed_files: ArrayList(InstalledFile), |
| 62 | 63 | build_root: []const u8, |
| 63 | 64 | cache_root: []const u8, |
| ... | ... | @@ -2377,6 +2378,9 @@ pub const LibExeObjStep = struct { |
| 2377 | 2378 | if (self.libc_file) |libc_file| { |
| 2378 | 2379 | try zig_args.append("--libc"); |
| 2379 | 2380 | try zig_args.append(builder.pathFromRoot(libc_file)); |
| 2381 | } else if (builder.libc_file) |libc_file| { | |
| 2382 | try zig_args.append("--libc"); | |
| 2383 | try zig_args.append(libc_file); | |
| 2380 | 2384 | } |
| 2381 | 2385 | |
| 2382 | 2386 | switch (self.build_mode) { |
lib/std/special/build_runner.zig+7| ... | ... | @@ -93,6 +93,12 @@ pub fn main() !void { |
| 93 | 93 | return usageAndErr(builder, false, stderr_stream); |
| 94 | 94 | }; |
| 95 | 95 | builder.addSearchPrefix(search_prefix); |
| 96 | } else if (mem.eql(u8, arg, "--libc")) { | |
| 97 | const libc_file = nextArg(args, &arg_idx) orelse { | |
| 98 | warn("Expected argument after --libc\n\n", .{}); | |
| 99 | return usageAndErr(builder, false, stderr_stream); | |
| 100 | }; | |
| 101 | builder.libc_file = libc_file; | |
| 96 | 102 | } else if (mem.eql(u8, arg, "--color")) { |
| 97 | 103 | const next_arg = nextArg(args, &arg_idx) orelse { |
| 98 | 104 | warn("expected [auto|on|off] after --color", .{}); |
| ... | ... | @@ -190,6 +196,7 @@ fn usage(builder: *Builder, already_ran_build: bool, out_stream: anytype) !void |
| 190 | 196 | \\ --verbose Print commands before executing them |
| 191 | 197 | \\ -p, --prefix [path] Override default install prefix |
| 192 | 198 | \\ --search-prefix [path] Add a path to look for binaries, libraries, headers |
| 199 | \\ --libc [file] Provide a file which specifies libc paths | |
| 193 | 200 | \\ --color [auto|off|on] Enable or disable colored error messages |
| 194 | 201 | \\ |
| 195 | 202 | \\Project-Specific Options: |