From d94bd1b873086ab14b6f9ec82b436261154801fb Mon Sep 17 00:00:00 2001 From: Taner Sener Date: Tue, 26 Jan 2021 23:34:56 +0000 Subject: [PATCH] add no-archive/no-framework option in top level build scripts --- android.sh | 49 +++++++++++++++++++++++-------------- ios.sh | 44 +++++++++++++++++++++------------ macos.sh | 44 +++++++++++++++++++++------------ scripts/function-android.sh | 2 +- scripts/function-ios.sh | 6 ++++- scripts/function-macos.sh | 6 ++++- scripts/function-tvos.sh | 6 ++++- scripts/function.sh | 6 ++++- tvos.sh | 45 +++++++++++++++++++++------------- 9 files changed, 135 insertions(+), 73 deletions(-) diff --git a/android.sh b/android.sh index 679077b..e4db576 100755 --- a/android.sh +++ b/android.sh @@ -61,6 +61,9 @@ while [ ! $# -eq 0 ]; do skip_library "${SKIP_LIBRARY}" ;; + --no-archive) + NO_ARCHIVE="1" + ;; --no-output-redirection) no_output_redirection ;; @@ -270,25 +273,33 @@ if [[ -n ${ANDROID_ARCHITECTURES} ]]; then echo "skipped" fi - echo -e -n "\n\nCreating Android archive under prebuilt: " + echo -e -n "\n" - # BUILD ANDROID ARCHIVE - ./gradlew ffmpeg-kit-android-lib:clean ffmpeg-kit-android-lib:assembleRelease ffmpeg-kit-android-lib:testReleaseUnitTest 1>>"${BASEDIR}"/build.log 2>&1 - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 + # DO NOT BUILD ANDROID ARCHIVE + if [[ ${NO_ARCHIVE} -ne 1 ]]; then + + echo -e -n "\nCreating Android archive under prebuilt: " + + # BUILD ANDROID ARCHIVE + ./gradlew ffmpeg-kit-android-lib:clean ffmpeg-kit-android-lib:assembleRelease ffmpeg-kit-android-lib:testReleaseUnitTest 1>>"${BASEDIR}"/build.log 2>&1 + if [ $? -ne 0 ]; then + echo -e "failed\n" + exit 1 + fi + + # COPY ANDROID ARCHIVE TO PREBUILT DIRECTORY + FFMPEG_KIT_AAR="${BASEDIR}/prebuilt/$(get_aar_directory)/ffmpeg-kit" + rm -rf "${FFMPEG_KIT_AAR}" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${FFMPEG_KIT_AAR}" 1>>"${BASEDIR}"/build.log 2>&1 + cp "${BASEDIR}"/android/ffmpeg-kit-android-lib/build/outputs/aar/ffmpeg-kit-release.aar "${FFMPEG_KIT_AAR}"/ffmpeg-kit.aar 1>>"${BASEDIR}"/build.log 2>&1 + if [ $? -ne 0 ]; then + echo -e "failed\n" + exit 1 + fi + + echo -e "INFO: Created ffmpeg-kit Android archive successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "ok\n" + else + echo -e "INFO: Skipped creating Android archive.\n" 1>>"${BASEDIR}"/build.log 2>&1 fi - - # COPY ANDROID ARCHIVE TO PREBUILT DIRECTORY - FFMPEG_KIT_AAR="${BASEDIR}/prebuilt/$(get_aar_directory)/ffmpeg-kit" - rm -rf "${FFMPEG_KIT_AAR}" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${FFMPEG_KIT_AAR}" 1>>"${BASEDIR}"/build.log 2>&1 - cp "${BASEDIR}"/android/ffmpeg-kit-android-lib/build/outputs/aar/ffmpeg-kit-release.aar "${FFMPEG_KIT_AAR}"/ffmpeg-kit.aar 1>>"${BASEDIR}"/build.log 2>&1 - if [ $? -ne 0 ]; then - echo -e "failed\n" - exit 1 - fi - - echo -e "Created ffmpeg-kit Android archive successfully.\n" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "ok\n" fi diff --git a/ios.sh b/ios.sh index 5866841..dc35341 100755 --- a/ios.sh +++ b/ios.sh @@ -68,6 +68,9 @@ while [ ! $# -eq 0 ]; do skip_library "${SKIP_LIBRARY}" ;; + --no-framework) + NO_FRAMEWORK="1" + ;; --no-output-redirection) no_output_redirection ;; @@ -249,30 +252,39 @@ for run_arch in {0..12}; do fi done -# BUILD FFMPEG-KIT -if [[ -n ${TARGET_ARCH_LIST[0]} ]]; then +echo -e -n "\n" - # INITIALIZE TARGET FOLDERS - initialize_prebuilt_ios_folders +# DO NOT BUILD FRAMEWORKS +if [[ ${NO_FRAMEWORK} -ne 1 ]]; then - # PREPARE PLATFORM ARCHITECTURE STRINGS - build_apple_architecture_variant_strings + # BUILD FFMPEG-KIT + if [[ -n ${TARGET_ARCH_LIST[0]} ]]; then - if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then - echo -e -n "\n\nCreating universal libraries and xcframeworks under prebuilt: " + # INITIALIZE TARGET FOLDERS + initialize_prebuilt_ios_folders - create_universal_libraries_for_ios_xcframeworks + # PREPARE PLATFORM ARCHITECTURE STRINGS + build_apple_architecture_variant_strings - create_frameworks_for_ios_xcframeworks + if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then + echo -e -n "\nCreating universal libraries and xcframeworks under prebuilt: " - create_ios_xcframeworks - else - echo -e -n "\n\nCreating universal libraries and frameworks under prebuilt: " + create_universal_libraries_for_ios_xcframeworks - create_universal_libraries_for_ios_default_frameworks + create_frameworks_for_ios_xcframeworks - create_ios_default_frameworks + create_ios_xcframeworks + else + echo -e -n "\nCreating universal libraries and frameworks under prebuilt: " + + create_universal_libraries_for_ios_default_frameworks + + create_ios_default_frameworks + fi + + echo -e "ok\n" fi - echo -e "ok\n" +else + echo -e "INFO: Skipped creating iOS frameworks.\n" 1>>"${BASEDIR}"/build.log 2>&1 fi diff --git a/macos.sh b/macos.sh index 5952051..058927f 100755 --- a/macos.sh +++ b/macos.sh @@ -68,6 +68,9 @@ while [ ! $# -eq 0 ]; do skip_library "${SKIP_LIBRARY}" ;; + --no-framework) + NO_FRAMEWORK="1" + ;; --no-output-redirection) no_output_redirection ;; @@ -223,30 +226,39 @@ for run_arch in {0..12}; do fi done -# BUILD FFMPEG-KIT -if [[ -n ${TARGET_ARCH_LIST[0]} ]]; then +echo -e -n "\n" - # INITIALIZE TARGET FOLDERS - initialize_prebuilt_macos_folders +# DO NOT BUILD FRAMEWORKS +if [[ ${NO_FRAMEWORK} -ne 1 ]]; then - # PREPARE PLATFORM ARCHITECTURE STRINGS - build_apple_architecture_variant_strings + # BUILD FFMPEG-KIT + if [[ -n ${TARGET_ARCH_LIST[0]} ]]; then - if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then - echo -e -n "\n\nCreating universal libraries and xcframeworks under prebuilt: " + # INITIALIZE TARGET FOLDERS + initialize_prebuilt_macos_folders - create_universal_libraries_for_macos_xcframeworks + # PREPARE PLATFORM ARCHITECTURE STRINGS + build_apple_architecture_variant_strings - create_frameworks_for_macos_xcframeworks + if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then + echo -e -n "\nCreating universal libraries and xcframeworks under prebuilt: " - create_macos_xcframeworks - else - echo -e -n "\n\nCreating universal libraries and frameworks under prebuilt: " + create_universal_libraries_for_macos_xcframeworks - create_universal_libraries_for_macos_default_frameworks + create_frameworks_for_macos_xcframeworks - create_macos_default_frameworks + create_macos_xcframeworks + else + echo -e -n "\nCreating universal libraries and frameworks under prebuilt: " + + create_universal_libraries_for_macos_default_frameworks + + create_macos_default_frameworks + fi + + echo -e "ok\n" fi - echo -e "ok\n" +else + echo -e "INFO: Skipped creating macOS frameworks.\n" 1>>"${BASEDIR}"/build.log 2>&1 fi diff --git a/scripts/function-android.sh b/scripts/function-android.sh index 9bc0a0f..22312ac 100755 --- a/scripts/function-android.sh +++ b/scripts/function-android.sh @@ -48,7 +48,7 @@ under the prebuilt folder.\n" display_help_common_libraries display_help_gpl_libraries - display_help_advanced_options + display_help_advanced_options " --no-archive\t\t\tdo not build Android archive [no]" } enable_main_build() { diff --git a/scripts/function-ios.sh b/scripts/function-ios.sh index d1b2803..69feb94 100755 --- a/scripts/function-ios.sh +++ b/scripts/function-ios.sh @@ -51,7 +51,11 @@ libraries are created under the prebuilt folder.\n" display_help_common_libraries display_help_gpl_libraries - display_help_advanced_options + if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then + display_help_advanced_options " --no-framework\t\tdo not build xcframework bundles [no]" + else + display_help_advanced_options " --no-framework\t\tdo not build framework bundles and universal libraries [no]" + fi } enable_main_build() { diff --git a/scripts/function-macos.sh b/scripts/function-macos.sh index 0a6d4cf..77f40f5 100755 --- a/scripts/function-macos.sh +++ b/scripts/function-macos.sh @@ -39,7 +39,11 @@ When compilation ends, libraries are created under the prebuilt folder.\n" display_help_common_libraries display_help_gpl_libraries - display_help_advanced_options + if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then + display_help_advanced_options " --no-framework\t\tdo not build xcframework bundles [no]" + else + display_help_advanced_options " --no-framework\t\tdo not build framework bundles and universal libraries [no]" + fi } enable_main_build() { diff --git a/scripts/function-tvos.sh b/scripts/function-tvos.sh index 9430b18..97ef004 100755 --- a/scripts/function-tvos.sh +++ b/scripts/function-tvos.sh @@ -37,7 +37,11 @@ When compilation ends, libraries are created under the prebuilt folder.\n" display_help_common_libraries display_help_gpl_libraries - display_help_advanced_options + if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then + display_help_advanced_options " --no-framework\t\tdo not build xcframework bundles [no]" + else + display_help_advanced_options " --no-framework\t\tdo not build framework bundles and universal libraries [no]" + fi } enable_main_build() { diff --git a/scripts/function.sh b/scripts/function.sh index 501314f..4af7f54 100755 --- a/scripts/function.sh +++ b/scripts/function.sh @@ -595,7 +595,11 @@ display_help_advanced_options() { echo -e "Advanced options:" echo -e " --reconf-LIBRARY\t\trun autoreconf before building LIBRARY [no]" echo -e " --redownload-LIBRARY\t\tdownload LIBRARY even if it is detected as already downloaded [no]" - echo -e " --rebuild-LIBRARY\t\tbuild LIBRARY even if it is detected as already built [no]\n" + echo -e " --rebuild-LIBRARY\t\tbuild LIBRARY even if it is detected as already built [no]" + if [ -n "$1" ]; then + echo -e "$1" + fi + echo -e "" } # diff --git a/tvos.sh b/tvos.sh index 1358f44..7d920ea 100755 --- a/tvos.sh +++ b/tvos.sh @@ -68,6 +68,9 @@ while [ ! $# -eq 0 ]; do skip_library "${SKIP_LIBRARY}" ;; + --no-framework) + NO_FRAMEWORK="1" + ;; --no-output-redirection) no_output_redirection ;; @@ -220,30 +223,38 @@ for run_arch in {0..12}; do fi done -# BUILD FFMPEG-KIT -if [[ -n ${TARGET_ARCH_LIST[0]} ]]; then +echo -e -n "\n" - # INITIALIZE TARGET FOLDERS - initialize_prebuilt_tvos_folders +# DO NOT BUILD FRAMEWORKS +if [[ ${NO_FRAMEWORK} -ne 1 ]]; then - # PREPARE PLATFORM ARCHITECTURE STRINGS - build_apple_architecture_variant_strings + # BUILD FFMPEG-KIT + if [[ -n ${TARGET_ARCH_LIST[0]} ]]; then - if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then - echo -e -n "\n\nCreating universal libraries and xcframeworks under prebuilt: " + # INITIALIZE TARGET FOLDERS + initialize_prebuilt_tvos_folders - create_universal_libraries_for_tvos_xcframeworks + # PREPARE PLATFORM ARCHITECTURE STRINGS + build_apple_architecture_variant_strings - create_frameworks_for_tvos_xcframeworks + if [[ -n ${FFMPEG_KIT_XCF_BUILD} ]]; then + echo -e -n "\nCreating universal libraries and xcframeworks under prebuilt: " - create_tvos_xcframeworks - else - echo -e -n "\n\nCreating universal libraries and frameworks under prebuilt: " + create_universal_libraries_for_tvos_xcframeworks - create_universal_libraries_for_tvos_default_frameworks + create_frameworks_for_tvos_xcframeworks - create_tvos_default_frameworks + create_tvos_xcframeworks + else + echo -e -n "\nCreating universal libraries and frameworks under prebuilt: " + + create_universal_libraries_for_tvos_default_frameworks + + create_tvos_default_frameworks + fi + + echo -e "ok\n" fi - - echo -e "ok\n" +else + echo -e "INFO: Skipped creating tvOS frameworks.\n" 1>>"${BASEDIR}"/build.log 2>&1 fi