Linux, FFmpeg: Make install-ffmpeg-linux.sh take an output parameter

Currently, this script is hardcoded to output to the directory
'/usr/local/'. This output is stored in the variable 'prefix'. However,
this variable is used inconsistently in the script, meaning we cannot
actually modify the variable to change the output directory.

This patch does the following:
- Applies the 'prefix' variable where necessary.
- Allows an optional command-line parameter to be applied to 'prefix',
allowing one to specify where the output directory. This is
particularly useful for local builds.

No changes to current CI behavior.

Pick-to: 6.11 6.10 6.8
Change-Id: I51f83ce3844c2aa9db778b1c54091acb64a227e6
Reviewed-by: Dimitrios Apostolou <jimis@qt.io>
Reviewed-by: Artem Dyomin <artem.dyomin@qt.io>
This commit is contained in:
Nils Petter Skålerud
2025-08-29 09:30:52 +02:00
committed by Nils Petter Skålerud
parent 6bd3b23b6c
commit e3966f2ffc

View File

@@ -3,6 +3,10 @@
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
# This script builds and installs FFmpeg static or shared (default) libs
# It can take an optional output parameter for installation:
#
# install-ffmpeg-linx.sh shared ~/my/install/path
set -ex
source "${BASH_SOURCE%/*}/../unix/ffmpeg-installation-utils.sh"
@@ -12,7 +16,8 @@ build_type=$(get_ffmpeg_build_type "$1")
ffmpeg_source_dir=$(download_ffmpeg)
ffmpeg_name=$(basename "$ffmpeg_source_dir")
ffmpeg_config_options=$(get_ffmpeg_config_options "$build_type")
prefix="/usr/local/$ffmpeg_name"
default_prefix="/usr/local/$ffmpeg_name"
prefix="${2:-$default_prefix}"
pkgconfig_path="$PKG_CONFIG_PATH"
install_ff_nvcodec_headers() {
@@ -95,5 +100,6 @@ if [ "$build_type" == "shared" ]; then
"$fix_dependencies" "$output_dir"
fi
sudo mv "$output_dir" "/usr/local"
sudo mkdir -p "$prefix"
sudo mv "$output_dir"/* "$prefix"
set_ffmpeg_dir_env_var "FFMPEG_DIR" "$prefix"