From c9009d7c7a8b77572cf32f7541e4e00d3caee8f4 Mon Sep 17 00:00:00 2001 From: Bartlomiej Moskal Date: Wed, 29 May 2024 11:15:10 +0200 Subject: [PATCH] Coin: Dynamically linked FFmpeg for Android (on macOS host) Prepare for turning on dynamically linked FFmpeg on macOS: - install binutils (for readelf) on macOS; - readelf need to be used with absolute path on macOS. Prepare workaround solution for this system in fix_ffmpeg_dependencies.sh script; - install patchelf on macOS; - ensuring compatibility of sed call on Linux and macOS; Task-number: QTBUG-122010 Change-Id: I810566786de4363b4383f29467c6ca4395f9f668 Reviewed-by: Artem Dyomin (cherry picked from commit b5e6c9e59beb4d457f138729b6ade6c9ca24ca32) Reviewed-by: Qt Cherry-pick Bot --- .../common/shared/fix_ffmpeg_dependencies.sh | 8 +++++++- coin/provisioning/qtci-macos-12-x86_64/27-binutils.sh | 10 ++++++++++ coin/provisioning/qtci-macos-12-x86_64/28-patchelf.sh | 8 ++++++++ coin/provisioning/qtci-macos-13-x86_64/27-binutils.sh | 10 ++++++++++ coin/provisioning/qtci-macos-13-x86_64/28-patchelf.sh | 8 ++++++++ 5 files changed, 43 insertions(+), 1 deletion(-) create mode 100755 coin/provisioning/qtci-macos-12-x86_64/27-binutils.sh create mode 100755 coin/provisioning/qtci-macos-12-x86_64/28-patchelf.sh create mode 100755 coin/provisioning/qtci-macos-13-x86_64/27-binutils.sh create mode 100755 coin/provisioning/qtci-macos-13-x86_64/28-patchelf.sh diff --git a/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh b/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh index fc6301cf..54d566a1 100755 --- a/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh +++ b/coin/provisioning/common/shared/fix_ffmpeg_dependencies.sh @@ -8,6 +8,12 @@ lib_dir="$1/lib" additional_suffix="${2:-}" set_rpath="${3:-yes}" +if uname -a |grep -q "Darwin"; then + readelf() { + /usr/local/opt/binutils/bin/readelf "$@" + } +fi + ffmpeg_libs=("avcodec" "avdevice" "avfilter" "avformat" "avutil" "swresample" "swscale") for lib_name in "${ffmpeg_libs[@]}"; do @@ -37,7 +43,7 @@ for lib_name in "${ffmpeg_libs[@]}"; do fi done <<< "$(readelf -d $lib_path | grep '(NEEDED)' )" - sed -i -E "/^Libs.private:/s/ -l(va|va-x11|va-drm|ssl|crypto)/ -lQt6FFmpegStub-\\1/g;" $pkg_config_file_path + sed -i.bak -E '/^Libs.private:/s/ -l(va|va-x11|va-drm|ssl|crypto)/ -lQt6FFmpegStub-\1/g;' $pkg_config_file_path && rm -f ${pkg_config_file_path}.bak if [[ "$set_rpath" == "yes" ]]; then patchelf --set-rpath '$ORIGIN' $lib_path fi diff --git a/coin/provisioning/qtci-macos-12-x86_64/27-binutils.sh b/coin/provisioning/qtci-macos-12-x86_64/27-binutils.sh new file mode 100755 index 00000000..04d3c5bf --- /dev/null +++ b/coin/provisioning/qtci-macos-12-x86_64/27-binutils.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +#Copyright (C) 2024 The Qt Company Ltd +#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +set -ex + +# binutlis is installed with an error: The formula built, but is not symlinked into /usr/local +# To avoid stopping the configuration due to this problem, "|| true" is added. +brew install binutils || true + diff --git a/coin/provisioning/qtci-macos-12-x86_64/28-patchelf.sh b/coin/provisioning/qtci-macos-12-x86_64/28-patchelf.sh new file mode 100755 index 00000000..0710f483 --- /dev/null +++ b/coin/provisioning/qtci-macos-12-x86_64/28-patchelf.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +#Copyright (C) 2024 The Qt Company Ltd +#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +set -ex + +brew install patchelf + diff --git a/coin/provisioning/qtci-macos-13-x86_64/27-binutils.sh b/coin/provisioning/qtci-macos-13-x86_64/27-binutils.sh new file mode 100755 index 00000000..04d3c5bf --- /dev/null +++ b/coin/provisioning/qtci-macos-13-x86_64/27-binutils.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +#Copyright (C) 2024 The Qt Company Ltd +#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +set -ex + +# binutlis is installed with an error: The formula built, but is not symlinked into /usr/local +# To avoid stopping the configuration due to this problem, "|| true" is added. +brew install binutils || true + diff --git a/coin/provisioning/qtci-macos-13-x86_64/28-patchelf.sh b/coin/provisioning/qtci-macos-13-x86_64/28-patchelf.sh new file mode 100755 index 00000000..0710f483 --- /dev/null +++ b/coin/provisioning/qtci-macos-13-x86_64/28-patchelf.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +#Copyright (C) 2024 The Qt Company Ltd +#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +set -ex + +brew install patchelf +