Coin, FFmpeg: Check for valid envvars in install-ffmpeg-android.sh

This script requires that we have setup specific environment variables
ahead of time. If they are missing, we are prone to receiving
non-descriptive error messages.

This patch adds checks for the required environment variables, and
gives useful error messages if they are not set correctly.

Pick-to: 6.10 6.9 6.8
Change-Id: I0cfb99187f303b22dbdd46a7a848b85dbf571aad
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
This commit is contained in:
Nils Petter Skålerud 2025-06-05 10:18:56 +02:00
parent 1bbbc59714
commit 0583292728

View File

@ -13,6 +13,17 @@ target_install_dir_param="$2"
build_type=$(get_ffmpeg_build_type)
ffmpeg_source_dir=$(download_ffmpeg)
assert_envvar_is_populated_dir() {
local envvar="$1"
local value="${!envvar}"
if [ -z "$value" ] || [ ! -d "$value" ] || [ -z "$(find "$value" -mindepth 1 -type f | head -n 1)" ]; then
echo "Environment variable '$envvar' is unset, not a directory, or the directory is empty."
exit 1
fi
}
assert_envvar_is_populated_dir "OPENSSL_ANDROID_HOME_DEFAULT"
assert_envvar_is_populated_dir "ANDROID_NDK_ROOT_DEFAULT"
build_ffmpeg_android() {
local target_arch=$1
local target_dir=$2