╭ mingw.zig ────────────────────────────────────────────────────╮ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ │ ╰───────────────────────────────────────────────────────────────╯
╭ find file ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╮ ╭────╮ ╭ clone ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╮ │ │ │http│ ssh │ │ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─╯ ╰────╯ ╰ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ╯
1 const std = @import("std"); 2 const Io = std.Io; 3 const Allocator = std.mem.Allocator; 4 const mem = std.mem; 5 const path = std.Io.Dir.path; 6 const assert = std.debug.assert; 7 const log = std.log.scoped(.mingw); 8 9 const builtin = @import("builtin"); 10 const Compilation = @import("../Compilation.zig"); 11 const build_options = @import("build_options"); 12 const Cache = std.Build.Cache; 13 const dev = @import("../dev.zig"); 14 const def = @import("mingw/def.zig"); 15 const implib = @import("mingw/implib.zig"); 16 17 const Preprocessor = @import("mingw/Preprocessor.zig"); 18 19 test { 20 _ = def; 21 _ = implib; 22 _ = Preprocessor; 23 } 24 25 pub const CrtFile = enum { 26 crt2_o, 27 dllcrt2_o, 28 libmingw32_lib, 29 }; 30 31 /// TODO replace anyerror with explicit error set, recording user-friendly errors with 32 /// lockAndSetMiscFailure and returning error.AlreadyReported. see libcxx.zig for example. 33 pub fn buildCrtFile(comp: *Compilation, crt_file: CrtFile, prog_node: std.Progress.Node) anyerror!void { 34 if (!build_options.have_llvm) { 35 return error.ZigCompilerNotBuiltWithLLVMExtensions; 36 } 37 var arena_allocator = std.heap.ArenaAllocator.init(comp.gpa); 38 defer arena_allocator.deinit(); 39 const arena = arena_allocator.allocator(); 40 const target = comp.getTarget(); 41 42 switch (crt_file) { 43 .crt2_o => { 44 var args = std.array_list.Managed([]const u8).init(arena); 45 try addCrtCcArgs(comp, arena, &args); 46 if (comp.mingw_unicode_entry_point) { 47 try args.appendSlice(&.{ "-DUNICODE", "-D_UNICODE" }); 48 } 49 var files = [_]Compilation.CSourceFile{ 50 .{ 51 .src_path = try comp.dirs.zig_lib.join(arena, &.{ 52 "libc", "mingw", "crt", "crtexe.c", 53 }), 54 .extra_flags = args.items, 55 .owner = undefined, 56 }, 57 }; 58 return comp.build_crt_file("crt2", .Obj, .@"mingw-w64 crt2.o", prog_node, &files, .{ 59 .function_sections = false, // https://codeberg.org/ziglang/zig/issues/30702 60 }); 61 }, 62 63 .dllcrt2_o => { 64 var args = std.array_list.Managed([]const u8).init(arena); 65 try addCrtCcArgs(comp, arena, &args); 66 var files = [_]Compilation.CSourceFile{ 67 .{ 68 .src_path = try comp.dirs.zig_lib.join(arena, &.{ 69 "libc", "mingw", "crt", "crtdll.c", 70 }), 71 .extra_flags = args.items, 72 .owner = undefined, 73 }, 74 }; 75 return comp.build_crt_file("dllcrt2", .Obj, .@"mingw-w64 dllcrt2.o", prog_node, &files, .{}); 76 }, 77 78 .libmingw32_lib => { 79 var c_source_files = std.array_list.Managed(Compilation.CSourceFile).init(arena); 80 81 { 82 var crt_args = std.array_list.Managed([]const u8).init(arena); 83 try addCrtCcArgs(comp, arena, &crt_args); 84 85 for (mingw32_generic_src) |dep| { 86 try c_source_files.append(.{ 87 .src_path = try comp.dirs.zig_lib.join(arena, &.{ 88 "libc", "mingw", dep, 89 }), 90 .extra_flags = crt_args.items, 91 .owner = undefined, 92 }); 93 } 94 if (target.cpu.arch.isX86()) { 95 for (mingw32_x86_src) |dep| { 96 try c_source_files.append(.{ 97 .src_path = try comp.dirs.zig_lib.join(arena, &.{ 98 "libc", "mingw", dep, 99 }), 100 .extra_flags = crt_args.items, 101 .owner = undefined, 102 }); 103 } 104 if (target.cpu.arch == .x86) { 105 for (mingw32_x86_32_src) |dep| { 106 try c_source_files.append(.{ 107 .src_path = try comp.dirs.zig_lib.join(arena, &.{ 108 "libc", "mingw", dep, 109 }), 110 .extra_flags = crt_args.items, 111 .owner = undefined, 112 }); 113 } 114 } 115 } else if (target.cpu.arch == .thumb or target.cpu.arch == .aarch64) { 116 for (mingw32_arm_src) |dep| { 117 try c_source_files.append(.{ 118 .src_path = try comp.dirs.zig_lib.join(arena, &.{ 119 "libc", "mingw", dep, 120 }), 121 .extra_flags = crt_args.items, 122 .owner = undefined, 123 }); 124 } 125 } else { 126 @panic("unsupported arch"); 127 } 128 } 129 130 { 131 var winpthreads_args = std.array_list.Managed([]const u8).init(arena); 132 try addCcArgs(comp, arena, &winpthreads_args); 133 try winpthreads_args.appendSlice(&[_][]const u8{ 134 "-DIN_WINPTHREAD", 135 }); 136 137 switch (comp.compilerRtOptMode()) { 138 .debug, .safe => try winpthreads_args.append("-DWINPTHREAD_DBG"), 139 .fast, .small => {}, 140 } 141 142 for (mingw32_winpthreads_src) |dep| { 143 try c_source_files.append(.{ 144 .src_path = try comp.dirs.zig_lib.join(arena, &.{ 145 "libc", "mingw", dep, 146 }), 147 .extra_flags = winpthreads_args.items, 148 .owner = undefined, 149 }); 150 } 151 } 152 153 return comp.build_crt_file("libmingw32", .Lib, .@"mingw-w64 libmingw32.lib", prog_node, c_source_files.items, .{ 154 // https://github.com/llvm/llvm-project/issues/43698#issuecomment-2542660611 155 .allow_lto = false, 156 }); 157 }, 158 } 159 } 160 161 fn addCcArgs( 162 comp: *Compilation, 163 arena: Allocator, 164 args: *std.array_list.Managed([]const u8), 165 ) error{OutOfMemory}!void { 166 try args.appendSlice(&[_][]const u8{ 167 "-w", // Disable all warnings. 168 "-std=gnu11", 169 "-D__USE_MINGW_ANSI_STDIO=0", 170 171 "-isystem", 172 try comp.dirs.zig_lib.join(arena, &.{ "libc", "include", "any-windows-any" }), 173 }); 174 } 175 176 fn addCrtCcArgs( 177 comp: *Compilation, 178 arena: Allocator, 179 args: *std.array_list.Managed([]const u8), 180 ) error{OutOfMemory}!void { 181 try addCcArgs(comp, arena, args); 182 183 if (comp.getTarget().cpu.arch == .thumb) { 184 try args.append("-mfpu=vfp"); 185 } 186 187 try args.appendSlice(&[_][]const u8{ 188 // According to Martin Storsjö, 189 // > the files under mingw-w64-crt are designed to always 190 // be built with __MSVCRT_VERSION__=0x700 191 "-D__MSVCRT_VERSION__=0x700", 192 "-D_CRTBLD", 193 "-D_SYSCRT=1", 194 "-D_WIN32_WINNT=0x0f00", 195 "-DCRTDLL=1", 196 "-DHAVE_CONFIG_H", 197 198 "-I", 199 try comp.dirs.zig_lib.join(arena, &.{ "libc", "mingw", "include" }), 200 }); 201 } 202 203 pub fn buildImportLib(comp: *Compilation, lib_name: []const u8, prog_node: std.Progress.Node) !Cache.Path { 204 dev.check(.build_import_lib); 205 206 log.debug("buildImportLib({s})", .{lib_name}); 207 208 const sub_node = prog_node.start(lib_name, 0); 209 defer sub_node.end(); 210 211 const gpa = comp.gpa; 212 const io = comp.io; 213 214 var arena_allocator = std.heap.ArenaAllocator.init(gpa); 215 defer arena_allocator.deinit(); 216 const arena = arena_allocator.allocator(); 217 218 const def_file_path: Cache.Path = .{ 219 .root_dir = comp.dirs.zig_lib, 220 .sub_path = findDef(arena, io, comp.getTarget(), comp.dirs.zig_lib, lib_name) catch |err| switch (err) { 221 error.FileNotFound => return error.DefNotFound, 222 else => |e| return e, 223 }, 224 }; 225 // Only .def.in files need preprocessing 226 const def_needs_preprocessing = mem.endsWith(u8, def_file_path.sub_path, ".def.in"); 227 228 const target = comp.getTarget(); 229 230 // Use the global cache directory. 231 var cache: Cache = .{ 232 .gpa = gpa, 233 .io = io, 234 .manifest_dir = try comp.dirs.global_cache.handle.createDirPathOpen(io, "h", .{}), 235 .cwd = comp.dirs.cwd, 236 }; 237 cache.addPrefix(.{ .path = null, .handle = Io.Dir.cwd() }); 238 cache.addPrefix(comp.dirs.zig_lib); 239 cache.addPrefix(comp.dirs.global_cache); 240 defer cache.manifest_dir.close(io); 241 242 cache.hash.addBytes(build_options.version); 243 cache.hash.addOptionalBytes(comp.dirs.zig_lib.path); 244 cache.hash.add(target.cpu.arch); 245 246 var man = cache.obtain(); 247 defer man.deinit(); 248 249 _ = try man.addInputPath(def_file_path, .{}); 250 251 const final_lib_basename = try std.fmt.allocPrint(gpa, "{s}.lib", .{lib_name}); 252 errdefer gpa.free(final_lib_basename); 253 254 var diag: Cache.Manifest.CheckDiagnostic = undefined; 255 const status = man.check(&diag, prog_node) catch |err| switch (err) { 256 error.CacheCheckFailed => { 257 comp.lockAndSetMiscFailure(.windows_import_lib, "{s} cache check failed: {f}", .{ 258 final_lib_basename, diag.fmt(&man), 259 }); 260 return error.AlreadyReported; 261 }, 262 error.OutOfMemory, error.Canceled => |e| return e, 263 }; 264 log.debug("{s} cache {f}", .{ final_lib_basename, status.fmt(&man) }); 265 if (status == .hit) { 266 const digest = man.hitDigestHex(); 267 const sub_path = try std.fs.path.join(gpa, &.{ "o", &digest, final_lib_basename }); 268 errdefer gpa.free(sub_path); 269 270 comp.mutex.lockUncancelable(io); 271 defer comp.mutex.unlock(io); 272 try comp.crt_files.ensureUnusedCapacity(gpa, 1); 273 274 const crt_file_path: Cache.Path = .{ 275 .root_dir = comp.dirs.global_cache, 276 .sub_path = sub_path, 277 }; 278 comp.crt_files.putAssumeCapacityNoClobber(final_lib_basename, .{ 279 .full_object_path = crt_file_path, 280 .lock = man.toOwnedLock(), 281 }); 282 return crt_file_path; 283 } 284 285 const digest = man.missDigestHex(); 286 const o_sub_path = try std.fs.path.join(arena, &[_][]const u8{ "o", &digest }); 287 var o_dir = try comp.dirs.global_cache.handle.createDirPathOpen(io, o_sub_path, .{}); 288 defer o_dir.close(io); 289 290 const sep = path.sep_str; 291 const include_dir: Cache.Path = .{ 292 .root_dir = comp.dirs.zig_lib, 293 .sub_path = "libc" ++ sep ++ "mingw" ++ sep ++ "def-include", 294 }; 295 296 const members = members: { 297 const members_node = sub_node.start("Members", 0); 298 defer members_node.end(); 299 300 const input = switch (def_needs_preprocessing) { 301 true => pp: { 302 var aw: Io.Writer.Allocating = .init(gpa); 303 errdefer aw.deinit(); 304 305 var pp_arena = std.heap.ArenaAllocator.init(gpa); 306 defer pp_arena.deinit(); 307 var pp: Preprocessor = .{ 308 .io = io, 309 .arena = pp_arena.allocator(), 310 .include_dir = include_dir, 311 .target = target, 312 }; 313 try pp.preprocess(def_file_path); 314 try pp.prettyPrintTokens(&aw.writer); 315 316 break :pp try aw.toOwnedSliceSentinel(0); 317 }, 318 false => try def_file_path.root_dir.handle.readFileAllocOptions(io, def_file_path.sub_path, gpa, .unlimited, .of(u8), 0), 319 }; 320 defer gpa.free(input); 321 322 const machine_type = target.toCoffMachine(); 323 var def_diagnostics: def.Diagnostics = undefined; 324 var module_def = def.parse(gpa, input, machine_type, .mingw, &def_diagnostics) catch |err| switch (err) { 325 error.OutOfMemory => |e| return e, 326 error.ParseError => { 327 var buffer: [64]u8 = undefined; 328 const stderr = try io.lockStderr(&buffer, null); 329 defer io.unlockStderr(); 330 const w = &stderr.file_writer.interface; 331 try w.writeAll("error: "); 332 try def_diagnostics.writeMsg(w, input); 333 try w.writeByte('\n'); 334 return error.WritingImportLibFailed; 335 }, 336 }; 337 defer module_def.deinit(); 338 339 module_def.fixupForImportLibraryGeneration(machine_type); 340 341 break :members try implib.getMembers(gpa, module_def, machine_type); 342 }; 343 defer members.deinit(); 344 345 const lib_final_path = try std.fs.path.join(gpa, &.{ "o", &digest, final_lib_basename }); 346 errdefer gpa.free(lib_final_path); 347 348 { 349 const lib_final_file = try o_dir.createFile(io, final_lib_basename, .{ .truncate = true }); 350 defer lib_final_file.close(io); 351 var buffer: [1024]u8 = undefined; 352 var file_writer = lib_final_file.writer(io, &buffer); 353 try implib.writeCoffArchive(gpa, &file_writer.interface, members); 354 try file_writer.interface.flush(); 355 } 356 357 man.finalize() catch |err| 358 log.warn("failed to write cache manifest for DLL import {s}.lib: {t}", .{ lib_name, err }); 359 360 comp.mutex.lockUncancelable(io); 361 defer comp.mutex.unlock(io); 362 const crt_file_path: Cache.Path = .{ 363 .root_dir = comp.dirs.global_cache, 364 .sub_path = lib_final_path, 365 }; 366 try comp.crt_files.putNoClobber(gpa, final_lib_basename, .{ 367 .full_object_path = crt_file_path, 368 .lock = man.toOwnedLock(), 369 }); 370 return crt_file_path; 371 } 372 373 pub fn libExists( 374 allocator: Allocator, 375 io: Io, 376 target: *const std.Target, 377 zig_lib_directory: Cache.Directory, 378 lib_name: []const u8, 379 ) !bool { 380 const s = findDef(allocator, io, target, zig_lib_directory, lib_name) catch |err| switch (err) { 381 error.FileNotFound => return false, 382 else => |e| return e, 383 }; 384 defer allocator.free(s); 385 return true; 386 } 387 388 /// This function body is verbose but all it does is test 3 different paths and 389 /// see if a .def file exists. 390 fn findDef( 391 gpa: Allocator, 392 io: Io, 393 target: *const std.Target, 394 zig_lib_directory: Cache.Directory, 395 lib_name: []const u8, 396 ) ![]u8 { 397 const lib_path = switch (target.cpu.arch) { 398 .thumb => "libarm32", 399 .aarch64 => "libarm64", 400 .x86 => "lib32", 401 .x86_64 => "lib64", 402 else => unreachable, 403 }; 404 405 var override_path: std.ArrayList(u8) = .empty; 406 defer override_path.deinit(gpa); 407 408 const s = path.sep_str; 409 410 { 411 // Try the archtecture-specific path first. 412 override_path.shrinkRetainingCapacity(0); 413 try override_path.print(gpa, "libc" ++ s ++ "mingw" ++ s ++ "{s}" ++ s ++ "{s}.def", .{ lib_path, lib_name }); 414 if (zig_lib_directory.handle.access(io, override_path.items, .{})) |_| { 415 return override_path.toOwnedSlice(gpa); 416 } else |err| switch (err) { 417 error.FileNotFound => {}, 418 else => |e| return e, 419 } 420 } 421 422 { 423 // Try the generic version. 424 override_path.shrinkRetainingCapacity(0); 425 try override_path.print(gpa, "libc" ++ s ++ "mingw" ++ s ++ "lib-common" ++ s ++ "{s}.def", .{lib_name}); 426 if (zig_lib_directory.handle.access(io, override_path.items, .{})) |_| { 427 return override_path.toOwnedSlice(gpa); 428 } else |err| switch (err) { 429 error.FileNotFound => {}, 430 else => |e| return e, 431 } 432 } 433 434 { 435 // Try the generic version and preprocess it. 436 override_path.shrinkRetainingCapacity(0); 437 try override_path.print(gpa, "libc" ++ s ++ "mingw" ++ s ++ "lib-common" ++ s ++ "{s}.def.in", .{lib_name}); 438 if (zig_lib_directory.handle.access(io, override_path.items, .{})) |_| { 439 return override_path.toOwnedSlice(gpa); 440 } else |err| switch (err) { 441 error.FileNotFound => {}, 442 else => |e| return e, 443 } 444 } 445 446 return error.FileNotFound; 447 } 448 449 const mingw32_generic_src = [_][]const u8{ 450 // mingw32 451 "crt" ++ path.sep_str ++ "crtexewin.c", 452 "crt" ++ path.sep_str ++ "dll_argv.c", 453 "crt" ++ path.sep_str ++ "gccmain.c", 454 "crt" ++ path.sep_str ++ "natstart.c", 455 "crt" ++ path.sep_str ++ "pseudo-reloc-list.c", 456 "crt" ++ path.sep_str ++ "wildcard.c", 457 "crt" ++ path.sep_str ++ "charmax.c", 458 "crt" ++ path.sep_str ++ "ucrtexewin.c", 459 "crt" ++ path.sep_str ++ "dllargv.c", 460 "crt" ++ path.sep_str ++ "_newmode.c", 461 "crt" ++ path.sep_str ++ "tlssup.c", 462 "crt" ++ path.sep_str ++ "xncommod.c", 463 "crt" ++ path.sep_str ++ "cinitexe.c", 464 "crt" ++ path.sep_str ++ "merr.c", 465 "crt" ++ path.sep_str ++ "usermatherr.c", 466 "crt" ++ path.sep_str ++ "pesect.c", 467 "crt" ++ path.sep_str ++ "udllargc.c", 468 "crt" ++ path.sep_str ++ "xthdloc.c", 469 "crt" ++ path.sep_str ++ "mingw_helpers.c", 470 "crt" ++ path.sep_str ++ "pseudo-reloc.c", 471 "crt" ++ path.sep_str ++ "udll_argv.c", 472 "crt" ++ path.sep_str ++ "xtxtmode.c", 473 "crt" ++ path.sep_str ++ "crt_handler.c", 474 "crt" ++ path.sep_str ++ "tlsthrd.c", 475 "crt" ++ path.sep_str ++ "tlsmthread.c", 476 "crt" ++ path.sep_str ++ "tlsmcrt.c", 477 "crt" ++ path.sep_str ++ "cxa_atexit.c", 478 "crt" ++ path.sep_str ++ "cxa_thread_atexit.c", 479 "crt" ++ path.sep_str ++ "tls_atexit.c", 480 "intrincs" ++ path.sep_str ++ "RtlSecureZeroMemory.c", 481 // mingwex 482 "cfguard" ++ path.sep_str ++ "mingw_cfguard_support.c", 483 "complex" ++ path.sep_str ++ "_cabs.c", 484 "gdtoa" ++ path.sep_str ++ "arithchk.c", 485 "gdtoa" ++ path.sep_str ++ "dmisc.c", 486 "gdtoa" ++ path.sep_str ++ "dtoa.c", 487 "gdtoa" ++ path.sep_str ++ "g__fmt.c", 488 "gdtoa" ++ path.sep_str ++ "g_dfmt.c", 489 "gdtoa" ++ path.sep_str ++ "g_ffmt.c", 490 "gdtoa" ++ path.sep_str ++ "g_xfmt.c", 491 "gdtoa" ++ path.sep_str ++ "gdtoa.c", 492 "gdtoa" ++ path.sep_str ++ "gethex.c", 493 "gdtoa" ++ path.sep_str ++ "gmisc.c", 494 "gdtoa" ++ path.sep_str ++ "hd_init.c", 495 "gdtoa" ++ path.sep_str ++ "hexnan.c", 496 "gdtoa" ++ path.sep_str ++ "misc.c", 497 "gdtoa" ++ path.sep_str ++ "qnan.c", 498 "gdtoa" ++ path.sep_str ++ "smisc.c", 499 "gdtoa" ++ path.sep_str ++ "strtodg.c", 500 "gdtoa" ++ path.sep_str ++ "strtodnrp.c", 501 "gdtoa" ++ path.sep_str ++ "strtof.c", 502 "gdtoa" ++ path.sep_str ++ "strtopx.c", 503 "gdtoa" ++ path.sep_str ++ "sum.c", 504 "gdtoa" ++ path.sep_str ++ "ulp.c", 505 "math" ++ path.sep_str ++ "acospi.c", 506 "math" ++ path.sep_str ++ "acospif.c", 507 "math" ++ path.sep_str ++ "acospil.c", 508 "math" ++ path.sep_str ++ "asinpi.c", 509 "math" ++ path.sep_str ++ "asinpif.c", 510 "math" ++ path.sep_str ++ "asinpil.c", 511 "math" ++ path.sep_str ++ "atanpi.c", 512 "math" ++ path.sep_str ++ "atanpif.c", 513 "math" ++ path.sep_str ++ "atanpil.c", 514 "math" ++ path.sep_str ++ "atan2pi.c", 515 "math" ++ path.sep_str ++ "atan2pif.c", 516 "math" ++ path.sep_str ++ "atan2pil.c", 517 "math" ++ path.sep_str ++ "coshl.c", 518 "math" ++ path.sep_str ++ "cospi.c", 519 "math" ++ path.sep_str ++ "cospif.c", 520 "math" ++ path.sep_str ++ "cospil.c", 521 "math" ++ path.sep_str ++ "fpclassify.c", 522 "math" ++ path.sep_str ++ "fpclassifyf.c", 523 "math" ++ path.sep_str ++ "fpclassifyl.c", 524 "math" ++ path.sep_str ++ "ldexpf.c", 525 "math" ++ path.sep_str ++ "lgamma.c", 526 "math" ++ path.sep_str ++ "lgammaf.c", 527 "math" ++ path.sep_str ++ "lgammal.c", 528 "math" ++ path.sep_str ++ "powi.c", 529 "math" ++ path.sep_str ++ "powif.c", 530 "math" ++ path.sep_str ++ "powil.c", 531 "math" ++ path.sep_str ++ "signbit.c", 532 "math" ++ path.sep_str ++ "signbitf.c", 533 "math" ++ path.sep_str ++ "signbitl.c", 534 "math" ++ path.sep_str ++ "signgam.c", 535 "math" ++ path.sep_str ++ "sinhl.c", 536 "math" ++ path.sep_str ++ "sinpi.c", 537 "math" ++ path.sep_str ++ "sinpif.c", 538 "math" ++ path.sep_str ++ "sinpil.c", 539 "math" ++ path.sep_str ++ "tanhl.c", 540 "math" ++ path.sep_str ++ "tanpi.c", 541 "math" ++ path.sep_str ++ "tanpif.c", 542 "math" ++ path.sep_str ++ "tanpil.c", 543 "misc" ++ path.sep_str ++ "__mingw_filename_cp.c", 544 "misc" ++ path.sep_str ++ "__mingw_isleadbyte_cp.c", 545 "misc" ++ path.sep_str ++ "_assert.c", 546 "misc" ++ path.sep_str ++ "alarm.c", 547 "misc" ++ path.sep_str ++ "btowc.c", 548 "misc" ++ path.sep_str ++ "delay-f.c", 549 "misc" ++ path.sep_str ++ "delay-n.c", 550 "misc" ++ path.sep_str ++ "delayimp.c", 551 "misc" ++ path.sep_str ++ "dirent.c", 552 "misc" ++ path.sep_str ++ "dirname.c", 553 "misc" ++ path.sep_str ++ "dllmain.c", 554 "misc" ++ path.sep_str ++ "feclearexcept.c", 555 "misc" ++ path.sep_str ++ "fedisableexcept.c", 556 "misc" ++ path.sep_str ++ "feenableexcept.c", 557 "misc" ++ path.sep_str ++ "fegetenv.c", 558 "misc" ++ path.sep_str ++ "fegetexcept.c", 559 "misc" ++ path.sep_str ++ "fegetexceptflag.c", 560 "misc" ++ path.sep_str ++ "fegetround.c", 561 "misc" ++ path.sep_str ++ "feholdexcept.c", 562 "misc" ++ path.sep_str ++ "feraiseexcept.c", 563 "misc" ++ path.sep_str ++ "fesetenv.c", 564 "misc" ++ path.sep_str ++ "fesetexceptflag.c", 565 "misc" ++ path.sep_str ++ "fesetround.c", 566 "misc" ++ path.sep_str ++ "fetestexcept.c", 567 "misc" ++ path.sep_str ++ "mingw_controlfp.c", 568 "misc" ++ path.sep_str ++ "mingw_setfp.c", 569 "misc" ++ path.sep_str ++ "feupdateenv.c", 570 "misc" ++ path.sep_str ++ "ftime32.c", 571 "misc" ++ path.sep_str ++ "ftime64.c", 572 "misc" ++ path.sep_str ++ "ftw32.c", 573 "misc" ++ path.sep_str ++ "ftw32i64.c", 574 "misc" ++ path.sep_str ++ "ftw64.c", 575 "misc" ++ path.sep_str ++ "ftw64i32.c", 576 "misc" ++ path.sep_str ++ "fwide.c", 577 "misc" ++ path.sep_str ++ "getlogin.c", 578 "misc" ++ path.sep_str ++ "getopt.c", 579 "misc" ++ path.sep_str ++ "gettimeofday.c", 580 "misc" ++ path.sep_str ++ "memalignment.c", 581 "misc" ++ path.sep_str ++ "memset_explicit.c", 582 "misc" ++ path.sep_str ++ "mingw-access.c", 583 "misc" ++ path.sep_str ++ "mingw-aligned-malloc.c", 584 "misc" ++ path.sep_str ++ "mingw_getsp.S", 585 "misc" ++ path.sep_str ++ "mingw_longjmp.S", 586 "misc" ++ path.sep_str ++ "mingw_matherr.c", 587 "misc" ++ path.sep_str ++ "mingw_mbwc_convert.c", 588 "misc" ++ path.sep_str ++ "mingw_usleep.c", 589 "misc" ++ path.sep_str ++ "mingw_wcstod.c", 590 "misc" ++ path.sep_str ++ "mingw_wcstof.c", 591 "misc" ++ path.sep_str ++ "mingw_wcstold.c", 592 "misc" ++ path.sep_str ++ "mkdtemp.c", 593 "misc" ++ path.sep_str ++ "mkstemp.c", 594 "misc" ++ path.sep_str ++ "sleep.c", 595 "misc" ++ path.sep_str ++ "strsafe.c", 596 "misc" ++ path.sep_str ++ "tdelete.c", 597 "misc" ++ path.sep_str ++ "tdestroy.c", 598 "misc" ++ path.sep_str ++ "tfind.c", 599 "misc" ++ path.sep_str ++ "tsearch.c", 600 "misc" ++ path.sep_str ++ "twalk.c", 601 "misc" ++ path.sep_str ++ "wctob.c", 602 "misc" ++ path.sep_str ++ "wdirent.c", 603 "stdio" ++ path.sep_str ++ "__mingw_fix_fstat_finish.c", 604 "stdio" ++ path.sep_str ++ "__mingw_fix_stat_fallback_fd.c", 605 "stdio" ++ path.sep_str ++ "__mingw_fix_stat_finish.c", 606 "stdio" ++ path.sep_str ++ "__mingw_fix_stat_path.c", 607 "stdio" ++ path.sep_str ++ "__mingw_fix_wstat_fallback_fd.c", 608 "stdio" ++ path.sep_str ++ "__mingw_fix_wstat_path.c", 609 "stdio" ++ path.sep_str ++ "asprintf.c", 610 "stdio" ++ path.sep_str ++ "lltoa.c", 611 "stdio" ++ path.sep_str ++ "lltow.c", 612 "stdio" ++ path.sep_str ++ "mingw_asprintf.c", 613 "stdio" ++ path.sep_str ++ "mingw_fprintf.c", 614 "stdio" ++ path.sep_str ++ "mingw_fwprintf.c", 615 "stdio" ++ path.sep_str ++ "mingw_fscanf.c", 616 "stdio" ++ path.sep_str ++ "mingw_ftruncate64.c", 617 "stdio" ++ path.sep_str ++ "mingw_fwscanf.c", 618 "stdio" ++ path.sep_str ++ "mingw_pformat.c", 619 "stdio" ++ path.sep_str ++ "mingw_sformat.c", 620 "stdio" ++ path.sep_str ++ "mingw_swformat.c", 621 "stdio" ++ path.sep_str ++ "mingw_wpformat.c", 622 "stdio" ++ path.sep_str ++ "mingw_printf.c", 623 "stdio" ++ path.sep_str ++ "mingw_wprintf.c", 624 "stdio" ++ path.sep_str ++ "mingw_scanf.c", 625 "stdio" ++ path.sep_str ++ "mingw_snprintf.c", 626 "stdio" ++ path.sep_str ++ "mingw_snwprintf.c", 627 "stdio" ++ path.sep_str ++ "mingw_sprintf.c", 628 "stdio" ++ path.sep_str ++ "mingw_swprintf.c", 629 "stdio" ++ path.sep_str ++ "mingw_sscanf.c", 630 "stdio" ++ path.sep_str ++ "mingw_swscanf.c", 631 "stdio" ++ path.sep_str ++ "mingw_vasprintf.c", 632 "stdio" ++ path.sep_str ++ "mingw_vfprintf.c", 633 "stdio" ++ path.sep_str ++ "mingw_vfwprintf.c", 634 "stdio" ++ path.sep_str ++ "mingw_vfscanf.c", 635 "stdio" ++ path.sep_str ++ "mingw_vprintf.c", 636 "stdio" ++ path.sep_str ++ "mingw_vsscanf.c", 637 "stdio" ++ path.sep_str ++ "mingw_vwprintf.c", 638 "stdio" ++ path.sep_str ++ "mingw_vsnprintf.c", 639 "stdio" ++ path.sep_str ++ "mingw_vsnwprintf.c", 640 "stdio" ++ path.sep_str ++ "mingw_vsprintf.c", 641 "stdio" ++ path.sep_str ++ "mingw_vswprintf.c", 642 "stdio" ++ path.sep_str ++ "mingw_wscanf.c", 643 "stdio" ++ path.sep_str ++ "mingw_vfwscanf.c", 644 "stdio" ++ path.sep_str ++ "mingw_vswscanf.c", 645 "stdio" ++ path.sep_str ++ "snprintf.c", 646 "stdio" ++ path.sep_str ++ "snwprintf.c", 647 "stdio" ++ path.sep_str ++ "truncate.c", 648 "stdio" ++ path.sep_str ++ "truncate64.c", 649 "stdio" ++ path.sep_str ++ "ulltoa.c", 650 "stdio" ++ path.sep_str ++ "ulltow.c", 651 "stdio" ++ path.sep_str ++ "vasprintf.c", 652 "stdio" ++ path.sep_str ++ "vsnprintf.c", 653 "stdio" ++ path.sep_str ++ "vsnwprintf.c", 654 "stdio" ++ path.sep_str ++ "wtoll.c", 655 // mingwthrd 656 "libsrc" ++ path.sep_str ++ "mingwthrd_mt.c", 657 // ucrtbase 658 "ctype" ++ path.sep_str ++ "_iscsym_l.c", 659 "ctype" ++ path.sep_str ++ "_iscsymf_l.c", 660 "ctype" ++ path.sep_str ++ "iswctype.c", 661 "ctype" ++ path.sep_str ++ "towctrans.c", 662 "math" ++ path.sep_str ++ "_huge.c", 663 "misc" ++ path.sep_str ++ "__initenv.c", 664 "misc" ++ path.sep_str ++ "__winitenv.c", 665 "misc" ++ path.sep_str ++ "__p___initenv.c", 666 "misc" ++ path.sep_str ++ "__p___winitenv.c", 667 "misc" ++ path.sep_str ++ "_onexit.c", 668 "misc" ++ path.sep_str ++ "ucrt-access.c", 669 "misc" ++ path.sep_str ++ "ucrt__getmainargs.c", 670 "misc" ++ path.sep_str ++ "ucrt__wgetmainargs.c", 671 "misc" ++ path.sep_str ++ "ucrt_amsg_exit.c", 672 "misc" ++ path.sep_str ++ "ucrt_at_quick_exit.c", 673 "misc" ++ path.sep_str ++ "ucrt_mbsinit.c", 674 "misc" ++ path.sep_str ++ "ucrt_tzset.c", 675 "stdio" ++ path.sep_str ++ "msvcr80plus_ftruncate64.c", 676 "stdio" ++ path.sep_str ++ "ucrt__scprintf.c", 677 "stdio" ++ path.sep_str ++ "ucrt__scwprintf.c", 678 "stdio" ++ path.sep_str ++ "ucrt__snprintf.c", 679 "stdio" ++ path.sep_str ++ "ucrt__snscanf.c", 680 "stdio" ++ path.sep_str ++ "ucrt__snwprintf.c", 681 "stdio" ++ path.sep_str ++ "ucrt__swprintf.c", 682 "stdio" ++ path.sep_str ++ "ucrt__vscprintf.c", 683 "stdio" ++ path.sep_str ++ "ucrt__vscwprintf.c", 684 "stdio" ++ path.sep_str ++ "ucrt__vsnprintf.c", 685 "stdio" ++ path.sep_str ++ "ucrt__vsnwprintf.c", 686 "stdio" ++ path.sep_str ++ "ucrt__vswprintf.c", 687 "stdio" ++ path.sep_str ++ "ucrt___local_stdio_printf_options.c", 688 "stdio" ++ path.sep_str ++ "ucrt___local_stdio_scanf_options.c", 689 "stdio" ++ path.sep_str ++ "ucrt_fprintf.c", 690 "stdio" ++ path.sep_str ++ "ucrt_fscanf.c", 691 "stdio" ++ path.sep_str ++ "ucrt_fwprintf.c", 692 "stdio" ++ path.sep_str ++ "ucrt_fwscanf.c", 693 "stdio" ++ path.sep_str ++ "ucrt_ms_fwprintf.c", 694 "stdio" ++ path.sep_str ++ "ucrt_printf.c", 695 "stdio" ++ path.sep_str ++ "ucrt_scanf.c", 696 "stdio" ++ path.sep_str ++ "ucrt_snprintf.c", 697 "stdio" ++ path.sep_str ++ "ucrt_snwprintf.c", 698 "stdio" ++ path.sep_str ++ "ucrt_sprintf.c", 699 "stdio" ++ path.sep_str ++ "ucrt_sscanf.c", 700 "stdio" ++ path.sep_str ++ "ucrt_swscanf.c", 701 "stdio" ++ path.sep_str ++ "ucrt_swprintf.c", 702 "stdio" ++ path.sep_str ++ "ucrt_vfprintf.c", 703 "stdio" ++ path.sep_str ++ "ucrt_vfscanf.c", 704 "stdio" ++ path.sep_str ++ "ucrt_vfwscanf.c", 705 "stdio" ++ path.sep_str ++ "ucrt_vfwprintf.c", 706 "stdio" ++ path.sep_str ++ "ucrt_vprintf.c", 707 "stdio" ++ path.sep_str ++ "ucrt_vscanf.c", 708 "stdio" ++ path.sep_str ++ "ucrt_vsnprintf.c", 709 "stdio" ++ path.sep_str ++ "ucrt_vsnwprintf.c", 710 "stdio" ++ path.sep_str ++ "ucrt_vsprintf.c", 711 "stdio" ++ path.sep_str ++ "ucrt_vswprintf.c", 712 "stdio" ++ path.sep_str ++ "ucrt_vsscanf.c", 713 "stdio" ++ path.sep_str ++ "ucrt_vwscanf.c", 714 "stdio" ++ path.sep_str ++ "ucrt_wscanf.c", 715 "stdio" ++ path.sep_str ++ "ucrt_vwprintf.c", 716 "stdio" ++ path.sep_str ++ "ucrt_wprintf.c", 717 "string" ++ path.sep_str ++ "ucrt__wcstok.c", 718 // uuid 719 "libsrc" ++ path.sep_str ++ "atsmedia-uuid.c", 720 "libsrc" ++ path.sep_str ++ "bth-uuid.c", 721 "libsrc" ++ path.sep_str ++ "cguid-uuid.c", 722 "libsrc" ++ path.sep_str ++ "comcat-uuid.c", 723 "libsrc" ++ path.sep_str ++ "ctxtcall-uuid.c", 724 "libsrc" ++ path.sep_str ++ "devguid.c", 725 "libsrc" ++ path.sep_str ++ "docobj-uuid.c", 726 "libsrc" ++ path.sep_str ++ "dxva-uuid.c", 727 "libsrc" ++ path.sep_str ++ "exdisp-uuid.c", 728 "libsrc" ++ path.sep_str ++ "extras-uuid.c", 729 "libsrc" ++ path.sep_str ++ "fwp-uuid.c", 730 "libsrc" ++ path.sep_str ++ "guid_nul.c", 731 "libsrc" ++ path.sep_str ++ "hlguids-uuid.c", 732 "libsrc" ++ path.sep_str ++ "hlink-uuid.c", 733 "libsrc" ++ path.sep_str ++ "mlang-uuid.c", 734 "libsrc" ++ path.sep_str ++ "msctf-uuid.c", 735 "libsrc" ++ path.sep_str ++ "mshtmhst-uuid.c", 736 "libsrc" ++ path.sep_str ++ "mshtml-uuid.c", 737 "libsrc" ++ path.sep_str ++ "msxml-uuid.c", 738 "libsrc" ++ path.sep_str ++ "netcfg-uuid.c", 739 "libsrc" ++ path.sep_str ++ "netcon-uuid.c", 740 "libsrc" ++ path.sep_str ++ "ntddkbd-uuid.c", 741 "libsrc" ++ path.sep_str ++ "ntddmou-uuid.c", 742 "libsrc" ++ path.sep_str ++ "ntddpar-uuid.c", 743 "libsrc" ++ path.sep_str ++ "ntddscsi-uuid.c", 744 "libsrc" ++ path.sep_str ++ "ntddser-uuid.c", 745 "libsrc" ++ path.sep_str ++ "ntddstor-uuid.c", 746 "libsrc" ++ path.sep_str ++ "ntddvdeo-uuid.c", 747 "libsrc" ++ path.sep_str ++ "oaidl-uuid.c", 748 "libsrc" ++ path.sep_str ++ "objidl-uuid.c", 749 "libsrc" ++ path.sep_str ++ "objsafe-uuid.c", 750 "libsrc" ++ path.sep_str ++ "ocidl-uuid.c", 751 "libsrc" ++ path.sep_str ++ "oleacc-uuid.c", 752 "libsrc" ++ path.sep_str ++ "olectlid-uuid.c", 753 "libsrc" ++ path.sep_str ++ "oleidl-uuid.c", 754 "libsrc" ++ path.sep_str ++ "power-uuid.c", 755 "libsrc" ++ path.sep_str ++ "powrprof-uuid.c", 756 "libsrc" ++ path.sep_str ++ "uianimation-uuid.c", 757 "libsrc" ++ path.sep_str ++ "usbcamdi-uuid.c", 758 "libsrc" ++ path.sep_str ++ "usbiodef-uuid.c", 759 "libsrc" ++ path.sep_str ++ "uuid.c", 760 "libsrc" ++ path.sep_str ++ "vds-uuid.c", 761 "libsrc" ++ path.sep_str ++ "virtdisk-uuid.c", 762 "libsrc" ++ path.sep_str ++ "vss-uuid.c", 763 "libsrc" ++ path.sep_str ++ "wia-uuid.c", 764 "libsrc" ++ path.sep_str ++ "windowscodecs.c", 765 // ws2_32 766 "libsrc" ++ path.sep_str ++ "ws2_32.c", 767 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_addr_equal.c", 768 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6addr_isany.c", 769 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6addr_isloopback.c", 770 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6addr_setany.c", 771 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6addr_setloopback.c", 772 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_linklocal.c", 773 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_loopback.c", 774 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_mc_global.c", 775 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_mc_linklocal.c", 776 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_mc_nodelocal.c", 777 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_mc_orglocal.c", 778 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_mc_sitelocal.c", 779 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_multicast.c", 780 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_sitelocal.c", 781 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_unspecified.c", 782 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_v4compat.c", 783 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_is_addr_v4mapped.c", 784 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_set_addr_loopback.c", 785 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "in6_set_addr_unspecified.c", 786 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "gai_strerrorA.c", 787 "libsrc" ++ path.sep_str ++ "ws2tcpip" ++ path.sep_str ++ "gai_strerrorW.c", 788 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiStrdup.c", 789 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiParseV4Address.c", 790 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiNewAddrInfo.c", 791 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiQueryDNS.c", 792 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiLookupNode.c", 793 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiClone.c", 794 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiLegacyFreeAddrInfo.c", 795 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiLegacyGetAddrInfo.c", 796 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiLegacyGetNameInfo.c", 797 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiLoad.c", 798 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiGetAddrInfo.c", 799 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiGetNameInfo.c", 800 "libsrc" ++ path.sep_str ++ "wspiapi" ++ path.sep_str ++ "WspiapiFreeAddrInfo.c", 801 // dinput 802 "libsrc" ++ path.sep_str ++ "dinput_kbd.c", 803 "libsrc" ++ path.sep_str ++ "dinput_joy.c", 804 "libsrc" ++ path.sep_str ++ "dinput_joy2.c", 805 "libsrc" ++ path.sep_str ++ "dinput_mouse.c", 806 "libsrc" ++ path.sep_str ++ "dinput_mouse2.c", 807 // dloadhelper 808 "libsrc" ++ path.sep_str ++ "dloadhelper.c", 809 "misc" ++ path.sep_str ++ "delay-f.c", 810 // misc. 811 "libsrc" ++ path.sep_str ++ "bits.c", 812 "libsrc" ++ path.sep_str ++ "shell32.c", 813 "libsrc" ++ path.sep_str ++ "dmoguids.c", 814 "libsrc" ++ path.sep_str ++ "dxerr8.c", 815 "libsrc" ++ path.sep_str ++ "dxerr8w.c", 816 "libsrc" ++ path.sep_str ++ "dxerr9.c", 817 "libsrc" ++ path.sep_str ++ "dxerr9w.c", 818 "libsrc" ++ path.sep_str ++ "mfuuid.c", 819 "libsrc" ++ path.sep_str ++ "msxml2.c", 820 "libsrc" ++ path.sep_str ++ "msxml6.c", 821 "libsrc" ++ path.sep_str ++ "amstrmid.c", 822 "libsrc" ++ path.sep_str ++ "wbemuuid.c", 823 "libsrc" ++ path.sep_str ++ "wmcodecdspuuid.c", 824 "libsrc" ++ path.sep_str ++ "windowscodecs.c", 825 "libsrc" ++ path.sep_str ++ "dxguid.c", 826 "libsrc" ++ path.sep_str ++ "ksuser.c", 827 "libsrc" ++ path.sep_str ++ "largeint.c", 828 "libsrc" ++ path.sep_str ++ "locationapi.c", 829 "libsrc" ++ path.sep_str ++ "sapi.c", 830 "libsrc" ++ path.sep_str ++ "sensorsapi.c", 831 "libsrc" ++ path.sep_str ++ "portabledeviceguids.c", 832 "libsrc" ++ path.sep_str ++ "taskschd.c", 833 "libsrc" ++ path.sep_str ++ "strmiids.c", 834 "libsrc" ++ path.sep_str ++ "gdiplus.c", 835 "libsrc" ++ path.sep_str ++ "activeds-uuid.c", 836 }; 837 838 const mingw32_x86_src = [_][]const u8{ 839 // mingw32 840 "crt" ++ path.sep_str ++ "CRT_fp10.c", 841 // mingwex 842 "complex" ++ path.sep_str ++ "cabsl.c", 843 "complex" ++ path.sep_str ++ "cacosl.c", 844 "complex" ++ path.sep_str ++ "cargl.c", 845 "complex" ++ path.sep_str ++ "casinl.c", 846 "complex" ++ path.sep_str ++ "catanl.c", 847 "complex" ++ path.sep_str ++ "ccosl.c", 848 "complex" ++ path.sep_str ++ "cexpl.c", 849 "complex" ++ path.sep_str ++ "cimagl.c", 850 "complex" ++ path.sep_str ++ "clog10l.c", 851 "complex" ++ path.sep_str ++ "clogl.c", 852 "complex" ++ path.sep_str ++ "conjl.c", 853 "complex" ++ path.sep_str ++ "cpowl.c", 854 "complex" ++ path.sep_str ++ "cprojl.c", 855 "complex" ++ path.sep_str ++ "creall.c", 856 "complex" ++ path.sep_str ++ "csinl.c", 857 "complex" ++ path.sep_str ++ "csqrtl.c", 858 "complex" ++ path.sep_str ++ "ctanl.c", 859 "math" ++ path.sep_str ++ "cbrtl.c", 860 "math" ++ path.sep_str ++ "erfl.c", 861 "math" ++ path.sep_str ++ "fmal.c", 862 "math" ++ path.sep_str ++ "llrintl.c", 863 "math" ++ path.sep_str ++ "llroundl.c", 864 "math" ++ path.sep_str ++ "tgammal.c", 865 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "_chgsignl.S", 866 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "acoshl.c", 867 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "acosl.c", 868 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "asinhl.c", 869 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "asinl.c", 870 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atan2l.c", 871 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atanhl.c", 872 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "cossinl.c", 873 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "exp2l.S", 874 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expl.c", 875 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "expm1l.c", 876 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "fucom.c", 877 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "ilogbl.S", 878 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "internal_logl.S", 879 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "ldexpl.c", 880 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "log10l.S", 881 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "log1pl.S", 882 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "log2l.S", 883 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "logbl.c", 884 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "logl.c", 885 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "nearbyintl.S", 886 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "powl.c", 887 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "remainderl.S", 888 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "remquol.S", 889 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "scalbnl.S", 890 "misc" ++ path.sep_str ++ "wcstold.c", 891 // ucrtbase 892 "math" ++ path.sep_str ++ "nextafterl.c", 893 "math" ++ path.sep_str ++ "nexttoward.c", 894 "math" ++ path.sep_str ++ "nexttowardf.c", 895 }; 896 897 const mingw32_x86_32_src = [_][]const u8{ 898 // ucrtbase 899 "math" ++ path.sep_str ++ "powf.c", 900 "math" ++ path.sep_str ++ "sinhf.c", 901 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "asinf.c", 902 "math" ++ path.sep_str ++ "x86" ++ path.sep_str ++ "atan2f.c", 903 }; 904 905 const mingw32_arm_src = [_][]const u8{ 906 // mingwex 907 "math" ++ path.sep_str ++ "arm-common" ++ path.sep_str ++ "ldexpl.c", 908 }; 909 910 const mingw32_winpthreads_src = [_][]const u8{ 911 // winpthreads 912 "winpthreads" ++ path.sep_str ++ "barrier.c", 913 "winpthreads" ++ path.sep_str ++ "clock.c", 914 "winpthreads" ++ path.sep_str ++ "cond.c", 915 "winpthreads" ++ path.sep_str ++ "misc.c", 916 "winpthreads" ++ path.sep_str ++ "mutex.c", 917 "winpthreads" ++ path.sep_str ++ "nanosleep.c", 918 "winpthreads" ++ path.sep_str ++ "rwlock.c", 919 "winpthreads" ++ path.sep_str ++ "sched.c", 920 "winpthreads" ++ path.sep_str ++ "sem.c", 921 "winpthreads" ++ path.sep_str ++ "thread.c", 922 }; 923 924 pub const always_link_libs = [_][]const u8{ 925 "api-ms-win-crt-conio-l1-1-0", 926 "api-ms-win-crt-convert-l1-1-0", 927 "api-ms-win-crt-environment-l1-1-0", 928 "api-ms-win-crt-filesystem-l1-1-0", 929 "api-ms-win-crt-heap-l1-1-0", 930 "api-ms-win-crt-locale-l1-1-0", 931 "api-ms-win-crt-math-l1-1-0", 932 "api-ms-win-crt-multibyte-l1-1-0", 933 "api-ms-win-crt-private-l1-1-0", 934 "api-ms-win-crt-process-l1-1-0", 935 "api-ms-win-crt-runtime-l1-1-0", 936 "api-ms-win-crt-stdio-l1-1-0", 937 "api-ms-win-crt-string-l1-1-0", 938 "api-ms-win-crt-time-l1-1-0", 939 "api-ms-win-crt-utility-l1-1-0", 940 "advapi32", 941 "kernel32", 942 "ntdll", 943 "shell32", 944 "user32", 945 }; 946