Add ffmpeg-installation-utils.sh file

There're code duplications in install-ffmpeg scripts.
Let's have a file with FFmpeg installation utils and reuse
the functionality on unix platforms.
The utility functions make the code more robust and get
around code duplications.

This cherry-pick had a minor merge conflict because a patch
for switching arm64-simulator to x86_64-simulator was
merged before this patch. This cherry-oick was updated to
work with this change correctly.

Pick-to: 6.8 6.5
Change-Id: I28639d18c7110109e52ff09ce602da52f8857281
Reviewed-by: Jøger Hansegård <joger.hansegard@qt.io>
(cherry picked from commit 51dad84914)
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Artem Dyomin
2024-10-28 11:15:36 +01:00
committed by Nils Petter Skålerud
parent 910069f72d
commit 6d7ce3ee6e
4 changed files with 102 additions and 94 deletions

View File

@@ -5,29 +5,13 @@
# This script will build and install FFmpeg static libs
set -ex
# shellcheck source=../unix/InstallFromCompressedFileFromURL.sh
source "${BASH_SOURCE%/*}/../unix/InstallFromCompressedFileFromURL.sh"
# shellcheck source=../unix/SetEnvVar.sh
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
source "${BASH_SOURCE%/*}/../unix/ffmpeg-installation-utils.sh"
version="n7.1"
url_public="https://github.com/FFmpeg/FFmpeg/archive/refs/tags/$version.tar.gz"
sha1="f008a93710a7577e3f85a90f4b632cc615164712"
url_cached="http://ci-files01-hki.ci.qt.io/input/ffmpeg/$version.tar.gz"
ffmpeg_name="FFmpeg-$version"
target_dir="$HOME"
ffmpeg_source_dir="$target_dir/$ffmpeg_name"
ffmpeg_source_dir=$(download_ffmpeg)
ffmpeg_config_options=$(get_ffmpeg_config_options "shared")
prefix="/usr/local/ios/ffmpeg"
dylib_regex="^@rpath/.*\.dylib$"
if [ ! -d "$ffmpeg_source_dir" ];
then
InstallFromCompressedFileFromURL "$url_cached" "$url_public" "$sha1" "$target_dir"
fi
ffmpeg_config_options=$(cat "${BASH_SOURCE%/*}/../shared/ffmpeg_config_options.txt")
build_ffmpeg_ios() {
local target_platform=$1
local target_cpu_arch=""
@@ -202,6 +186,6 @@ for name in $ffmpeg_libs; do
create_xcframework $name "arm64-iphoneos" "x86_64-simulator"
done
install_ffmpeg "$ffmpeg_source_dir/build_ios/arm64-iphoneos/installed"
install_ffmpeg "$ffmpeg_source_dir/build_ios/x86_64-simulator/installed" "$ffmpeg_source_dir/build_ios/arm64-iphoneos/installed"
SetEnvVar "FFMPEG_DIR_IOS" $prefix
set_ffmpeg_dir_env_var "FFMPEG_DIR_IOS" $prefix