1 postFixupHooks
+=(_cygwinWrapExesToFindDlls
)
3 _cygwinWrapExesToFindDlls
() {
4 find $out -type l |
while read LINK
; do
5 TARGET
="$(readlink "${LINK}")"
7 # fix all non .exe links that link explicitly to a .exe
8 if [[ ${TARGET} == *.exe
]] && [[ ${LINK} != *.exe
]]; then
9 mv "${LINK}" "${LINK}.exe"
13 # generate complementary filenames
14 if [[ ${LINK} == *.exe
]]; then
16 _TARGET
="${TARGET%.exe}"
19 _TARGET
="${TARGET}.exe"
22 # check if sould create complementary link
24 if [[ ${_TARGET} == *.exe
]]; then
25 # the canonical target has to be a .exe
26 CTARGET
="$(readlink -f "${LINK}")"
27 if [[ ${CTARGET} != *.exe
]]; then
28 CTARGET
="${CTARGET}.exe"
31 if [ ! -e "${CTARGET}" ]; then
36 if [ -e "${_LINK}" ]; then
37 # complementary link seems to exist
38 # but could be cygwin smoke and mirrors
39 INO
=$
(stat
-c%i
"${LINK}")
40 _INO
=$
(stat
-c%i
"${_LINK}")
41 if [ "${INO}" -ne "${_INO}" ]; then
46 # create complementary link
47 if [ -n "${DOLINK}" ]; then
48 ln -s "${_TARGET}" "${_LINK}.tmp"
49 mv "${_LINK}.tmp" "${_LINK}"
53 find $out -type f
-name "*.exe" |
while read EXE
; do
55 if [ -e "${WRAPPER}" ]; then
56 # check if really exists or cygwin smoke and mirrors
57 INO
=$
(stat
-c%i
"${EXE}")
58 _INO
=$
(stat
-c%i
"${WRAPPER}")
59 if [ "${INO}" -ne "${_INO}" ]; then
64 mv "${EXE}" "${EXE}.tmp"
66 cat >"${WRAPPER}" <<EOF
68 export PATH=$_PATH${_PATH:+:}\${PATH}
72 mv "${EXE}.tmp" "${EXE}"