Browse Source

Recursive DLL dependency resolution via objdump for build.sh windeployqt fallback

chatgui
Evgeny 3 months ago
parent
commit
cb1021f231
  1. 34
      tools/chatgui/build.sh

34
tools/chatgui/build.sh

@ -41,20 +41,28 @@ if [ -x "$WINDEPLOYQT" ]; then
fi
else
log " WARN: $WINDEPLOYQT not found (install: pacman -S mingw-w64-ucrt-x86_64-qt5-tools)"
log " Using objdump to find dependencies..."
DLL_LIST=$(objdump -p "$BUILD_DIR/chatgui.exe" 2>/dev/null | grep "DLL Name:" | awk '{print $3}')
if [ -n "$DLL_LIST" ]; then
for dll in $DLL_LIST; do
# skip system DLLs
case "$dll" in KERNEL32.dll|msvcrt.dll|USER32.dll|GDI32.dll|SHELL32.dll|ADVAPI32.dll|WS2_32.dll|ole32.dll|OLEAUT32.dll|IPHLPAPI.DLL|BCRYPT.dll|dbghelp.dll) continue ;; esac
cp "/ucrt64/bin/$dll" "$BUILD_DIR/" 2>/dev/null && log " OK: $dll" || \
cp "/mingw64/bin/$dll" "$BUILD_DIR/" 2>/dev/null || \
log " WARN: $dll not found"
log " Resolving dependencies recursively..."
changed=1
while [ $changed -eq 1 ]; do
changed=0
for src in "$BUILD_DIR"/chatgui.exe "$BUILD_DIR"/*.dll; do
[ -f "$src" ] || continue
for dep in $(objdump -p "$src" 2>/dev/null | grep "DLL Name:" | awk '{print $3}'); do
case "$dep" in
KERNEL32.dll|msvcrt.dll|USER32.dll|GDI32.dll|SHELL32.dll|ADVAPI32.dll|\
WS2_32.dll|ole32.dll|OLEAUT32.dll|IPHLPAPI.DLL|BCRYPT.dll|dbghelp.dll|\
api-ms-win-*)
continue ;;
esac
[ -f "$BUILD_DIR/$dep" ] && continue
if cp "/ucrt64/bin/$dep" "$BUILD_DIR/" 2>/dev/null; then
log " OK: $dep"; changed=1
elif cp "/mingw64/bin/$dep" "$BUILD_DIR/" 2>/dev/null; then
log " OK: $dep (mingw64)"; changed=1
fi
done
done
else
log " FAIL: objdump failed, cannot determine dependencies"
exit 1
fi
done
fi
cp "$SRC_DIR/rlottie_build/librlottie.dll" "$BUILD_DIR/" 2>/dev/null && log " OK: librlottie.dll" || log " WARN: librlottie.dll not found"

Loading…
Cancel
Save