authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-16 13:25:39-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-05-16 13:25:39-04:00
logb0375978ba54bc80c691eaf118f3a78e7f8920a7
tree81e26969658353f2b414ee69b5ba58b7b56910a3
parentcd5f69794d63ece18cd8f8aa0e2ce8bc16a31ab7

self-hosted: remove `zig libc` command for now

Since it depends on the C++ Windows SDK code. For now, self-hosted is staying pure self hosted, no C/C++ components.

1 files changed, 0 insertions(+), 40 deletions(-)

src-self-hosted/main.zig-40
......@@ -11,8 +11,6 @@ const link = @import("link.zig");
1111const Package = @import("Package.zig");
1212const zir = @import("zir.zig");
1313
14const LibCInstallation = @import("libc_installation.zig").LibCInstallation;
15
1614// TODO Improve async I/O enough that we feel comfortable doing this.
1715//pub const io_mode = .evented;
1816
......@@ -33,7 +31,6 @@ const usage =
3331 \\ build-lib [source] Create library from source or object files
3432 \\ build-obj [source] Create object from source or assembly
3533 \\ fmt [source] Parse file and render in canonical zig format
36 \\ libc [paths_file] Display native libc paths file or validate one
3734 \\ targets List available compilation targets
3835 \\ version Print version number and exit
3936 \\ zen Print zen of zig and exit
......@@ -65,8 +62,6 @@ pub fn main() !void {
6562 return buildOutputType(gpa, arena, cmd_args, .Obj);
6663 } else if (mem.eql(u8, cmd, "fmt")) {
6764 return cmdFmt(gpa, cmd_args);
68 } else if (mem.eql(u8, cmd, "libc")) {
69 return cmdLibC(gpa, cmd_args);
7065 } else if (mem.eql(u8, cmd, "targets")) {
7166 const info = try std.zig.system.NativeTargetInfo.detect(arena, .{});
7267 const stdout = io.getStdOut().outStream();
......@@ -535,41 +530,6 @@ const Fmt = struct {
535530 const SeenMap = std.BufSet;
536531};
537532
538fn 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
550fn 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
573533pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void {
574534 const stderr_file = io.getStdErr();
575535 var color: Color = .Auto;