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 <artem.dyomin@qt.io>
This commit is contained in:
Bartlomiej Moskal
2024-05-28 11:26:11 +02:00
parent 49b0435e7e
commit 5cef9d32c5

View File

@@ -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)' )"