Files
nixpkgs/pkgs/os-specific/windows/mingw-w64/headers.nix
John Ericson bd68a4ac14 windows: declare the thread models, and mark the headers-only libc
The split GCC package set (`gccNGPackages`, opted into with `useGccNG`)
builds each runtime library separately, so the compiler is configured
independently of `libgcc` and `libstdc++` and the two can disagree about
threading. Rather than probe the compiler, those packages read the answer
from the package that decides it, through the same `passthru.threadModel`
that `glibc`, `musl` and NetBSD's `libc` already declare.

MinGW's libc has none of its own beyond the Win32 API, so it declares
`win32`. Past that the answer depends on which threading library a
toolchain is built against, so `mcfgthreads` declares `mcf` and
`winpthreads` `posix`. Nothing reads either yet.

The headers-only build is marked as such rather than given a model: it
exists only to get the libc compiled, and runtimes built against it stay
single-threaded.

Assisted-by: Claude Code (Claude Opus 5)
2026-08-27 22:31:27 -04:00

51 lines
1.2 KiB
Nix

{
lib,
nixosTests,
stdenvNoCC,
fetchurl,
crt ? stdenvNoCC.hostPlatform.libc,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "mingw_w64-headers";
version = "14.0.0";
src = fetchurl {
url = "mirror://sourceforge/mingw-w64/mingw-w64-v${finalAttrs.version}.tar.bz2";
hash = "sha256-bq+SHZ65h9OCCzZOqXdbwZuWXsgUkLb91xZSbCjhmVw=";
};
configureFlags = [
(lib.withFeatureAs true "default-msvcrt" crt)
];
preConfigure = ''
cd mingw-w64-headers
'';
passthru = {
# Headers-only stand-in used to bootstrap a toolchain before the real libc
# exists: runtimes can compile against it, but not link.
headersOnly = true;
tests = {
inherit (nixosTests) wine;
};
updateScript = ./update.nu;
};
meta = {
homepage = "https://www.mingw-w64.org/";
downloadPage = "https://sourceforge.net/projects/mingw-w64/files/mingw-w64/mingw-w64-release/";
description = "Collection of headers and libraries for building native Windows applications";
license = with lib.licenses; [
# Primarily under
zpl21
# A couple files
mit
# Certain headers imported from Wine
lgpl21Plus
];
platforms = lib.platforms.windows;
teams = [ lib.teams.windows ];
};
})