Commit f42d5944 authored by David McFarland's avatar David McFarland
Browse files

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

This allows us to remove LINK_DLL_FOLDERS and use HOST_PATH instead.
parent 0beb3436
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)
+10 −11
Original line number Diff line number Diff line
# 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"