authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-07 22:15:28-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2024-01-08 11:52:38-07:00
log089ebeb8736e9186c14d8228fa5594c518dcdb4b
treea6ff0c5cb4a5c664079e3810397665d471d3b456
parent6405d37d9f07565d40a8412badafebd44003ed01

update-mingw tool: add config.h to whitelist


1 files changed, 13 insertions(+), 5 deletions(-)

tools/update_mingw.zig+13-5
......@@ -45,13 +45,16 @@ pub fn main() !void {
4545 while (try walker.next()) |entry| {
4646 if (entry.kind != .file) continue;
4747
48 // Special exception to keep the copyright file.
49 if (std.mem.eql(u8, entry.path, "COPYING")) continue;
50
5148 src_crt_dir.copyFile(entry.path, dest_crt_dir, entry.path, .{}) catch |err| switch (err) {
5249 error.FileNotFound => {
53 std.log.warn("deleting {s}", .{entry.path});
54 try dest_crt_dir.deleteFile(entry.path);
50 const whitelisted = for (whitelist) |item| {
51 if (std.mem.eql(u8, entry.path, item)) break true;
52 } else false;
53
54 if (!whitelisted) {
55 std.log.warn("deleting {s}", .{entry.path});
56 try dest_crt_dir.deleteFile(entry.path);
57 }
5558 },
5659 else => {
5760 std.log.err("unable to copy {s}: {s}", .{ entry.path, @errorName(err) });
......@@ -105,6 +108,11 @@ pub fn main() !void {
105108 return std.process.cleanExit();
106109}
107110
111const whitelist = [_][]const u8{
112 "COPYING",
113 "include" ++ std.fs.path.sep_str ++ "config.h",
114};
115
108116const ok_exts = [_][]const u8{
109117 ".def",
110118 ".def.in",