diff --git a/tools/chatgui/build.sh b/tools/chatgui/build.sh index 8fe5511a..26777478 100755 --- a/tools/chatgui/build.sh +++ b/tools/chatgui/build.sh @@ -37,20 +37,24 @@ if [ -x "$WINDEPLOYQT" ]; then if [ $RC -eq 0 ]; then log " OK: windeployqt completed" else - log " WARN: windeployqt failed (exit $RC), trying manual copy..." - for dll in Qt5Core Qt5Gui Qt5Widgets Qt5Network; do - cp "/ucrt64/bin/${dll}.dll" "$BUILD_DIR/" 2>/dev/null && log " OK: ${dll}.dll" || log " WARN: ${dll}.dll not found" - done - for dll in libssl-3-x64 libcrypto-3-x64 zlib1; do - cp "/ucrt64/bin/${dll}.dll" "$BUILD_DIR/" 2>/dev/null || true - done + log " WARN: windeployqt failed (exit $RC)" fi else log " WARN: $WINDEPLOYQT not found (install: pacman -S mingw-w64-ucrt-x86_64-qt5-tools)" - log " Copying DLLs manually..." - for dll in Qt5Core Qt5Gui Qt5Widgets Qt5Network libssl-3-x64 libcrypto-3-x64 zlib1; do - cp "/ucrt64/bin/${dll}.dll" "$BUILD_DIR/" 2>/dev/null && log " OK: ${dll}.dll" || log " WARN: ${dll}.dll not found" - done + 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" + done + else + log " FAIL: objdump failed, cannot determine dependencies" + exit 1 + fi fi cp "$SRC_DIR/rlottie_build/librlottie.dll" "$BUILD_DIR/" 2>/dev/null && log " OK: librlottie.dll" || log " WARN: librlottie.dll not found"