From 3ed992a8225fd0b865d62114ecb7de9a8188c4c9 Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Tue, 28 Dec 2021 00:33:12 +0000 Subject: [PATCH] implement a build flag to disable an external library --- android.sh | 11 +++++++++++ apple.sh | 11 +++++++++++ ios.sh | 11 +++++++++++ macos.sh | 11 +++++++++++ scripts/function.sh | 3 ++- tvos.sh | 11 +++++++++++ 6 files changed, 57 insertions(+), 1 deletion(-) diff --git a/android.sh b/android.sh index 89d488d..05f5b23 100755 --- a/android.sh +++ b/android.sh @@ -15,6 +15,7 @@ export BASEDIR="$(pwd)" export FFMPEG_KIT_BUILD_TYPE="android" source "${BASEDIR}"/scripts/variable.sh source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh +disabled_libraries=() # SET DEFAULTS SETTINGS enable_default_android_architectures @@ -111,6 +112,11 @@ while [ ! $# -eq 0 ]; do enable_library "${ENABLED_LIBRARY}" ;; + --disable-lib-*) + DISABLED_LIB=$(echo $1 | sed -e 's/^--[A-Za-z]*-[A-Za-z]*-//g') + + disabled_libraries+=("${DISABLED_LIB}") + ;; --disable-*) DISABLED_ARCH=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') @@ -149,6 +155,11 @@ if [[ -n ${BUILD_FULL} ]]; then done fi +# DISABLE SPECIFIED LIBRARIES +for disabled_library in ${disabled_libraries[@]}; do + set_library "${disabled_library}" 0 +done + # IF HELP DISPLAYED EXIT if [[ -n ${DISPLAY_HELP} ]]; then display_help diff --git a/apple.sh b/apple.sh index a1a1325..01ee414 100755 --- a/apple.sh +++ b/apple.sh @@ -170,6 +170,7 @@ export BASEDIR="$(pwd)" source "${BASEDIR}"/scripts/variable.sh export FFMPEG_KIT_BUILD_TYPE="apple" source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh +disabled_libraries=() # SET DEFAULTS SETTINGS enable_default_architecture_variants @@ -233,6 +234,11 @@ while [ ! $# -eq 0 ]; do enable_library "${ENABLED_LIBRARY}" ;; + --disable-lib-*) + DISABLED_LIB=$(echo $1 | sed -e 's/^--[A-Za-z]*-[A-Za-z]*-//g') + + disabled_libraries+=("${DISABLED_LIB}") + ;; --disable-*) DISABLED_ARCH_VARIANT=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') @@ -258,6 +264,11 @@ if [[ -n ${BUILD_FULL} ]]; then done fi +# DISABLE SPECIFIED LIBRARIES +for disabled_library in ${disabled_libraries[@]}; do + set_library "${disabled_library}" 0 +done + # IF HELP DISPLAYED EXIT if [[ -n ${DISPLAY_HELP} ]]; then display_help diff --git a/ios.sh b/ios.sh index 7e3677f..5a2be2b 100755 --- a/ios.sh +++ b/ios.sh @@ -16,6 +16,7 @@ export BASEDIR="$(pwd)" export FFMPEG_KIT_BUILD_TYPE="ios" source "${BASEDIR}"/scripts/variable.sh source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh +disabled_libraries=() # SET DEFAULTS SETTINGS enable_default_ios_architectures @@ -120,6 +121,11 @@ while [ ! $# -eq 0 ]; do enable_library "${ENABLED_LIBRARY}" ;; + --disable-lib-*) + DISABLED_LIB=$(echo $1 | sed -e 's/^--[A-Za-z]*-[A-Za-z]*-//g') + + disabled_libraries+=("${DISABLED_LIB}") + ;; --disable-*) DISABLED_ARCH=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') @@ -155,6 +161,11 @@ if [[ -n ${BUILD_FULL} ]]; then done fi +# DISABLE SPECIFIED LIBRARIES +for disabled_library in ${disabled_libraries[@]}; do + set_library "${disabled_library}" 0 +done + # IF HELP DISPLAYED EXIT if [[ -n ${DISPLAY_HELP} ]]; then display_help diff --git a/macos.sh b/macos.sh index a6ae0d7..9a5e541 100755 --- a/macos.sh +++ b/macos.sh @@ -16,6 +16,7 @@ export BASEDIR="$(pwd)" export FFMPEG_KIT_BUILD_TYPE="macos" source "${BASEDIR}"/scripts/variable.sh source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh +disabled_libraries=() # SET DEFAULTS SETTINGS enable_default_macos_architectures @@ -120,6 +121,11 @@ while [ ! $# -eq 0 ]; do enable_library "${ENABLED_LIBRARY}" ;; + --disable-lib-*) + DISABLED_LIB=$(echo $1 | sed -e 's/^--[A-Za-z]*-[A-Za-z]*-//g') + + disabled_libraries+=("${DISABLED_LIB}") + ;; --disable-*) DISABLED_ARCH=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') @@ -150,6 +156,11 @@ if [[ -n ${BUILD_FULL} ]]; then done fi +# DISABLE SPECIFIED LIBRARIES +for disabled_library in ${disabled_libraries[@]}; do + set_library "${disabled_library}" 0 +done + # IF HELP DISPLAYED EXIT if [[ -n ${DISPLAY_HELP} ]]; then display_help diff --git a/scripts/function.sh b/scripts/function.sh index a430fb0..7e4ac0f 100755 --- a/scripts/function.sh +++ b/scripts/function.sh @@ -1467,7 +1467,8 @@ print_redownload_requested_libraries() { # 1 - library index get_external_library_license_path() { case $1 in - 1 | 35) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE.TXT" ;; + 1) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE.TXT" ;; + 35) echo "${BASEDIR}/src/$(get_library_name "$1")/LICENSE.txt" ;; 3 | 39) echo "${BASEDIR}/src/$(get_library_name "$1")/COPYING.LESSERv3" ;; 5 | 41) echo "${BASEDIR}/src/$(get_library_name "$1")/$(get_library_name "$1")/COPYING" ;; 19) echo "${BASEDIR}/src/$(get_library_name "$1")/$(get_library_name "$1")/LICENSE" ;; diff --git a/tvos.sh b/tvos.sh index 9ce73c7..603b005 100755 --- a/tvos.sh +++ b/tvos.sh @@ -16,6 +16,7 @@ export BASEDIR="$(pwd)" export FFMPEG_KIT_BUILD_TYPE="tvos" source "${BASEDIR}"/scripts/variable.sh source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh +disabled_libraries=() # SET DEFAULTS SETTINGS enable_default_tvos_architectures @@ -120,6 +121,11 @@ while [ ! $# -eq 0 ]; do enable_library "${ENABLED_LIBRARY}" ;; + --disable-lib-*) + DISABLED_LIB=$(echo $1 | sed -e 's/^--[A-Za-z]*-[A-Za-z]*-//g') + + disabled_libraries+=("${DISABLED_LIB}") + ;; --disable-*) DISABLED_ARCH=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') @@ -150,6 +156,11 @@ if [[ -n ${BUILD_FULL} ]]; then done fi +# DISABLE SPECIFIED LIBRARIES +for disabled_library in ${disabled_libraries[@]}; do + set_library "${disabled_library}" 0 +done + # IF HELP DISPLAYED EXIT if [[ -n ${DISPLAY_HELP} ]]; then display_help