cc-wrapper: add cygwin libc to dll path

Co-authored-by: Brian McKenna <brian@brianmckenna.org>
This commit is contained in:
David McFarland
2025-09-20 23:26:18 -03:00
parent 1acd8658f0
commit 145d9726f3
+13 -6
View File
@@ -126,6 +126,7 @@ let
libc_dev = optionalString (libc != null) (getDev libc);
libc_lib = optionalString (libc != null) (getLib libc);
cc_solib = getLib cc + optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}";
cc_bin = getBin cc + optionalString (targetPlatform != hostPlatform) "/${targetPlatform.config}";
# The wrapper scripts use 'cat' and 'grep', so we may need coreutils.
coreutils_bin = optionalString (!nativeTools) (getBin coreutils);
@@ -590,15 +591,21 @@ stdenvNoCC.mkDerivation {
]
++ optional (cc.langC or true) ./setup-hook.sh
++ optional (cc.langFortran or false) ./fortran-hook.sh
++ optional (targetPlatform.isWindows) (
++ optional (targetPlatform.isWindows || targetPlatform.isCygwin) (
stdenvNoCC.mkDerivation {
name = "win-dll-hook.sh";
dontUnpack = true;
installPhase = ''
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib" > $out
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib64" >> $out
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib32" >> $out
'';
installPhase =
if targetPlatform.isCygwin then
''
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_bin}/lib" >> $out
''
else
''
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib" > $out
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib64" >> $out
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_solib}/lib32" >> $out
'';
}
);