| ... | ... | @@ -9,6 +9,8 @@ const is_darwin = Target.current.isDarwin(); |
| 9 | 9 | const is_windows = Target.current.os.tag == .windows; |
| 10 | 10 | const is_gnu = Target.current.isGnu(); |
| 11 | 11 | |
| 12 | const log = std.log.scoped(.libc_installation); |
| 13 | |
| 12 | 14 | usingnamespace @import("windows_sdk.zig"); |
| 13 | 15 | |
| 14 | 16 | /// See the render function implementation for documentation of the fields. |
| ... | ... | @@ -37,7 +39,6 @@ pub const LibCInstallation = struct { |
| 37 | 39 | pub fn parse( |
| 38 | 40 | allocator: *Allocator, |
| 39 | 41 | libc_file: []const u8, |
| 40 | | stderr: anytype, |
| 41 | 42 | ) !LibCInstallation { |
| 42 | 43 | var self: LibCInstallation = .{}; |
| 43 | 44 | |
| ... | ... | @@ -62,7 +63,7 @@ pub const LibCInstallation = struct { |
| 62 | 63 | if (line.len == 0 or line[0] == '#') continue; |
| 63 | 64 | var line_it = std.mem.split(line, "="); |
| 64 | 65 | const name = line_it.next() orelse { |
| 65 | | try stderr.print("missing equal sign after field name\n", .{}); |
| 66 | log.err("missing equal sign after field name\n", .{}); |
| 66 | 67 | return error.ParseError; |
| 67 | 68 | }; |
| 68 | 69 | const value = line_it.rest(); |
| ... | ... | @@ -81,31 +82,31 @@ pub const LibCInstallation = struct { |
| 81 | 82 | } |
| 82 | 83 | inline for (fields) |field, i| { |
| 83 | 84 | if (!found_keys[i].found) { |
| 84 | | try stderr.print("missing field: {}\n", .{field.name}); |
| 85 | log.err("missing field: {}\n", .{field.name}); |
| 85 | 86 | return error.ParseError; |
| 86 | 87 | } |
| 87 | 88 | } |
| 88 | 89 | if (self.include_dir == null) { |
| 89 | | try stderr.print("include_dir may not be empty\n", .{}); |
| 90 | log.err("include_dir may not be empty\n", .{}); |
| 90 | 91 | return error.ParseError; |
| 91 | 92 | } |
| 92 | 93 | if (self.sys_include_dir == null) { |
| 93 | | try stderr.print("sys_include_dir may not be empty\n", .{}); |
| 94 | log.err("sys_include_dir may not be empty\n", .{}); |
| 94 | 95 | return error.ParseError; |
| 95 | 96 | } |
| 96 | 97 | if (self.crt_dir == null and !is_darwin) { |
| 97 | | try stderr.print("crt_dir may not be empty for {}\n", .{@tagName(Target.current.os.tag)}); |
| 98 | log.err("crt_dir may not be empty for {}\n", .{@tagName(Target.current.os.tag)}); |
| 98 | 99 | return error.ParseError; |
| 99 | 100 | } |
| 100 | 101 | if (self.msvc_lib_dir == null and is_windows and !is_gnu) { |
| 101 | | try stderr.print("msvc_lib_dir may not be empty for {}-{}\n", .{ |
| 102 | log.err("msvc_lib_dir may not be empty for {}-{}\n", .{ |
| 102 | 103 | @tagName(Target.current.os.tag), |
| 103 | 104 | @tagName(Target.current.abi), |
| 104 | 105 | }); |
| 105 | 106 | return error.ParseError; |
| 106 | 107 | } |
| 107 | 108 | if (self.kernel32_lib_dir == null and is_windows and !is_gnu) { |
| 108 | | try stderr.print("kernel32_lib_dir may not be empty for {}-{}\n", .{ |
| 109 | log.err("kernel32_lib_dir may not be empty for {}-{}\n", .{ |
| 109 | 110 | @tagName(Target.current.os.tag), |
| 110 | 111 | @tagName(Target.current.abi), |
| 111 | 112 | }); |