mirror of
git://code.qt.io/qt/qt5.git
synced 2026-03-07 04:46:06 +08:00
Task-number: QTBUG-140468
Change-Id: Ia77053bd4022a9691b4729e748884fd42ee2d1a8
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
(cherry picked from commit c3809a73ea)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
76 lines
2.0 KiB
Bash
Executable File
76 lines
2.0 KiB
Bash
Executable File
#!/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
|
|
|
|
download_ffmpeg() {
|
|
local version="${1:-n7.1.2}"
|
|
local sha1="${2:-1e4e937facdbde15943dd093121836bf69f27c7c}"
|
|
|
|
local ffmpeg_name="FFmpeg-$version"
|
|
local target_dir="$HOME"
|
|
local ffmpeg_source_dir="$target_dir/$ffmpeg_name"
|
|
|
|
if [ ! -d "$ffmpeg_source_dir" ]; then
|
|
local url_public="https://github.com/FFmpeg/FFmpeg/archive/refs/tags/$version.tar.gz"
|
|
local url_cached="http://ci-files01-hki.ci.qt.io/input/ffmpeg/$version.tar.gz"
|
|
local app_prefix=""
|
|
|
|
source "${BASH_SOURCE%/*}/../unix/InstallFromCompressedFileFromURL.sh"
|
|
InstallFromCompressedFileFromURL "$url_cached" "$url_public" "$sha1" "$target_dir" "$app_prefix" > /dev/null
|
|
fi
|
|
|
|
echo "$ffmpeg_source_dir"
|
|
}
|
|
|
|
get_ffmpeg_config_options() {
|
|
local build_type="$1"
|
|
local result
|
|
|
|
result=$(cat "${BASH_SOURCE%/*}/../shared/ffmpeg_config_options.txt")
|
|
|
|
if [ "$build_type" != "static" ]; then
|
|
result+=" --enable-shared --disable-static"
|
|
fi
|
|
|
|
echo "$result"
|
|
}
|
|
|
|
|
|
get_ffmpeg_build_type() {
|
|
local result="${1:-shared}"
|
|
|
|
if [ "$result" != "static" ] && [ "$result" != "shared" ]; then
|
|
>&2 echo "Invalid build_type: $result. The shared build type will be used."
|
|
result="shared"
|
|
fi
|
|
|
|
echo "$result"
|
|
}
|
|
|
|
set_ffmpeg_dir_env_var() {
|
|
local envvar="$1"
|
|
local dir="$2"
|
|
|
|
if [ ! -d "$dir" ]; then
|
|
>&2 echo "the FFmpeg dir $dir doesn't exist"
|
|
exit 1
|
|
fi
|
|
|
|
# minimal validity check, more checks can be added
|
|
if [ ! -d "$dir/include" ] || [ ! -d "$dir/lib" ]; then
|
|
>&2 echo "The FFmpeg dir $dir is not valid"
|
|
exit 1
|
|
fi
|
|
|
|
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
|
|
SetEnvVar "$envvar" "$dir"
|
|
}
|
|
|
|
set_ffmpeg_env_var() {
|
|
local envvar="$1"
|
|
local value="$2"
|
|
|
|
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
|
|
SetEnvVar "$envvar" "$value"
|
|
}
|