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");...@@ -11,8 +11,6 @@ const link = @import("link.zig");
11const Package = @import("Package.zig");11const Package = @import("Package.zig");
12const zir = @import("zir.zig");12const zir = @import("zir.zig");
1313
14const LibCInstallation = @import("libc_installation.zig").LibCInstallation;
15
16// TODO Improve async I/O enough that we feel comfortable doing this.14// TODO Improve async I/O enough that we feel comfortable doing this.
17//pub const io_mode = .evented;15//pub const io_mode = .evented;
1816
...@@ -33,7 +31,6 @@ const usage =...@@ -33,7 +31,6 @@ const usage =
33 \\ build-lib [source] Create library from source or object files31 \\ build-lib [source] Create library from source or object files
34 \\ build-obj [source] Create object from source or assembly32 \\ build-obj [source] Create object from source or assembly
35 \\ fmt [source] Parse file and render in canonical zig format33 \\ fmt [source] Parse file and render in canonical zig format
36 \\ libc [paths_file] Display native libc paths file or validate one
37 \\ targets List available compilation targets34 \\ targets List available compilation targets
38 \\ version Print version number and exit35 \\ version Print version number and exit
39 \\ zen Print zen of zig and exit36 \\ zen Print zen of zig and exit
...@@ -65,8 +62,6 @@ pub fn main() !void {...@@ -65,8 +62,6 @@ pub fn main() !void {
65 return buildOutputType(gpa, arena, cmd_args, .Obj);62 return buildOutputType(gpa, arena, cmd_args, .Obj);
66 } else if (mem.eql(u8, cmd, "fmt")) {63 } else if (mem.eql(u8, cmd, "fmt")) {
67 return cmdFmt(gpa, cmd_args);64 return cmdFmt(gpa, cmd_args);
68 } else if (mem.eql(u8, cmd, "libc")) {
69 return cmdLibC(gpa, cmd_args);
70 } else if (mem.eql(u8, cmd, "targets")) {65 } else if (mem.eql(u8, cmd, "targets")) {
71 const info = try std.zig.system.NativeTargetInfo.detect(arena, .{});66 const info = try std.zig.system.NativeTargetInfo.detect(arena, .{});
72 const stdout = io.getStdOut().outStream();67 const stdout = io.getStdOut().outStream();
...@@ -535,41 +530,6 @@ const Fmt = struct {...@@ -535,41 +530,6 @@ const Fmt = struct {
535 const SeenMap = std.BufSet;530 const SeenMap = std.BufSet;
536};531};
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
573pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void {533pub fn cmdFmt(gpa: *Allocator, args: []const []const u8) !void {
574 const stderr_file = io.getStdErr();534 const stderr_file = io.getStdErr();
575 var color: Color = .Auto;535 var color: Color = .Auto;