From 22e16fdfcbb85b89ab0a8abbf16e37568ebde619 Mon Sep 17 00:00:00 2001 From: Javernaut Date: Sun, 19 Apr 2020 17:19:40 +0300 Subject: [PATCH] Passing desired ABIs as an argument --- ffmpeg-android-maker.sh | 8 ++------ scripts/parse-arguments.sh | 41 +++++++++++++++++++++++++++++++++----- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/ffmpeg-android-maker.sh b/ffmpeg-android-maker.sh index 8cba281..ad7f947 100755 --- a/ffmpeg-android-maker.sh +++ b/ffmpeg-android-maker.sh @@ -97,12 +97,8 @@ do cd ${BASE_DIR} done -# ABIs to build FFmpeg for. -# x86 is the first, because it is likely to have Text Relocations. -# In this case the rest ABIs will not be assembled at all. -ABIS_TO_BUILD=( "x86" "x86_64" "armeabi-v7a" "arm64-v8a" ) - -for ABI in ${ABIS_TO_BUILD[@]} +# Main build loop +for ABI in ${FFMPEG_ABIS_TO_BUILD[@]} do # Exporting variables for the current ABI source ${SCRIPTS_DIR}/export-build-variables.sh ${ABI} diff --git a/scripts/parse-arguments.sh b/scripts/parse-arguments.sh index acc3e4d..20be61d 100755 --- a/scripts/parse-arguments.sh +++ b/scripts/parse-arguments.sh @@ -3,16 +3,38 @@ # This script parses arguments that were passed to ffmpeg-android-maker.sh # and exports a bunch of varables that are used elsewhere. -# Local variables with default values. Can be overridden with specific arguments -# See the end of this file for more description -EXTERNAL_LIBRARIES=() +# Local variables with default values (except ABIS_TO_BUILD). +# Can be overridden with specific arguments. +# See the end of this file for more description. +ABIS_TO_BUILD=() +API_LEVEL=16 SOURCE_TYPE=TAR SOURCE_VALUE=4.2.2 -API_LEVEL=16 +EXTERNAL_LIBRARIES=() for argument in "$@" do case $argument in + # Build for only specified ABIs (separated by comma) + --target-abis=*|-abis=*) + IFS=',' read -ra ABIS <<< "${argument#*=}" + for abi in "${ABIS[@]}"; do + case $abi in + x86|x86_64|armeabi-v7a|arm64-v8a) + ABIS_TO_BUILD+=( "$abi" ) + ;; + arm) + ABIS_TO_BUILD+=( "armeabi-v7a" ) + ;; + arm64) + ABIS_TO_BUILD+=( "arm64-v8a" ) + ;; + *) + echo "Unknown ABI: $abi" + ;; + esac + done + ;; # Use this value as Android platform version during compilation. --android-api-level=*|-android=*) API_LEVEL="${argument#*=}" @@ -55,11 +77,20 @@ do esac done +# if ABIS_TO_BUILD list is empty, then fill it with all supported ABIs +# The x86 is the first, because it is more likely to have Text Relocations. +# In this case the rest ABIs will not be assembled at all. +if [ ${#ABIS_TO_BUILD[@]} -eq 0 ]; then + ABIS_TO_BUILD=( "x86" "x86_64" "armeabi-v7a" "arm64-v8a" ) +fi +# The FFmpeg will be build for ABIs in this list +export FFMPEG_ABIS_TO_BUILD=${ABIS_TO_BUILD[@]} + # Saving the information FFmpeg's source code downloading export FFMPEG_SOURCE_TYPE=$SOURCE_TYPE export FFMPEG_SOURCE_VALUE=$SOURCE_VALUE -# A list of external libraries to build into the FFMpeg +# A list of external libraries to build into the FFmpeg # Elements from this list are used for strings substitution export FFMPEG_EXTERNAL_LIBRARIES=${EXTERNAL_LIBRARIES[@]}