file: fix cross build for windows platforms (#476283)

This commit is contained in:
John Ericson
2026-01-05 15:49:56 +00:00
committed by GitHub
+6 -4
View File
@@ -2,7 +2,7 @@
lib,
stdenv,
fetchurl,
file,
buildPackages,
zlib,
libgnurx,
updateAutotoolsGnuConfigScriptsHook,
@@ -51,14 +51,16 @@ stdenv.mkDerivation (finalAttrs: {
nativeBuildInputs = [
updateAutotoolsGnuConfigScriptsHook
]
++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) file;
];
buildInputs = [ zlib ] ++ lib.optional stdenv.hostPlatform.isMinGW libgnurx;
# https://bugs.astron.com/view.php?id=382
doCheck = !stdenv.buildPlatform.isMusl;
makeFlags = lib.optional stdenv.hostPlatform.isWindows "FILE_COMPILE=file";
# In native builds, it will use the newly-compiled file instead.
makeFlags = lib.optional (
!lib.systems.equals stdenv.hostPlatform stdenv.buildPlatform
) "FILE_COMPILE=${lib.getExe buildPackages.file}";
passthru.tests.pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;