Skip to content

Commit 4ef55f1

Browse files
committed
sdk-installer: work around broken /usr/bin/ldd.exe
At some stage, it stopped reporting the MSYS2 dependencies correctly. Let's roll our own ldd replacement using objdump.exe. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent efc5197 commit 4ef55f1

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

sdk-installer/release.sh

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,33 @@ sed -e 's/^#\(XferCommand.*curl\).*/\1 --anyauth -C - -L -f %u >%o/' \
4949
</etc/pacman.conf >"$FAKEROOTDIR/etc/pacman.conf.proxy" ||
5050
die "Could not copy extra files into fake root"
5151

52+
dlls_for_exes () {
53+
# Add DLLs' transitive dependencies
54+
dlls=
55+
todo="$* "
56+
while test -n "$todo"
57+
do
58+
path=${todo%% *}
59+
todo=${todo#* }
60+
case "$path" in ''|' ') continue;; esac
61+
for dll in $(objdump -p "$path" |
62+
sed -n 's/^\tDLL Name: msys-/usr\/bin\/msys-/p')
63+
do
64+
case "$dlls" in
65+
*"$dll"*) ;; # already found
66+
*) dlls="$dlls $dll"; todo="$todo /$dll ";;
67+
esac
68+
done
69+
done
70+
echo "$dlls"
71+
}
72+
5273
fileList="etc/pacman.conf \
5374
etc/pacman.d \
5475
usr/bin/pacman.exe \
5576
usr/bin/curl.exe \
5677
usr/bin/gpg.exe \
57-
$(ldd /usr/bin/gpg.exe /usr/bin/curl.exe |
58-
sed -n 's/.* \/\(usr\/bin\/.*\.dll\) .*/\1/p' |
59-
sort |
60-
uniq) \
78+
$(dlls_for_exes /usr/bin/gpg.exe /usr/bin/curl.exe)
6179
usr/ssl/certs/ca-bundle.crt \
6280
var/lib/pacman
6381
$FAKEROOTDIR/setup-git-sdk.bat $FAKEROOTDIR/etc $FAKEROOTDIR/usr"

0 commit comments

Comments
 (0)