cygwin-dll-link: move DLLs to $lib/bin by default

This allows us to remove LINK_DLL_FOLDERS and use HOST_PATH instead.
This commit is contained in:
David McFarland
2026-02-08 19:47:25 -04:00
parent 0beb3436f0
commit f42d59445b
2 changed files with 11 additions and 12 deletions
+1 -1
View File
@@ -603,7 +603,7 @@ stdenvNoCC.mkDerivation {
installPhase =
if targetPlatform.isCygwin then
''
echo addToSearchPath "LINK_DLL_FOLDERS" "${cc_bin}/lib" >> $out
echo addToSearchPath "HOST_PATH" "${cc_bin}/lib" >> $out
# Work around build failure caused by the gnulib workaround for
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114870. remove after
# gnulib is updated in core packages (e.g. iconv, gnupatch, gnugrep)
@@ -1,21 +1,20 @@
# shellcheck shell=bash
addLinkDLLPaths() {
addToSearchPath "LINK_DLL_FOLDERS" "$1/lib"
addToSearchPath "LINK_DLL_FOLDERS" "$1/bin"
_moveDLLsToLib() {
if [[ "${dontMoveDLLsToLib-}" ]]; then return; fi
# shellcheck disable=SC2154
moveToOutput "bin/*.dll" "${!outputLib}"
}
# shellcheck disable=SC2154
addEnvHooks "$targetOffset" addLinkDLLPaths
preFixupHooks+=(_moveDLLsToLib)
addOutputDLLPaths() {
for output in $(getAllOutputNames); do
addToSearchPath "LINK_DLL_FOLDERS" "${!output}/lib"
addToSearchPath "LINK_DLL_FOLDERS" "${!output}/bin"
addToSearchPath "HOST_PATH" "${!output}/bin"
done
}
postInstallHooks+=(addOutputDLLPaths)
preFixupHooks+=(addOutputDLLPaths)
_dllDeps() {
@objdump@ -p "$1" \
@@ -35,13 +34,13 @@ _linkDeps() {
CYGWIN+=\ winsymlinks:nativestrict ln -sr /bin/cygwin1.dll "$dir"
continue
fi
# Locate the DLL - it should be an *executable* file on $LINK_DLL_FOLDERS.
# Locate the DLL - it should be an *executable* file on $HOST_PATH.
local dllPath
if ! dllPath="$(PATH="$(dirname "$target"):$LINK_DLL_FOLDERS" type -P "$dll")"; then
if ! dllPath="$(PATH="$(dirname "$target"):$HOST_PATH" type -P "$dll")"; then
if [[ -z "$check" || -n "${allowedImpureDLLsMap[$dll]}" ]]; then
continue
fi
echo unable to find "$dll" in "$LINK_DLL_FOLDERS" >&2
echo unable to find "$dll" in "$HOST_PATH" >&2
exit 1
fi
echo ' linking to:' "$dllPath"