Browse Source

Fix Windows system DLL detection in chatgui deployment

master
evgeny 1 week ago
parent
commit
3279aa86ce
  1. 5
      tools/chatgui/build.sh
  2. 14
      tools/chatgui/tests/test_runtime_deploy.sh

5
tools/chatgui/build.sh

@ -139,6 +139,7 @@ done
log " OK: $(basename "$src") (from $src)"
done
log " Resolving non-Qt dependencies recursively..."
log " Windows system DLLs are provided by the OS and excluded from deployment"
# Проверяем также уже скопированные DLL: наличие файла не гарантирует наличие его зависимостей.
todo=("$BUILD_DIR/vibechat.exe" "$BUILD_DIR/"*.dll "$BUILD_DIR/platforms/"*.dll "$BUILD_DIR/imageformats/"*.dll)
declare -A scanned=()
@ -172,12 +173,12 @@ done
[ -z "$dep" ] && continue
case "$dep" in
kernel32.dll|msvcrt.dll|msvcp140.dll|vcruntime140.dll|ucrtbase.dll|\
user32.dll|gdi32.dll|gdi32full.dll|shell32.dll|shlwapi.dll|advapi32.dll|\
user32.dll|gdi32.dll|gdi32full.dll|shell32.dll|shlwapi.dll|shcore.dll|advapi32.dll|\
ole32.dll|oleaut32.dll|comdlg32.dll|comctl32.dll|ws2_32.dll|wsock32.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|d3d12.dll|dxgi.dll|opengl32.dll|glu32.dll|\
uxtheme.dll|dwmapi.dll|d3d9.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 ;;

14
tools/chatgui/tests/test_runtime_deploy.sh

@ -37,11 +37,14 @@ prepare_case() {
printf 'DLL Name: d3d12.dll\nDLL Name: libpng.dll\n' > "$prefix/bin/Qt$1Gui.dll"
printf 'DLL Name: WINHTTP.dll\n' > "$prefix/bin/Qt$1Network.dll"
printf 'DLL Name: Qt%sGui.dll\nDLL Name: Qt%sCore.dll\nDLL Name: libstdc++-6.dll\n' "$1" "$1" > "$prefix/bin/Qt$1Widgets.dll"
for name in libpng.dll libstdc++-6.dll libgcc_s_seh-1.dll libwinpthread-1.dll zlib1.dll libcrypto-3.dll plugin-helper.dll jpeg-helper.dll; do
for name in libpng.dll libstdc++-6.dll libgcc_s_seh-1.dll libwinpthread-1.dll zlib1.dll libcrypto-3.dll \
plugin-helper.dll jpeg-helper.dll webp-helper.dll; do
printf 'DLL Name: KERNEL32.dll\n' > "$prefix/bin/$name"
done
printf 'DLL Name: Qt%sGui.dll\nDLL Name: plugin-helper.dll\n' "$1" > "$prefix/share/qt$1/plugins/platforms/qwindows.dll"
printf 'DLL Name: d3d9.dll\nDLL Name: SHCORE.dll\n' >> "$prefix/share/qt$1/plugins/platforms/qwindows.dll"
printf 'DLL Name: jpeg-helper.dll\n' > "$prefix/share/qt$1/plugins/imageformats/qjpeg.dll"
printf 'DLL Name: webp-helper.dll\n' > "$prefix/share/qt$1/plugins/imageformats/qwebp.dll"
cat > "$prefix/bin/windeployqt$1.exe" <<SH
#!/bin/bash
if [ "\$1" = --version ]; then echo 'windeployqt $1.10.0'; else echo 'Qt$1 deploy' >> "\$DEPLOY_TOOL_LOG"; fi
@ -60,13 +63,16 @@ mkdir -p "$case_dir/build/platforms" "$prefix/share/qt5/plugins/platforms"
printf 'wrong Qt5 plugin\n' > "$prefix/share/qt5/plugins/platforms/qwindows.dll"
for component in Core Gui Network Widgets; do printf 'old Qt5\n' > "$case_dir/build/Qt5$component.dll"; done
run_case 6
for name in Qt6Gui.dll plugin-helper.dll jpeg-helper.dll imageformats/qjpeg.dll; do assert_file "$case_dir/build/$name"; done
for name in Qt6Gui.dll plugin-helper.dll jpeg-helper.dll webp-helper.dll imageformats/qjpeg.dll imageformats/qwebp.dll; do
assert_file "$case_dir/build/$name"
done
cmp "$case_dir/build/platforms/qwindows.dll" "$prefix/share/qt6/plugins/platforms/qwindows.dll"
cmp "$case_dir/build/imageformats/qwebp.dll" "$prefix/share/qt6/plugins/imageformats/qwebp.dll"
[ "$(cat "$case_dir/tool.log")" = 'Qt6 deploy' ]
# Наличие основных DLL не отменяет проверку транзитивных зависимостей.
rm "$case_dir/build/libpng.dll" "$case_dir/build/plugin-helper.dll"
run_case 6; assert_file "$case_dir/build/libpng.dll"; assert_file "$case_dir/build/plugin-helper.dll"
echo 'PASS: Qt6, Windows system DLLs, matching platform/JPEG plugins and repeated dependency checks'
echo 'PASS: Qt6, Windows system DLLs (d3d9/SHCORE), matching platform/JPEG/WebP plugins and repeated dependency checks'
# Сбой подходящего инструмента не должен обходить обязательную проверку ручного комплекта.
cat > "$prefix/bin/windeployqt6.exe" <<'SH'
@ -97,4 +103,6 @@ echo 'PASS: missing plugin dependency rejects incomplete deployment'
prepare_case 5; run_case 5
assert_file "$case_dir/build/Qt5Gui.dll"; [ "$(cat "$case_dir/tool.log")" = 'Qt5 deploy' ]
cmp "$case_dir/build/platforms/qwindows.dll" "$prefix/share/qt5/plugins/platforms/qwindows.dll"
assert_file "$case_dir/build/webp-helper.dll"
cmp "$case_dir/build/imageformats/qwebp.dll" "$prefix/share/qt5/plugins/imageformats/qwebp.dll"
echo 'PASS: configured Qt5 fallback deploys matching DLLs and plugins'

Loading…
Cancel
Save