| ... | ... | @@ -11,8 +11,6 @@ const link = @import("link.zig"); |
| 11 | 11 | const Package = @import("Package.zig"); |
| 12 | 12 | const zir = @import("zir.zig"); |
| 13 | 13 | |
| 14 | | const LibCInstallation = @import("libc_installation.zig").LibCInstallation; |
| 15 | | |
| 16 | 14 | // TODO Improve async I/O enough that we feel comfortable doing this. |
| 17 | 15 | //pub const io_mode = .evented; |
| 18 | 16 | |
| ... | ... | @@ -33,7 +31,6 @@ const usage = |
| 33 | 31 | \\ build-lib [source] Create library from source or object files |
| 34 | 32 | \\ build-obj [source] Create object from source or assembly |
| 35 | 33 | \\ fmt [source] Parse file and render in canonical zig format |
| 36 | | \\ libc [paths_file] Display native libc paths file or validate one |
| 37 | 34 | \\ targets List available compilation targets |
| 38 | 35 | \\ version Print version number and exit |
| 39 | 36 | \\ zen Print zen of zig and exit |
| ... | ... | @@ -65,8 +62,6 @@ pub fn main() !void { |
| 65 | 62 | return buildOutputType(gpa, arena, cmd_args, .Obj); |
| 66 | 63 | } else if (mem.eql(u8, cmd, "fmt")) { |
| 67 | 64 | return cmdFmt(gpa, cmd_args); |
| 68 | | } else if (mem.eql(u8, cmd, "libc")) { |
| 69 | | return cmdLibC(gpa, cmd_args); |
| 70 | 65 | } else if (mem.eql(u8, cmd, "targets")) { |
| 71 | 66 | const info = try std.zig.system.NativeTargetInfo.detect(arena, .{}); |
| 72 | 67 | const stdout = io.getStdOut().outStream(); |
| ... | ... | @@ -535,41 +530,6 @@ const Fmt = struct { |
| 535 | 530 | const SeenMap = std.BufSet; |
| 536 | 531 | }; |
| 537 | 532 | |
| 538 | | fn parseLibcPaths(gpa: *Allocator, libc: *LibCInstallation, libc_paths_file: []const u8) void { |
| 539 | | const stderr = io.getStdErr().outStream(); |
| 540 | | libc.* = LibCInstallation.parse(gpa, libc_paths_file, stderr) catch |err| { |
| 541 | | stderr.print("Unable to parse libc path file '{}': {}.\n" ++ |
| 542 | | "Try running `zig libc` to see an example for the native target.\n", .{ |
| 543 | | libc_paths_file, |
| 544 | | @errorName(err), |
| 545 | | }) catch {}; |
| 546 | | process.exit(1); |
| 547 | | }; |
| 548 | | } |
| 549 | | |
| 550 | | fn cmdLibC(gpa: *Allocator, args: []const []const u8) !void { |
| 551 | | const stderr = io.getStdErr().outStream(); |
| 552 | | switch (args.len) { |
| 553 | | 0 => {}, |
| 554 | | 1 => { |
| 555 | | var libc_installation: LibCInstallation = undefined; |
| 556 | | parseLibcPaths(gpa, &libc_installation, args[0]); |
| 557 | | return; |
| 558 | | }, |
| 559 | | else => { |
| 560 | | try stderr.print("unexpected extra parameter: {}\n", .{args[1]}); |
| 561 | | process.exit(1); |
| 562 | | }, |
| 563 | | } |
| 564 | | |
| 565 | | const libc = LibCInstallation.findNative(.{ .allocator = gpa }) catch |err| { |
| 566 | | stderr.print("unable to find libc: {}\n", .{@errorName(err)}) catch {}; |
| 567 | | process.exit(1); |
| 568 | | }; |
| 569 | | |
| 570 | | libc.render(io.getStdOut().outStream()) catch process.exit(1); |
| 571 | | } |
| 572 | | |
| 573 | 533 | pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void { |
| 574 | 534 | const stderr_file = io.getStdErr(); |
| 575 | 535 | var color: Color = .Auto; |