Skip to content

Commit 398ab5f

Browse files
committed
mingw: update build logic
1 parent b126978 commit 398ab5f

File tree

4 files changed

+288
-401
lines changed

4 files changed

+288
-401
lines changed

lib/std/Target.zig

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2636,14 +2636,52 @@ pub fn is_libc_lib_name(target: std.Target, name: []const u8) bool {
26362636
if (target.isMinGW()) {
26372637
if (eqlIgnoreCase(ignore_case, name, "m"))
26382638
return true;
2639-
if (eqlIgnoreCase(ignore_case, name, "uuid"))
2640-
return true;
26412639
if (eqlIgnoreCase(ignore_case, name, "mingw32"))
26422640
return true;
26432641
if (eqlIgnoreCase(ignore_case, name, "msvcrt-os"))
26442642
return true;
26452643
if (eqlIgnoreCase(ignore_case, name, "mingwex"))
26462644
return true;
2645+
if (eqlIgnoreCase(ignore_case, name, "uuid"))
2646+
return true;
2647+
if (eqlIgnoreCase(ignore_case, name, "bits"))
2648+
return true;
2649+
if (eqlIgnoreCase(ignore_case, name, "dmoguids"))
2650+
return true;
2651+
if (eqlIgnoreCase(ignore_case, name, "dxerr8"))
2652+
return true;
2653+
if (eqlIgnoreCase(ignore_case, name, "dxerr9"))
2654+
return true;
2655+
if (eqlIgnoreCase(ignore_case, name, "mfuuid"))
2656+
return true;
2657+
if (eqlIgnoreCase(ignore_case, name, "msxml2"))
2658+
return true;
2659+
if (eqlIgnoreCase(ignore_case, name, "msxml6"))
2660+
return true;
2661+
if (eqlIgnoreCase(ignore_case, name, "amstrmid"))
2662+
return true;
2663+
if (eqlIgnoreCase(ignore_case, name, "wbemuuid"))
2664+
return true;
2665+
if (eqlIgnoreCase(ignore_case, name, "wmcodecdspuuid"))
2666+
return true;
2667+
if (eqlIgnoreCase(ignore_case, name, "dxguid"))
2668+
return true;
2669+
if (eqlIgnoreCase(ignore_case, name, "ksguid"))
2670+
return true;
2671+
if (eqlIgnoreCase(ignore_case, name, "locationapi"))
2672+
return true;
2673+
if (eqlIgnoreCase(ignore_case, name, "portabledeviceguids"))
2674+
return true;
2675+
if (eqlIgnoreCase(ignore_case, name, "mfuuid"))
2676+
return true;
2677+
if (eqlIgnoreCase(ignore_case, name, "dloadhelper"))
2678+
return true;
2679+
if (eqlIgnoreCase(ignore_case, name, "strmiids"))
2680+
return true;
2681+
if (eqlIgnoreCase(ignore_case, name, "mfuuid"))
2682+
return true;
2683+
if (eqlIgnoreCase(ignore_case, name, "adsiid"))
2684+
return true;
26472685

26482686
return false;
26492687
}

src/Compilation.zig

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -758,10 +758,7 @@ pub const MiscTask = enum {
758758

759759
@"mingw-w64 crt2.o",
760760
@"mingw-w64 dllcrt2.o",
761-
@"mingw-w64 mingw32.lib",
762-
@"mingw-w64 msvcrt-os.lib",
763761
@"mingw-w64 mingwex.lib",
764-
@"mingw-w64 uuid.lib",
765762
};
766763

767764
pub const MiscError = struct {
@@ -1816,14 +1813,9 @@ pub fn create(gpa: Allocator, arena: Allocator, options: CreateOptions) !*Compil
18161813
if (comp.wantBuildMinGWFromSource()) {
18171814
if (!target_util.canBuildLibC(target)) return error.LibCUnavailable;
18181815

1819-
const static_lib_jobs = [_]Job{
1820-
.{ .mingw_crt_file = .mingw32_lib },
1821-
.{ .mingw_crt_file = .mingwex_lib },
1822-
.{ .mingw_crt_file = .uuid_lib },
1823-
};
18241816
const crt_job: Job = .{ .mingw_crt_file = if (is_dyn_lib) .dllcrt2_o else .crt2_o };
1825-
try comp.work_queue.ensureUnusedCapacity(static_lib_jobs.len + 1);
1826-
comp.work_queue.writeAssumeCapacity(&static_lib_jobs);
1817+
try comp.work_queue.ensureUnusedCapacity(2);
1818+
comp.work_queue.writeItemAssumeCapacity(.{ .mingw_crt_file = .mingwex_lib });
18271819
comp.work_queue.writeItemAssumeCapacity(crt_job);
18281820

18291821
// When linking mingw-w64 there are some import libs we always need.

src/link/Coff/lld.zig

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -408,16 +408,7 @@ pub fn linkWithLLD(self: *Coff, arena: Allocator, prog_node: *std.Progress.Node)
408408
try argv.append(try comp.get_libc_crt_file(arena, "crt2.obj"));
409409
}
410410

411-
try argv.append(try comp.get_libc_crt_file(arena, "mingw32.lib"));
412411
try argv.append(try comp.get_libc_crt_file(arena, "mingwex.lib"));
413-
try argv.append(try comp.get_libc_crt_file(arena, "uuid.lib"));
414-
415-
for (mingw.always_link_libs) |name| {
416-
if (!comp.system_libs.contains(name)) {
417-
const lib_basename = try allocPrint(arena, "{s}.lib", .{name});
418-
try argv.append(try comp.get_libc_crt_file(arena, lib_basename));
419-
}
420-
}
421412
} else {
422413
const lib_str = switch (comp.config.link_mode) {
423414
.Dynamic => "",

0 commit comments

Comments
 (0)