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