1
This commit is contained in:
1 parent
2d21c53b4b
commit
fb37ca747a
1 file changed
+44
-19
+44
-19
@@ -57,13 +57,30 @@ fi
|
||||
# а pacman-ffmpeg той же мажорной версии в /ucrt64/bin дал бы неверный набор кодеков.
|
||||
FFMPEG_BIN="$SRC_DIR/ffmpeg/ffmpeg_build/install/bin"
|
||||
OBJDUMP="objdump"; [ -n "${MSYSTEM_PREFIX:-}" ] && OBJDUMP="$MSYSTEM_PREFIX/bin/objdump"
|
||||
shopt -s nocasematch
|
||||
command -v "$OBJDUMP" >/dev/null 2>&1 || { log " ERROR: $OBJDUMP not found"; exit 1; }
|
||||
shopt -s nocasematch nullglob
|
||||
# Обновляем весь комплект FFmpeg, включая DLL, не импортируемые напрямую приложением.
|
||||
for src in "$FFMPEG_BIN/"*.dll; do
|
||||
cp "$src" "$BUILD_DIR/" || { log " ERROR: failed to copy $src"; exit 1; }
|
||||
log " OK: $(basename "$src") (ffmpeg)"
|
||||
done
|
||||
log " Resolving non-Qt dependencies recursively..."
|
||||
todo="$BUILD_DIR/vibechat.exe"
|
||||
while [ -n "$todo" ]; do
|
||||
next_todo=""
|
||||
for src in $todo; do
|
||||
for dep in $($OBJDUMP -p "$src" 2>/dev/null | grep "DLL Name:" | awk '{print $3}'); do
|
||||
# Проверяем также уже скопированные DLL: наличие файла не гарантирует наличие его зависимостей.
|
||||
todo=("$BUILD_DIR/vibechat.exe" "$BUILD_DIR/"*.dll)
|
||||
declare -A scanned=()
|
||||
MISSING=0
|
||||
for ((i = 0; i < ${#todo[@]}; i++)); do
|
||||
src="${todo[i]}"
|
||||
key="${src,,}"
|
||||
[ -n "${scanned[$key]:-}" ] && continue
|
||||
scanned[$key]=1
|
||||
if ! imports=$("$OBJDUMP" -p "$src" 2>&1); then
|
||||
log " ERROR: cannot inspect $src: $imports"
|
||||
MISSING=1
|
||||
continue
|
||||
fi
|
||||
log " Checking: $src"
|
||||
while read -r dep; do
|
||||
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|\
|
||||
@@ -75,19 +92,27 @@ while [ -n "$todo" ]; do
|
||||
wtsapi32.dll|mpr.dll|api-ms-win-*)
|
||||
continue ;;
|
||||
esac
|
||||
[ -f "$BUILD_DIR/$dep" ] && continue
|
||||
if [ -d "$FFMPEG_BIN" ] && cp "$FFMPEG_BIN/$dep" "$BUILD_DIR/" 2>/dev/null; then
|
||||
log " OK: $dep (ffmpeg)"; next_todo="$next_todo $BUILD_DIR/$dep"
|
||||
elif cp "/ucrt64/bin/$dep" "$BUILD_DIR/" 2>/dev/null; then
|
||||
log " OK: $dep"; next_todo="$next_todo $BUILD_DIR/$dep"
|
||||
elif cp "/mingw64/bin/$dep" "$BUILD_DIR/" 2>/dev/null; then
|
||||
log " OK: $dep (mingw64)"; next_todo="$next_todo $BUILD_DIR/$dep"
|
||||
if [ ! -f "$BUILD_DIR/$dep" ]; then
|
||||
dep_src=""
|
||||
for dir in "$FFMPEG_BIN" /ucrt64/bin "$SRC_DIR/rlottie_build"; do
|
||||
if [ -f "$dir/$dep" ]; then
|
||||
dep_src="$dir/$dep"
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ -z "$dep_src" ]; then
|
||||
log " ERROR: $src requires $dep; not found in FFmpeg, UCRT64 or rlottie directories"
|
||||
MISSING=1
|
||||
continue
|
||||
fi
|
||||
cp "$dep_src" "$BUILD_DIR/" || { log " ERROR: failed to copy $dep_src"; exit 1; }
|
||||
log " OK: $dep (from $dep_src; required by $src)"
|
||||
fi
|
||||
done
|
||||
done
|
||||
todo="$next_todo"
|
||||
todo+=("$BUILD_DIR/$dep")
|
||||
done < <(awk '/DLL Name:/ {print $3}' <<< "$imports")
|
||||
done
|
||||
shopt -u nocasematch
|
||||
shopt -u nocasematch nullglob
|
||||
[ "$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
|
||||
@@ -101,7 +126,7 @@ log " Verifying required non-Qt DLLs..."
|
||||
MISSING=0
|
||||
if [ -d "$FFMPEG_BIN" ]; then
|
||||
for d in avcodec-*.dll avformat-*.dll avutil-*.dll swscale-*.dll swresample-*.dll; do
|
||||
if ls "$BUILD_DIR/$d" >/dev/null 2>&1; then
|
||||
if compgen -G "$BUILD_DIR/$d" >/dev/null; then
|
||||
log " OK: $d"
|
||||
else
|
||||
log " WARN: $d MISSING in build dir"; MISSING=1
|
||||
@@ -111,7 +136,7 @@ else
|
||||
log " SKIP: FFmpeg not built — no FFmpeg DLLs expected"
|
||||
fi
|
||||
for d in libstdc++-6.dll libgcc_s_*.dll libwinpthread-1.dll librlottie.dll zlib1.dll libcrypto-*.dll; do
|
||||
if ls "$BUILD_DIR/$d" >/dev/null 2>&1; then
|
||||
if compgen -G "$BUILD_DIR/$d" >/dev/null; then
|
||||
log " OK: $d"
|
||||
else
|
||||
log " WARN: $d MISSING in build dir"; MISSING=1
|
||||
|
||||
Reference in new issue
Block a user