nixpkgs/pkgs/os-specific/windows/mingw-w64/default.nix
Moritz Angermann 1e0561d78a nixpkgs/systems: Add ucrt64 as MinGW libc
The Minimalist Gnu for Windows distribution comes with support for
the traditional msvcrt libc, as well as ucrt64 libc. The latter
being the newer universal compiler runtime. We follow the msys2
environment naming convention[1]:

| name       | toolchain | arch    | libc   | libc++    |
|------------|-----------|---------|--------|-----------|
| mingw32    | gcc       | i686    | msvcrt | libstdc++ |
| mingw64    | gcc       | x86_64  | msvcrt | libstdc++ |
| ucrt64     | gcc       | x86_64  | ucrt   | libstdc++ |
| clang32    | llvm      | i686    | ucrt   | libc++    |
| clang64    | llvm      | x86_64  | ucrt   | libc++    |
| clangarm64 | llvm      | aarch64 | ucrt   | libc++    |

For now nixpkgs only supports the first three with this commit.

--
[1]: https://www.msys2.org/docs/environments/
2023-09-08 10:56:08 +00:00

52 lines
1.3 KiB
Nix

{ lib
, stdenv
, windows
, fetchurl
, fetchpatch
, autoreconfHook
}:
let
version = "10.0.0";
in stdenv.mkDerivation {
pname = "mingw-w64";
inherit version;
src = fetchurl {
url = "mirror://sourceforge/mingw-w64/mingw-w64-v${version}.tar.bz2";
hash = "sha256-umtDCu1yxjo3aFMfaj/8Kw/eLFejslFFDc9ImolPCJQ=";
};
patches = [
# Upstream patches to fix build parallelism
(fetchpatch {
name = "crt-suff-make-4.4.patch";
url = "https://github.com/mirror/mingw-w64/commit/953bcd32ae470c4647e94de8548dda5a8f07d82d.patch";
hash = "sha256-lrS4ZDa/Uwsj5DXajOUv+knZXan0JVU70KHHdIjJ07Y=";
})
(fetchpatch {
name = "dll-dep-make-4.4.patch";
url = "https://github.com/mirror/mingw-w64/commit/e1b0c1420bbd52ef505c71737c57393ac1397b0a.patch";
hash = "sha256-/56Cmmy0UYTaDKIWG7CgXsThvCHK6lSbekbBOoOJSIQ=";
})
];
outputs = [ "out" "dev" ];
configureFlags = [
"--enable-idl"
"--enable-secure-api"
] ++ lib.optionals (stdenv.targetPlatform.libc == "ucrt") [
"--with-default-msvcrt=ucrt"
];
enableParallelBuilding = true;
nativeBuildInputs = [ autoreconfHook ];
buildInputs = [ windows.mingw_w64_headers ];
hardeningDisable = [ "stackprotector" "fortify" ];
meta = {
platforms = lib.platforms.windows;
};
}