From 5cef9d32c5cad1b6e044161ffede7148dda1528c Mon Sep 17 00:00:00 2001 From: Bartlomiej Moskal Date: Tue, 28 May 2024 11:26:11 +0200 Subject: [PATCH] Coin: Extend script for fixing FFmpeg dependencies to stubs The fix_ffmpeg_dependency.sh script should also take into account libraries with a _3 suffix in their names. This suffix will not be used in the stub name. Additionally, Android libraries have a suffix specifying the architecture (e.g. _x86_64 or _arm64-v8a). Add an additional parameter to the script with stub_sufix. Pick-to: 6.8 Task-number: QTBUG-122010 Change-Id: Ia844b7b1f73c2d5264384ef26b41a292ea70d749 Reviewed-by: Artem Dyomin --- .../common/linux/fix_ffmpeg_dependencies.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/coin/provisioning/common/linux/fix_ffmpeg_dependencies.sh b/coin/provisioning/common/linux/fix_ffmpeg_dependencies.sh index 627e6a77..7440fc4c 100755 --- a/coin/provisioning/common/linux/fix_ffmpeg_dependencies.sh +++ b/coin/provisioning/common/linux/fix_ffmpeg_dependencies.sh @@ -5,6 +5,7 @@ set -x lib_dir="$1/lib" +additional_suffix="${2:-}" ffmpeg_libs=("avcodec" "avdevice" "avfilter" "avformat" "avutil" "swresample" "swscale") @@ -23,8 +24,15 @@ for lib_name in "${ffmpeg_libs[@]}"; do fi while read -r line; do - if [[ $line =~ .*\[(lib((ssl|crypto|va|va-x11|va-drm)\.so(\.[0-9]+)*))\].* ]]; then - patchelf --replace-needed "${BASH_REMATCH[1]}" "libQt6FFmpegStub-${BASH_REMATCH[2]}" $lib_path + if [[ $line =~ .*\[(lib((ssl|crypto|va|va-x11|va-drm)(_3)?\.so(\.[0-9]+)*))\].* ]]; then + stub_name="libQt6FFmpegStub-${BASH_REMATCH[2]}" + if [[ ${BASH_REMATCH[4]} == "_3" ]]; then + stub_name="${stub_name/_3/}" # Remove "_3" from stub_name + fi + if [[ -n "$additional_suffix" ]]; then + stub_name="${stub_name%%.*}${additional_suffix}.${stub_name#*.}" # Add additional_suffix + fi + patchelf --replace-needed "${BASH_REMATCH[1]}" "${stub_name}" $lib_path fi done <<< "$(readelf -d $lib_path | grep '(NEEDED)' )"