| ... | ... | @@ -14,7 +14,6 @@ pub const CRTFile = enum { |
| 14 | 14 | crt2_o, |
| 15 | 15 | dllcrt2_o, |
| 16 | 16 | mingw32_lib, |
| 17 | | msvcrt_os_lib, |
| 18 | 17 | mingwex_lib, |
| 19 | 18 | uuid_lib, |
| 20 | 19 | }; |
| ... | ... | @@ -34,12 +33,9 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 34 | 33 | try args.appendSlice(&[_][]const u8{ |
| 35 | 34 | "-D_SYSCRT=1", |
| 36 | 35 | "-DCRTDLL=1", |
| 37 | | "-U__CRTDLL__", |
| 38 | | "-D__MSVCRT__", |
| 39 | | // Uncomment these 3 things for crtu |
| 36 | // Uncommenting this makes mingw-w64 look for wmain instead of main. |
| 40 | 37 | //"-DUNICODE", |
| 41 | 38 | //"-D_UNICODE", |
| 42 | | //"-DWPRFLAG=1", |
| 43 | 39 | }); |
| 44 | 40 | var files = [_]Compilation.CSourceFile{ |
| 45 | 41 | .{ |
| ... | ... | @@ -59,8 +55,6 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 59 | 55 | try args.appendSlice(&[_][]const u8{ |
| 60 | 56 | "-D_SYSCRT=1", |
| 61 | 57 | "-DCRTDLL=1", |
| 62 | | "-U__CRTDLL__", |
| 63 | | "-D__MSVCRT__", |
| 64 | 58 | }); |
| 65 | 59 | var files = [_]Compilation.CSourceFile{ |
| 66 | 60 | .{ |
| ... | ... | @@ -107,56 +101,6 @@ pub fn buildCRTFile(comp: *Compilation, crt_file: CRTFile, prog_node: *std.Progr |
| 107 | 101 | return comp.build_crt_file("mingw32", .Lib, .@"mingw-w64 mingw32.lib", prog_node, &c_source_files); |
| 108 | 102 | }, |
| 109 | 103 | |
| 110 | | .msvcrt_os_lib => { |
| 111 | | const extra_flags = try arena.dupe([]const u8, &[_][]const u8{ |
| 112 | | "-DHAVE_CONFIG_H", |
| 113 | | "-D__LIBMSVCRT__", |
| 114 | | "-D__LIBMSVCRT_OS__", |
| 115 | | |
| 116 | | "-I", |
| 117 | | try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "mingw", "include" }), |
| 118 | | |
| 119 | | "-std=gnu99", |
| 120 | | "-D_CRTBLD", |
| 121 | | "-D__MSVCRT_VERSION__=0x700", |
| 122 | | "-D__USE_MINGW_ANSI_STDIO=0", |
| 123 | | |
| 124 | | "-isystem", |
| 125 | | try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "include", "any-windows-any" }), |
| 126 | | }); |
| 127 | | var c_source_files = std.ArrayList(Compilation.CSourceFile).init(arena); |
| 128 | | |
| 129 | | for (msvcrt_common_src) |dep| { |
| 130 | | (try c_source_files.addOne()).* = .{ |
| 131 | | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ "libc", "mingw", dep }), |
| 132 | | .extra_flags = extra_flags, |
| 133 | | .owner = undefined, |
| 134 | | }; |
| 135 | | } |
| 136 | | if (comp.getTarget().cpu.arch == .x86) { |
| 137 | | for (msvcrt_i386_src) |dep| { |
| 138 | | (try c_source_files.addOne()).* = .{ |
| 139 | | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ |
| 140 | | "libc", "mingw", dep, |
| 141 | | }), |
| 142 | | .extra_flags = extra_flags, |
| 143 | | .owner = undefined, |
| 144 | | }; |
| 145 | | } |
| 146 | | } else { |
| 147 | | for (msvcrt_other_src) |dep| { |
| 148 | | (try c_source_files.addOne()).* = .{ |
| 149 | | .src_path = try comp.zig_lib_directory.join(arena, &[_][]const u8{ |
| 150 | | "libc", "mingw", dep, |
| 151 | | }), |
| 152 | | .extra_flags = extra_flags, |
| 153 | | .owner = undefined, |
| 154 | | }; |
| 155 | | } |
| 156 | | } |
| 157 | | return comp.build_crt_file("msvcrt-os", .Lib, .@"mingw-w64 msvcrt-os.lib", prog_node, c_source_files.items); |
| 158 | | }, |
| 159 | | |
| 160 | 104 | .mingwex_lib => { |
| 161 | 105 | const extra_flags = try arena.dupe([]const u8, &[_][]const u8{ |
| 162 | 106 | "-DHAVE_CONFIG_H", |
| ... | ... | @@ -542,78 +486,7 @@ const mingw32_lib_deps = [_][]const u8{ |
| 542 | 486 | "cxa_thread_atexit.c", |
| 543 | 487 | "tls_atexit.c", |
| 544 | 488 | }; |
| 545 | | const msvcrt_common_src = [_][]const u8{ |
| 546 | | "misc" ++ path.sep_str ++ "_create_locale.c", |
| 547 | | "misc" ++ path.sep_str ++ "_free_locale.c", |
| 548 | | "misc" ++ path.sep_str ++ "onexit_table.c", |
| 549 | | "misc" ++ path.sep_str ++ "register_tls_atexit.c", |
| 550 | | "stdio" ++ path.sep_str ++ "acrt_iob_func.c", |
| 551 | | "stdio" ++ path.sep_str ++ "snprintf_alias.c", |
| 552 | | "stdio" ++ path.sep_str ++ "vsnprintf_alias.c", |
| 553 | | "stdio" ++ path.sep_str ++ "_vscprintf.c", |
| 554 | | "misc" ++ path.sep_str ++ "_configthreadlocale.c", |
| 555 | | "misc" ++ path.sep_str ++ "_get_current_locale.c", |
| 556 | | "misc" ++ path.sep_str ++ "invalid_parameter_handler.c", |
| 557 | | "misc" ++ path.sep_str ++ "output_format.c", |
| 558 | | "misc" ++ path.sep_str ++ "purecall.c", |
| 559 | | "secapi" ++ path.sep_str ++ "_access_s.c", |
| 560 | | "secapi" ++ path.sep_str ++ "_cgets_s.c", |
| 561 | | "secapi" ++ path.sep_str ++ "_cgetws_s.c", |
| 562 | | "secapi" ++ path.sep_str ++ "_chsize_s.c", |
| 563 | | "secapi" ++ path.sep_str ++ "_controlfp_s.c", |
| 564 | | "secapi" ++ path.sep_str ++ "_cprintf_s.c", |
| 565 | | "secapi" ++ path.sep_str ++ "_cprintf_s_l.c", |
| 566 | | "secapi" ++ path.sep_str ++ "_ctime32_s.c", |
| 567 | | "secapi" ++ path.sep_str ++ "_ctime64_s.c", |
| 568 | | "secapi" ++ path.sep_str ++ "_cwprintf_s.c", |
| 569 | | "secapi" ++ path.sep_str ++ "_cwprintf_s_l.c", |
| 570 | | "secapi" ++ path.sep_str ++ "_gmtime32_s.c", |
| 571 | | "secapi" ++ path.sep_str ++ "_gmtime64_s.c", |
| 572 | | "secapi" ++ path.sep_str ++ "_localtime32_s.c", |
| 573 | | "secapi" ++ path.sep_str ++ "_localtime64_s.c", |
| 574 | | "secapi" ++ path.sep_str ++ "_mktemp_s.c", |
| 575 | | "secapi" ++ path.sep_str ++ "_sopen_s.c", |
| 576 | | "secapi" ++ path.sep_str ++ "_strdate_s.c", |
| 577 | | "secapi" ++ path.sep_str ++ "_strtime_s.c", |
| 578 | | "secapi" ++ path.sep_str ++ "_umask_s.c", |
| 579 | | "secapi" ++ path.sep_str ++ "_vcprintf_s.c", |
| 580 | | "secapi" ++ path.sep_str ++ "_vcprintf_s_l.c", |
| 581 | | "secapi" ++ path.sep_str ++ "_vcwprintf_s.c", |
| 582 | | "secapi" ++ path.sep_str ++ "_vcwprintf_s_l.c", |
| 583 | | "secapi" ++ path.sep_str ++ "_vscprintf_p.c", |
| 584 | | "secapi" ++ path.sep_str ++ "_vscwprintf_p.c", |
| 585 | | "secapi" ++ path.sep_str ++ "_vswprintf_p.c", |
| 586 | | "secapi" ++ path.sep_str ++ "_waccess_s.c", |
| 587 | | "secapi" ++ path.sep_str ++ "_wasctime_s.c", |
| 588 | | "secapi" ++ path.sep_str ++ "_wctime32_s.c", |
| 589 | | "secapi" ++ path.sep_str ++ "_wctime64_s.c", |
| 590 | | "secapi" ++ path.sep_str ++ "_wstrtime_s.c", |
| 591 | | "secapi" ++ path.sep_str ++ "_wmktemp_s.c", |
| 592 | | "secapi" ++ path.sep_str ++ "_wstrdate_s.c", |
| 593 | | "secapi" ++ path.sep_str ++ "asctime_s.c", |
| 594 | | "secapi" ++ path.sep_str ++ "memcpy_s.c", |
| 595 | | "secapi" ++ path.sep_str ++ "memmove_s.c", |
| 596 | | "secapi" ++ path.sep_str ++ "rand_s.c", |
| 597 | | "secapi" ++ path.sep_str ++ "sprintf_s.c", |
| 598 | | "secapi" ++ path.sep_str ++ "strerror_s.c", |
| 599 | | "secapi" ++ path.sep_str ++ "vsprintf_s.c", |
| 600 | | "secapi" ++ path.sep_str ++ "wmemcpy_s.c", |
| 601 | | "secapi" ++ path.sep_str ++ "wmemmove_s.c", |
| 602 | | "stdio" ++ path.sep_str ++ "mingw_lock.c", |
| 603 | | }; |
| 604 | | const msvcrt_i386_src = [_][]const u8{ |
| 605 | | "misc" ++ path.sep_str ++ "lc_locale_func.c", |
| 606 | | "misc" ++ path.sep_str ++ "___mb_cur_max_func.c", |
| 607 | | "misc" ++ path.sep_str ++ "wassert.c", |
| 608 | | }; |
| 609 | 489 | |
| 610 | | const msvcrt_other_src = [_][]const u8{ |
| 611 | | "misc" ++ path.sep_str ++ "__p___argv.c", |
| 612 | | "misc" ++ path.sep_str ++ "__p__acmdln.c", |
| 613 | | "misc" ++ path.sep_str ++ "__p__commode.c", |
| 614 | | "misc" ++ path.sep_str ++ "__p__fmode.c", |
| 615 | | "misc" ++ path.sep_str ++ "__p__wcmdln.c", |
| 616 | | }; |
| 617 | 490 | const mingwex_generic_src = [_][]const u8{ |
| 618 | 491 | "complex" ++ path.sep_str ++ "_cabs.c", |
| 619 | 492 | "complex" ++ path.sep_str ++ "cabs.c", |
| ... | ... | @@ -669,6 +542,7 @@ const mingwex_generic_src = [_][]const u8{ |
| 669 | 542 | "complex" ++ path.sep_str ++ "ctanl.c", |
| 670 | 543 | "crt" ++ path.sep_str ++ "dllentry.c", |
| 671 | 544 | "crt" ++ path.sep_str ++ "dllmain.c", |
| 545 | "crt" ++ path.sep_str ++ "ucrtbase_compat.c", |
| 672 | 546 | "gdtoa" ++ path.sep_str ++ "arithchk.c", |
| 673 | 547 | "gdtoa" ++ path.sep_str ++ "dmisc.c", |
| 674 | 548 | "gdtoa" ++ path.sep_str ++ "dtoa.c", |
| ... | ... | @@ -848,6 +722,7 @@ const mingwex_generic_src = [_][]const u8{ |
| 848 | 722 | "misc" ++ path.sep_str ++ "wmemmove.c", |
| 849 | 723 | "misc" ++ path.sep_str ++ "wmempcpy.c", |
| 850 | 724 | "misc" ++ path.sep_str ++ "wmemset.c", |
| 725 | "misc" ++ path.sep_str ++ "__initenv.c", |
| 851 | 726 | "stdio" ++ path.sep_str ++ "_Exit.c", |
| 852 | 727 | "stdio" ++ path.sep_str ++ "_findfirst64i32.c", |
| 853 | 728 | "stdio" ++ path.sep_str ++ "_findnext64i32.c", |
| ... | ... | @@ -878,40 +753,31 @@ const mingwex_generic_src = [_][]const u8{ |
| 878 | 753 | "stdio" ++ path.sep_str ++ "lltoa.c", |
| 879 | 754 | "stdio" ++ path.sep_str ++ "lltow.c", |
| 880 | 755 | "stdio" ++ path.sep_str ++ "lseek64.c", |
| 881 | | "stdio" ++ path.sep_str ++ "mingw_asprintf.c", |
| 882 | | "stdio" ++ path.sep_str ++ "mingw_fprintf.c", |
| 883 | | "stdio" ++ path.sep_str ++ "mingw_fprintfw.c", |
| 884 | | "stdio" ++ path.sep_str ++ "mingw_fscanf.c", |
| 885 | | "stdio" ++ path.sep_str ++ "mingw_fwscanf.c", |
| 886 | | "stdio" ++ path.sep_str ++ "mingw_pformat.c", |
| 887 | | "stdio" ++ path.sep_str ++ "mingw_pformatw.c", |
| 888 | | "stdio" ++ path.sep_str ++ "mingw_printf.c", |
| 889 | | "stdio" ++ path.sep_str ++ "mingw_printfw.c", |
| 890 | | "stdio" ++ path.sep_str ++ "mingw_scanf.c", |
| 891 | | "stdio" ++ path.sep_str ++ "mingw_snprintf.c", |
| 892 | | "stdio" ++ path.sep_str ++ "mingw_snprintfw.c", |
| 893 | | "stdio" ++ path.sep_str ++ "mingw_sprintf.c", |
| 894 | | "stdio" ++ path.sep_str ++ "mingw_sprintfw.c", |
| 895 | | "stdio" ++ path.sep_str ++ "mingw_sscanf.c", |
| 896 | | "stdio" ++ path.sep_str ++ "mingw_swscanf.c", |
| 897 | | "stdio" ++ path.sep_str ++ "mingw_vasprintf.c", |
| 898 | | "stdio" ++ path.sep_str ++ "mingw_vfprintf.c", |
| 899 | | "stdio" ++ path.sep_str ++ "mingw_vfprintfw.c", |
| 900 | | "stdio" ++ path.sep_str ++ "mingw_vfscanf.c", |
| 901 | | "stdio" ++ path.sep_str ++ "mingw_vprintf.c", |
| 902 | | "stdio" ++ path.sep_str ++ "mingw_vprintfw.c", |
| 903 | | "stdio" ++ path.sep_str ++ "mingw_vsnprintf.c", |
| 904 | | "stdio" ++ path.sep_str ++ "mingw_vsnprintfw.c", |
| 905 | | "stdio" ++ path.sep_str ++ "mingw_vsprintf.c", |
| 906 | | "stdio" ++ path.sep_str ++ "mingw_vsprintfw.c", |
| 907 | | "stdio" ++ path.sep_str ++ "mingw_wscanf.c", |
| 908 | | "stdio" ++ path.sep_str ++ "mingw_wvfscanf.c", |
| 909 | 756 | "stdio" ++ path.sep_str ++ "scanf.S", |
| 910 | 757 | "stdio" ++ path.sep_str ++ "snprintf.c", |
| 911 | 758 | "stdio" ++ path.sep_str ++ "snwprintf.c", |
| 912 | 759 | "stdio" ++ path.sep_str ++ "strtof.c", |
| 913 | 760 | "stdio" ++ path.sep_str ++ "strtok_r.c", |
| 914 | 761 | "stdio" ++ path.sep_str ++ "truncate.c", |
| 762 | "stdio" ++ path.sep_str ++ "ucrt__snwprintf.c", |
| 763 | "stdio" ++ path.sep_str ++ "ucrt__vscprintf.c", |
| 764 | "stdio" ++ path.sep_str ++ "ucrt__vsnprintf.c", |
| 765 | "stdio" ++ path.sep_str ++ "ucrt__vsnwprintf.c", |
| 766 | "stdio" ++ path.sep_str ++ "ucrt_fprintf.c", |
| 767 | "stdio" ++ path.sep_str ++ "ucrt_fscanf.c", |
| 768 | "stdio" ++ path.sep_str ++ "ucrt_fwprintf.c", |
| 769 | "stdio" ++ path.sep_str ++ "ucrt_printf.c", |
| 770 | "stdio" ++ path.sep_str ++ "ucrt_scanf.c", |
| 771 | "stdio" ++ path.sep_str ++ "ucrt_snprintf.c", |
| 772 | "stdio" ++ path.sep_str ++ "ucrt_sprintf.c", |
| 773 | "stdio" ++ path.sep_str ++ "ucrt_sscanf.c", |
| 774 | "stdio" ++ path.sep_str ++ "ucrt_vfprintf.c", |
| 775 | "stdio" ++ path.sep_str ++ "ucrt_vfscanf.c", |
| 776 | "stdio" ++ path.sep_str ++ "ucrt_vprintf.c", |
| 777 | "stdio" ++ path.sep_str ++ "ucrt_vscanf.c", |
| 778 | "stdio" ++ path.sep_str ++ "ucrt_vsnprintf.c", |
| 779 | "stdio" ++ path.sep_str ++ "ucrt_vsprintf.c", |
| 780 | "stdio" ++ path.sep_str ++ "ucrt_vsscanf.c", |
| 915 | 781 | "stdio" ++ path.sep_str ++ "ulltoa.c", |
| 916 | 782 | "stdio" ++ path.sep_str ++ "ulltow.c", |
| 917 | 783 | "stdio" ++ path.sep_str ++ "vasprintf.c", |
| ... | ... | @@ -1136,9 +1002,9 @@ const uuid_src = [_][]const u8{ |
| 1136 | 1002 | }; |
| 1137 | 1003 | |
| 1138 | 1004 | pub const always_link_libs = [_][]const u8{ |
| 1005 | "ucrtbase", |
| 1139 | 1006 | "advapi32", |
| 1140 | 1007 | "kernel32", |
| 1141 | | "msvcrt", |
| 1142 | 1008 | "ntdll", |
| 1143 | 1009 | "shell32", |
| 1144 | 1010 | "user32", |