╭─────────────╮ │scroll to top│ ╰─────────────╯ ╭ update_mingw.zig ─────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
102 fail = true; 103 }, 104 }; 105 } 106 107 if (fail) std.process.exit(1); 108 } 109 } 110 111 { 112 // Also add all new def and def.in files. 113 var walker = try src_crt_dir.walkSelectively(arena); 114 defer walker.deinit(); 115 116 var fail = false; 117 118 while (try walker.next(io)) |entry| { 119 switch (entry.kind) { 120 .directory => { 121 switch (entry.depth()) { 122 1 => if (def_dirs.has(entry.basename)) { 123 try walker.enter(io, entry); 124 continue; 125 }, 126 else => { 127 // The top-level directory was already validated 128 try walker.enter(io, entry); 129 continue; 130 }, 131 } 132 }, 133 .file => {}, 134 else => continue, 135 } 136 137 const ok_ext = for (def_exts) |ext| { 138 if (std.mem.endsWith(u8, entry.path, ext)) break true; 139 } else false; 140 141 if (!ok_ext) continue; 142 143 const blacklisted = for (blacklisted_defs) |item| { 144 if (std.mem.eql(u8, entry.basename, item)) break true; 145 } else false; 146 147 if (blacklisted) continue; 148 149 if (std.mem.endsWith(u8, entry.basename, "_windowsapp.def")) 150 continue; 151 152 if (std.mem.endsWith(u8, entry.basename, "_onecore.def")) 153 continue; 154 155 src_crt_dir.copyFile(entry.path, dest_crt_dir, entry.path, io, .{}) catch |err| { 156 std.log.err("unable to copy {s}: {t}", .{ entry.path, err }); 157 fail = true; 158 }; 159 } 160 if (fail) std.process.exit(1); 161 } 162 163 return std.process.cleanExit(io); 164 } 165 166 const kept_crt_files = [_][]const u8{ 167 "COPYING", 168 "include" ++ Dir.path.sep_str ++ "config.h", 169 }; 170 171 const def_exts = [_][]const u8{ 172 ".def", 173 ".def.in", 174 }; 175 176 const def_dirs = std.StaticStringMap(void).initComptime(.{ 177 .{"lib32"}, 178 .{"lib64"}, 179 .{"libarm32"}, 180 .{"libarm64"}, 181 .{"lib-common"}, 182 .{"def-include"}, 183 }); 184 185 const blacklisted_defs = [_][]const u8{ 186 "crtdll.def.in", 187 188 "msvcp60.def", 189 "msvcp110.def", 190 "msvcp120_app.def.in", 191 "msvcp120_clr0400.def", 192 193 "msvcr40d.def.in", 194 "msvcr70.def.in", 195 "msvcr70d.def.in", 196 "msvcr71.def.in", 197 "msvcr71d.def.in", 198 "msvcr80.def.in", 199 "msvcr80d.def.in", 200 "msvcr90.def.in", 201 "msvcr90d.def.in", 202 "msvcr100.def.in", 203 "msvcr100d.def.in", 204 "msvcr110.def.in", 205 "msvcr110d.def.in", 206 "msvcr120.def.in", 207 "msvcr120d.def.in", 208 "msvcr120_app.def.in", 209 210 "msvcrt.def.in", 211 "msvcrtd.def.in", 212 "msvcrt10.def.in", 213 "msvcrt20.def.in", 214 "msvcrt40.def.in", 215 }; 216