Browse Source

Deploy the selected Qt version and recognize Windows system DLLs

master
evgeny 5 days ago
parent
commit
3d277349be
  1. 1
      tools/chatgui/CMakeLists.txt
  2. 32
      tools/chatgui/build.sh

1
tools/chatgui/CMakeLists.txt

@ -24,6 +24,7 @@ else()
endif()
# Каталоги в ресурсах: перевод работает и в переносимой сборке без файлов рядом с exe.
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/chatgui_qt_package.txt" "${QT_PACKAGE}\n")
get_target_property(QT_QMAKE ${QT_PACKAGE}::qmake IMPORTED_LOCATION)
execute_process(COMMAND "${QT_QMAKE}" -query QT_HOST_BINS
OUTPUT_VARIABLE QT_BINARY_DIR OUTPUT_STRIP_TRAILING_WHITESPACE RESULT_VARIABLE QT_BINARY_RESULT)

32
tools/chatgui/build.sh

@ -60,8 +60,16 @@ cp "$RLOTTIE_DLL" "$BUILD_DIR/librlottie.dll" || {
}
log " OK: librlottie.dll (from $RLOTTIE_DLL; copied to $BUILD_DIR/librlottie.dll)"
FFMPEG_BIN="$SRC_DIR/ffmpeg/ffmpeg_build/install/bin"
QT_PACKAGE_FILE="$BUILD_DIR/chatgui_qt_package.txt"
[ -f "$QT_PACKAGE_FILE" ] || { log " ERROR: Qt package information missing: $QT_PACKAGE_FILE"; exit 1; }
QT_PACKAGE=$(tr -d '\r\n' < "$QT_PACKAGE_FILE")
case "$QT_PACKAGE" in
Qt5|Qt6) QT_MAJOR="${QT_PACKAGE#Qt}" ;;
*) log " ERROR: invalid configured Qt package: $QT_PACKAGE"; exit 1 ;;
esac
log " Runtime package: $QT_PACKAGE"
MAIN_DLLS=(
"Qt[56]Core.dll" "Qt[56]Gui.dll" "Qt[56]Network.dll" "Qt[56]Widgets.dll" "platforms/qwindows.dll"
"Qt${QT_MAJOR}Core.dll" "Qt${QT_MAJOR}Gui.dll" "Qt${QT_MAJOR}Network.dll" "Qt${QT_MAJOR}Widgets.dll" "platforms/qwindows.dll"
"libstdc++-6.dll" "libgcc_s_*.dll" "libwinpthread-1.dll" "librlottie.dll" "zlib1.dll" "libcrypto-*.dll"
)
if [ -d "$FFMPEG_BIN" ]; then
@ -78,7 +86,13 @@ done
if [ "$DLLS_PRESENT" -eq 1 ]; then
log " SKIP: main runtime DLLs already present; recursive dependency scan skipped"
else
WINDEPLOYQT="/ucrt64/bin/windeployqt"
WINDEPLOYQT=""
for candidate in "/ucrt64/bin/windeployqt${QT_MAJOR}.exe" "/ucrt64/bin/windeployqt-qt${QT_MAJOR}.exe" /ucrt64/bin/windeployqt.exe; do
[ -x "$candidate" ] || continue
tool_version=$("$candidate" --version 2>&1) || { log " WARN: cannot query $candidate: $tool_version"; continue; }
if [[ "$tool_version" =~ (^|[[:space:]])${QT_MAJOR}\.[0-9]+ ]]; then WINDEPLOYQT="$candidate"; break; fi
log " WARN: ignoring $candidate ($tool_version); build uses $QT_PACKAGE"
done
if [ -x "$WINDEPLOYQT" ]; then
log " Running $WINDEPLOYQT..."
"$WINDEPLOYQT" --no-translations --no-compiler-runtime "$BUILD_DIR/vibechat.exe" 2>&1 | tee -a "$LOG_FILE"
@ -89,7 +103,7 @@ else
log " WARN: windeployqt failed (exit $RC)"
fi
else
log " WARN: $WINDEPLOYQT not found (install: pacman -S mingw-w64-ucrt-x86_64-qt5-tools)"
log " WARN: matching $QT_PACKAGE windeployqt not found; copying dependencies directly"
fi
# Резолвим НЕ-Qt зависимости (FFmpeg, mingw-runtime): windeployqt копирует только Qt.
@ -143,10 +157,10 @@ else
kernel32.dll|msvcrt.dll|msvcp140.dll|vcruntime140.dll|ucrtbase.dll|\
user32.dll|gdi32.dll|gdi32full.dll|shell32.dll|shlwapi.dll|advapi32.dll|\
ole32.dll|oleaut32.dll|comdlg32.dll|comctl32.dll|ws2_32.dll|wsock32.dll|\
iphlpapi.dll|netapi32.dll|dnsapi.dll|winmm.dll|imm32.dll|version.dll|\
setupapi.dll|crypt32.dll|bcrypt.dll|bcryptprimitives.dll|ncrypt.dll|dbghelp.dll|imagehlp.dll|kernelbase.dll|\
iphlpapi.dll|netapi32.dll|dnsapi.dll|winhttp.dll|winmm.dll|imm32.dll|version.dll|\
setupapi.dll|crypt32.dll|authz.dll|bcrypt.dll|bcryptprimitives.dll|ncrypt.dll|dbghelp.dll|imagehlp.dll|kernelbase.dll|\
rpcrt4.dll|psapi.dll|powrprof.dll|cfgmgr32.dll|userenv.dll|secur32.dll|\
uxtheme.dll|dwmapi.dll|d3d11.dll|dxgi.dll|opengl32.dll|glu32.dll|\
uxtheme.dll|dwmapi.dll|d3d11.dll|d3d12.dll|dxgi.dll|opengl32.dll|glu32.dll|\
wtsapi32.dll|mpr.dll|ntdll.dll|avicap32.dll|msimg32.dll|wldap32.dll|gdiplus.dll|usp10.dll|\
dwrite.dll|winspool.drv|api-ms-win-*)
continue ;;
@ -178,7 +192,7 @@ else
[ "$MISSING" -eq 0 ] || { log " ERROR: runtime DLL deployment incomplete"; exit 1; }
# Qt platform plugin (loaded dynamically, not in import table)
mkdir -p "$BUILD_DIR/platforms"
for d in /ucrt64/share/qt5/plugins /ucrt64/lib/qt5/plugins; do
for d in "/ucrt64/share/qt${QT_MAJOR}/plugins" "/ucrt64/lib/qt${QT_MAJOR}/plugins"; do
cp "$d/platforms/qwindows.dll" "$BUILD_DIR/platforms/" 2>/dev/null && break
done
# Проверяем тот же основной комплект после копирования.
@ -186,11 +200,11 @@ else
MISSING=0
for d in "${MAIN_DLLS[@]}"; do
if ! compgen -G "$BUILD_DIR/$d" >/dev/null; then
log " WARN: $d MISSING in build dir"; MISSING=1
log " ERROR: $d MISSING in build dir"; MISSING=1
fi
done
if [ "$MISSING" -eq 1 ]; then
log " WARN: some main runtime DLLs missing — app may not start"
log " ERROR: required runtime DLLs missing"; exit 1
fi
fi
cp "$SRC_DIR/setup_firewall.bat" "$BUILD_DIR/" 2>/dev/null && log " OK: setup_firewall.bat" || log " WARN: setup_firewall.bat not found"

Loading…
Cancel
Save