diff --git a/apple.sh b/apple.sh new file mode 100755 index 0000000..17d1017 --- /dev/null +++ b/apple.sh @@ -0,0 +1,359 @@ +#!/bin/bash + +enable_default_architecture_variants() { + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_IPHONEOS]=1 + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_IPHONESIMULATOR]=1 + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_MAC_CATALYST]=1 + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_APPLETVOS]=1 + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_APPLETVSIMULATOR]=1 + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_MACOS]=1 +} + +display_help() { + COMMAND=$(echo "$0" | sed -e 's/\.\///g') + + echo -e "\n'$COMMAND' combines FFmpegKit frameworks created for apple architecture variants in an xcframework. \ +It uses frameworks created under the prebuilt folder for iOS, tvOS and macOS architecture variants (iphoneos, \ +iphonesimulator, mac-catalyst, appletvos, appletvsimulator, macosx) as input and builds an umbrella xcframework under \ +the prebuilt folder.\n\n\ +Additional options can be specified to disable architectures or to build xcframeworks for external libraries as well.\ +\n\nPlease note that this script is only responsible of packaging existing frameworks, created by 'ios.sh', 'tvos.sh' \ +and 'macos.sh'. Running it will not compile any of these libraries again. Enabling an external library means building \ +an xcframework for that library. It does not guarantee that ffmpeg has support for it. Top level build scripts \ +('ios.sh', 'tvos.sh', 'macos.sh') must be used to build ffmpeg with support for a specific external library first. \ +After that this script should be used to create an umbrella xcframework.\n" + echo -e "Usage: ./$COMMAND [OPTION]...\n" + echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n" + + echo -e "Options:" + echo -e " -h, --help\t\t\tdisplay this help and exit" + echo -e " -v, --version\t\t\tdisplay version information and exit" + echo -e " -f, --force\t\t\tignore warnings" + echo -e " -l, --lts\t\t\tinclude lts packages to support iOS 9.3+, tvOS 9.2+, macOS 10.11+ devices\n" + + echo -e "Licensing options:" + echo -e " --enable-gpl\t\t\tallow building umbrella xcframeworks for GPL libraries[no]\n" + + echo -e "Architectures:" + echo -e " --disable-iphoneos\t\tdo not include iphoneos architecture variant [yes]" + echo -e " --disable-iphonesimulator\tdo not include iphonesimulator architecture variant [yes]" + echo -e " --disable-mac-catalyst\tdo not include ios mac-catalyst architecture variant [yes]" + echo -e " --disable-appletvos\t\tdo not include appletvos architecture variant [yes]" + echo -e " --disable-appletvsimulator\tdo not include appletvsimulator architecture variant [yes]" + echo -e " --disable-macosx\t\tdo not include macosx architecture variant [yes]\n" + + echo -e "Libraries:" + echo -e " --full\t\t\tbuilds umbrella xcframeworks all non-GPL external libraries" + echo -e " --enable-chromaprint\t\tbuild umbrella xcframework for chromaprint [no]" + echo -e " --enable-fontconfig\t\tbuild umbrella xcframework for fontconfig [no]" + echo -e " --enable-freetype\t\tbuild umbrella xcframework for freetype [no]" + echo -e " --enable-fribidi\t\tbuild umbrella xcframework for fribidi [no]" + echo -e " --enable-gmp\t\t\tbuild umbrella xcframework for gmp [no]" + echo -e " --enable-gnutls\t\tbuild umbrella xcframework for gnutls [no]" + echo -e " --enable-kvazaar\t\tbuild umbrella xcframework for kvazaar [no]" + echo -e " --enable-lame\t\t\tbuild umbrella xcframework for lame [no]" + echo -e " --enable-libaom\t\tbuild umbrella xcframework for libaom [no]" + echo -e " --enable-libass\t\tbuild umbrella xcframework for libass [no]" + echo -e " --enable-libilbc\t\tbuild umbrella xcframework for libilbc [no]" + echo -e " --enable-libtheora\t\tbuild umbrella xcframework for libtheora [no]" + echo -e " --enable-libvorbis\t\tbuild umbrella xcframework for libvorbis [no]" + echo -e " --enable-libvpx\t\tbuild umbrella xcframework for libvpx [no]" + echo -e " --enable-libwebp\t\tbuild umbrella xcframework for libwebp [no]" + echo -e " --enable-libxml2\t\tbuild umbrella xcframework for libxml2 [no]" + echo -e " --enable-opencore-amr\t\tbuild umbrella xcframework for opencore-amr [no]" + echo -e " --enable-openh264\t\tbuild umbrella xcframework for openh264 [no]" + echo -e " --enable-opus\t\t\tbuild umbrella xcframework for opus [no]" + echo -e " --enable-sdl\t\t\tbuild umbrella xcframework for sdl [no]" + echo -e " --enable-shine\t\tbuild umbrella xcframework for shine [no]" + echo -e " --enable-snappy\t\tbuild umbrella xcframework for snappy [no]" + echo -e " --enable-soxr\t\t\tbuild umbrella xcframework for soxr [no]" + echo -e " --enable-speex\t\tbuild umbrella xcframework for speex [no]" + echo -e " --enable-tesseract\t\tbuild umbrella xcframework for tesseract [no]" + echo -e " --enable-twolame\t\tbuild umbrella xcframework for twolame [no]" + echo -e " --enable-vo-amrwbenc\t\tbuild umbrella xcframework for vo-amrwbenc [no]" + echo -e " --enable-wavpack\t\tbuild umbrella xcframework for wavpack [no]\n" + + echo -e "GPL libraries:" + echo -e " --enable-libvidstab\t\tbuild umbrella xcframework for libvidstab [no]" + echo -e " --enable-rubberband\t\tbuild umbrella xcframework for rubber band [no]" + echo -e " --enable-x264\t\t\tbuild umbrella xcframework for x264 [no]" + echo -e " --enable-x265\t\t\tbuild umbrella xcframework for x265 [no]" + echo -e " --enable-xvidcore\t\tbuild umbrella xcframework for xvidcore [no]\n" +} + +initialize_prebuilt_umbrella_xcframework_folders() { + echo -e "DEBUG: Initializing umbrella xcframework directory at ${ROOT_UMBRELLA_XCFRAMEWORK_DIRECTORY}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + mkdir -p "${ROOT_UMBRELLA_XCFRAMEWORK_DIRECTORY}" 1>>"${BASEDIR}"/build.log 2>&1 +} + +# +# 1. framework name +# +create_umbrella_xcframework() { + local FRAMEWORK_NAME="$1" + + local XCFRAMEWORK_PATH="${ROOT_UMBRELLA_XCFRAMEWORK_DIRECTORY}/${FRAMEWORK_NAME}.xcframework" + + initialize_folder "${XCFRAMEWORK_PATH}" + + local BUILD_COMMAND="xcodebuild -create-xcframework " + + for ARCHITECTURE_VARIANT_INDEX in "${TARGET_ARCHITECTURE_VARIANT_INDEX_ARRAY[@]}"; do + local FRAMEWORK_PATH=${BASEDIR}/prebuilt/$(get_framework_directory "${ARCHITECTURE_VARIANT_INDEX}")/${FRAMEWORK_NAME}.framework + BUILD_COMMAND+=" -framework ${FRAMEWORK_PATH}" + done + + BUILD_COMMAND+=" -output ${XCFRAMEWORK_PATH}" + + # EXECUTE CREATE FRAMEWORK COMMAND + COMMAND_OUTPUT=$(${BUILD_COMMAND} 2>&1) + RC=$? + echo -e "DEBUG: ${COMMAND_OUTPUT}\n" 1>>"${BASEDIR}"/build.log 2>&1 + + if [[ ${RC} -ne 0 ]]; then + echo -e "INFO: Building ${FRAMEWORK_NAME} umbrella xcframework failed\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi + + # DO NOT ALLOW EMPTY FRAMEWORKS + if [[ ${COMMAND_OUTPUT} == *"is empty in library"* ]]; then + echo -e "INFO: Building ${FRAMEWORK_NAME} umbrella xcframework failed\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "failed\n\nSee build.log for details\n" + exit 1 + fi +} + +disable_arch_variant() { + case $1 in + iphoneos) + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_IPHONEOS]=0 + ;; + iphonesimulator) + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_IPHONESIMULATOR]=0 + ;; + mac-catalyst) + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_MAC_CATALYST]=0 + ;; + appletvos) + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_APPLETVOS]=0 + ;; + appletvsimulator) + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_APPLETVSIMULATOR]=0 + ;; + macosx) + ENABLED_ARCHITECTURE_VARIANTS[ARCH_VAR_MACOS]=0 + ;; + *) + print_unknown_arch_variant "$1" + ;; + esac +} + +# CHECK IF XCODE IS INSTALLED +if [ ! -x "$(command -v xcrun)" ]; then + echo -e "\n(*) xcrun command not found. Please check your Xcode installation\n" + exit 1 +fi + +if [ ! -x "$(command -v xcodebuild)" ]; then + echo -e "\n(*) xcodebuild command not found. Please check your Xcode installation\n" + exit 1 +fi + +# LOAD INITIAL SETTINGS +export BASEDIR="$(pwd)" +source "${BASEDIR}"/scripts/variable.sh +export FFMPEG_KIT_BUILD_TYPE="apple" +source "${BASEDIR}"/scripts/function-${FFMPEG_KIT_BUILD_TYPE}.sh + +# SET DEFAULTS SETTINGS +enable_default_architecture_variants + +# SELECT XCODE VERSION USED FOR BUILDING +XCODE_FOR_FFMPEG_KIT=$(ls ~/.xcode.for.ffmpeg.kit.sh) +if [[ -f ${XCODE_FOR_FFMPEG_KIT} ]]; then + source "${XCODE_FOR_FFMPEG_KIT}" 1>>"${BASEDIR}"/build.log 2>&1 +fi + +# DETECT SDK VERSIONS +DETECTED_IOS_SDK_VERSION="$(xcrun --sdk iphoneos --show-sdk-version)" +DETECTED_TVOS_SDK_VERSION="$(xcrun --sdk appletvos --show-sdk-version)" +DETECTED_MACOS_SDK_VERSION="$(xcrun --sdk macosx --show-sdk-version)" +echo -e "INFO: Using iOS SDK: ${DETECTED_IOS_SDK_VERSION}, tvOS SDK: ${DETECTED_TVOS_SDK_VERSION}, macOS SDK: ${DETECTED_MACOS_SDK_VERSION} by Xcode provided at $(xcode-select -p)\n" 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "INFO: Build options: $*\n" 1>>"${BASEDIR}"/build.log 2>&1 + +# SET DEFAULT BUILD OPTIONS +GPL_ENABLED="no" +DISPLAY_HELP="" +BUILD_TYPE_ID="" +BUILD_FULL="" +FFMPEG_KIT_XCF_BUILD="" +BUILD_FORCE="" +BUILD_VERSION=$(git describe --tags --always 2>>"${BASEDIR}"/build.log) +if [[ -z ${BUILD_VERSION} ]]; then + echo -e "\n(*): Can not run git commands in this folder. See build.log.\n" + exit 1 +fi + +# PROCESS LTS BUILD OPTION FIRST AND SET BUILD TYPE: MAIN OR LTS +for argument in "$@"; do + if [[ "$argument" == "-l" ]] || [[ "$argument" == "--lts" ]]; then + export FFMPEG_KIT_LTS_BUILD="1" + BUILD_TYPE_ID+="LTS " + fi +done + +# PROCESS BUILD OPTIONS +while [ ! $# -eq 0 ]; do + case $1 in + -h | --help) + DISPLAY_HELP="1" + ;; + -v | --version) + display_version + exit 0 + ;; + -l | --lts) ;; + -f | --force) + export BUILD_FORCE="1" + ;; + --full) + BUILD_FULL="1" + ;; + --enable-gpl) + GPL_ENABLED="yes" + ;; + --enable-*) + ENABLED_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') + + enable_library "${ENABLED_LIBRARY}" + ;; + --disable-*) + DISABLED_ARCH_VARIANT=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') + + disable_arch_variant "${DISABLED_ARCH_VARIANT}" + ;; + *) + print_unknown_option "$1" + ;; + esac + shift +done + +# PROCESS FULL OPTION AS LAST OPTION +if [[ -n ${BUILD_FULL} ]]; then + for library in {0..58}; do + if [ ${GPL_ENABLED} == "yes" ]; then + set_library "$(get_library_name "$library")" 1 + else + if [[ $(is_gpl_licensed "$library") -eq 1 ]]; then + set_library "$(get_library_name "$library")" 1 + fi + fi + done +fi + +# IF HELP DISPLAYED EXIT +if [[ -n ${DISPLAY_HELP} ]]; then + display_help + exit 0 +fi + +echo -e "\nBuilding ffmpeg-kit ${BUILD_TYPE_ID}umbrella xcframework\n" +echo -e -n "INFO: Building ffmpeg-kit ${BUILD_VERSION} ${BUILD_TYPE_ID}umbrella xcframework: " 1>>"${BASEDIR}"/build.log 2>&1 +echo -e "$(date)\n" 1>>"${BASEDIR}"/build.log 2>&1 + +# PRINT BUILD SUMMARY +print_enabled_architecture_variants +print_enabled_xcframeworks + +echo "" + +# VALIDATE GPL FLAGS +for gpl_library in {$LIBRARY_X264,$LIBRARY_XVIDCORE,$LIBRARY_X265,$LIBRARY_LIBVIDSTAB,$LIBRARY_RUBBERBAND}; do + if [[ ${ENABLED_LIBRARIES[$gpl_library]} -eq 1 ]]; then + library_name=$(get_library_name "${gpl_library}") + + if [ ${GPL_ENABLED} != "yes" ]; then + echo -e "\n(*) Invalid configuration detected. GPL library ${library_name} enabled without --enable-gpl flag.\n" + echo -e "\n(*) Invalid configuration detected. GPL library ${library_name} enabled without --enable-gpl flag.\n" 1>>"${BASEDIR}"/build.log 2>&1 + exit 1 + fi + fi +done + +# THIS WILL SAVE ARCHITECTURE VARIANTS TO BE INCLUDED +TARGET_ARCHITECTURE_VARIANT_INDEX_ARRAY=() + +# SAVE ARCHITECTURE VARIANTS +for run_arch_variant in {1..8}; do + if [[ ${ENABLED_ARCHITECTURE_VARIANTS[$run_arch_variant]} -eq 1 ]]; then + case "$run_arch_variant" in + 1 | 5) ;; + *) + TARGET_ARCHITECTURE_VARIANT_INDEX_ARRAY+=("${run_arch_variant}") + ;; + esac + fi +done + +# BUILD XCFRAMEWORKS +if [[ -n ${TARGET_ARCHITECTURE_VARIANT_INDEX_ARRAY[0]} ]]; then + + ROOT_UMBRELLA_XCFRAMEWORK_DIRECTORY=${BASEDIR}/prebuilt/$(get_umbrella_xcframework_directory) + + echo -e -n "Creating umbrella xcframeworks under prebuilt: " + + # INITIALIZE TARGET FOLDERS + initialize_prebuilt_umbrella_xcframework_folders + + # BUILD XCFRAMEWORKS FOR ENABLED LIBRARIES ON ENABLED ARCHITECTURE VARIANTS + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[${library}]} -eq 1 ]]; then + + if [[ ${LIBRARY_LIBTHEORA} == "${library}" ]]; then + + create_umbrella_xcframework "libtheora" + create_umbrella_xcframework "libtheoraenc" + create_umbrella_xcframework "libtheoradec" + + elif [[ ${LIBRARY_LIBVORBIS} == "${library}" ]]; then + + create_umbrella_xcframework "libvorbisfile" + create_umbrella_xcframework "libvorbisenc" + create_umbrella_xcframework "libvorbis" + + elif [[ ${LIBRARY_LIBWEBP} == "${library}" ]]; then + + create_umbrella_xcframework "libwebpmux" + create_umbrella_xcframework "libwebpdemux" + create_umbrella_xcframework "libwebp" + + elif [[ ${LIBRARY_OPENCOREAMR} == "${library}" ]]; then + + create_umbrella_xcframework "libopencore-amrnb" + + elif [[ ${LIBRARY_NETTLE} == "${library}" ]]; then + + create_umbrella_xcframework "libnettle" + create_umbrella_xcframework "libhogweed" + + else + + create_umbrella_xcframework "$(get_static_archive_name "${library}")" + + fi + fi + done + + for FFMPEG_LIB in "${FFMPEG_LIBS[@]}"; do + create_umbrella_xcframework "${FFMPEG_LIB}" + done + + create_umbrella_xcframework "ffmpegkit" + + echo -e -n "INFO: Umbrella xcframeworks created successfully\n\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "ok\n" +fi diff --git a/ios.sh b/ios.sh index ce6b443..5866841 100755 --- a/ios.sh +++ b/ios.sh @@ -6,6 +6,11 @@ if [ ! -x "$(command -v xcrun)" ]; then exit 1 fi +if [ ! -x "$(command -v xcodebuild)" ]; then + echo -e "\n(*) xcodebuild command not found. Please check your Xcode installation\n" + exit 1 +fi + # LOAD INITIAL SETTINGS export BASEDIR="$(pwd)" export FFMPEG_KIT_BUILD_TYPE="ios" diff --git a/macos.sh b/macos.sh index 94583c1..5952051 100755 --- a/macos.sh +++ b/macos.sh @@ -6,6 +6,11 @@ if [ ! -x "$(command -v xcrun)" ]; then exit 1 fi +if [ ! -x "$(command -v xcodebuild)" ]; then + echo -e "\n(*) xcodebuild command not found. Please check your Xcode installation\n" + exit 1 +fi + # LOAD INITIAL SETTINGS export BASEDIR="$(pwd)" export FFMPEG_KIT_BUILD_TYPE="macos" diff --git a/scripts/function-apple.sh b/scripts/function-apple.sh index 16b2833..0fdcfd3 100644 --- a/scripts/function-apple.sh +++ b/scripts/function-apple.sh @@ -122,14 +122,14 @@ disable_macos_architecture_not_supported_on_detected_sdk_version() { } build_apple_architecture_variant_strings() { - export ALL_IOS_ARCHITECTURES="$(get_apple_architectures_for_variant 1)" - export IPHONEOS_ARCHITECTURES="$(get_apple_architectures_for_variant 2)" - export IPHONE_SIMULATOR_ARCHITECTURES="$(get_apple_architectures_for_variant 3)" - export MAC_CATALYST_ARCHITECTURES="$(get_apple_architectures_for_variant 4)" - export ALL_TVOS_ARCHITECTURES="$(get_apple_architectures_for_variant 5)" - export APPLETVOS_ARCHITECTURES="$(get_apple_architectures_for_variant 6)" - export APPLETV_SIMULATOR_ARCHITECTURES="$(get_apple_architectures_for_variant 7)" - export MACOSX_ARCHITECTURES="$(get_apple_architectures_for_variant 8)" + export ALL_IOS_ARCHITECTURES="$(get_apple_architectures_for_variant "${ARCH_VAR_IOS}")" + export IPHONEOS_ARCHITECTURES="$(get_apple_architectures_for_variant "${ARCH_VAR_IPHONEOS}")" + export IPHONE_SIMULATOR_ARCHITECTURES="$(get_apple_architectures_for_variant "${ARCH_VAR_IPHONESIMULATOR}")" + export MAC_CATALYST_ARCHITECTURES="$(get_apple_architectures_for_variant "${ARCH_VAR_MAC_CATALYST}")" + export ALL_TVOS_ARCHITECTURES="$(get_apple_architectures_for_variant ARCH_VAR_TVOS)" + export APPLETVOS_ARCHITECTURES="$(get_apple_architectures_for_variant "${ARCH_VAR_APPLETVOS}")" + export APPLETV_SIMULATOR_ARCHITECTURES="$(get_apple_architectures_for_variant "${ARCH_VAR_APPLETVSIMULATOR}")" + export MACOSX_ARCHITECTURES="$(get_apple_architectures_for_variant "${ARCH_VAR_MACOS}")" } # @@ -774,28 +774,28 @@ get_framework_directory() { fi case $FRAMEWORK_TYPE in - 1) + "${ARCH_VAR_IOS}") echo "bundle-apple-framework-ios${LTS_POSTFIX}" ;; - 2) + "${ARCH_VAR_IPHONEOS}") echo "bundle-apple-framework-iphoneos${LTS_POSTFIX}" ;; - 3) + "${ARCH_VAR_IPHONESIMULATOR}") echo "bundle-apple-framework-iphonesimulator${LTS_POSTFIX}" ;; - 4) + "${ARCH_VAR_MAC_CATALYST}") echo "bundle-apple-framework-mac-catalyst${LTS_POSTFIX}" ;; - 5) + ARCH_VAR_TVOS) echo "bundle-apple-framework-tvos${LTS_POSTFIX}" ;; - 6) + "${ARCH_VAR_APPLETVOS}") echo "bundle-apple-framework-appletvos${LTS_POSTFIX}" ;; - 7) + "${ARCH_VAR_APPLETVSIMULATOR}") echo "bundle-apple-framework-appletvsimulator${LTS_POSTFIX}" ;; - 8) + "${ARCH_VAR_MACOS}") echo "bundle-apple-framework-macos${LTS_POSTFIX}" ;; esac @@ -810,6 +810,15 @@ get_xcframework_directory() { echo "bundle-apple-xcframework-${FFMPEG_KIT_BUILD_TYPE}${LTS_POSTFIX}" } +get_umbrella_xcframework_directory() { + local LTS_POSTFIX="" + if [[ -n ${FFMPEG_KIT_LTS_BUILD} ]]; then + LTS_POSTFIX="-lts" + fi + + echo "bundle-apple-xcframework${LTS_POSTFIX}" +} + # # 1. architecture variant # @@ -821,28 +830,28 @@ get_universal_library_directory() { fi case ${ARCHITECTURE_VARIANT} in - 1) + "${ARCH_VAR_IOS}") echo "bundle-apple-universal-ios${LTS_POSTFIX}" ;; - 2) + "${ARCH_VAR_IPHONEOS}") echo "bundle-apple-universal-iphoneos${LTS_POSTFIX}" ;; - 3) + "${ARCH_VAR_IPHONESIMULATOR}") echo "bundle-apple-universal-iphonesimulator${LTS_POSTFIX}" ;; - 4) + "${ARCH_VAR_MAC_CATALYST}") echo "bundle-apple-universal-mac-catalyst${LTS_POSTFIX}" ;; - 5) + "${ARCH_VAR_APPLETVOS}") echo "bundle-apple-universal-tvos${LTS_POSTFIX}" ;; - 6) + "${ARCH_VAR_APPLETVOS}") echo "bundle-apple-universal-appletvos${LTS_POSTFIX}" ;; - 7) + "${ARCH_VAR_APPLETVSIMULATOR}") echo "bundle-apple-universal-appletvsimulator${LTS_POSTFIX}" ;; - 8) + "${ARCH_VAR_MACOS}") echo "bundle-apple-universal-macos${LTS_POSTFIX}" ;; esac @@ -859,29 +868,29 @@ get_apple_architecture_variant() { fi case ${ARCHITECTURE_VARIANT} in - 2) + "${ARCH_VAR_IOS}") + echo "ios${LTS_POSTFIX}" + ;; + "${ARCH_VAR_IPHONEOS}") echo "iphoneos${LTS_POSTFIX}" ;; - 3) + "${ARCH_VAR_IPHONESIMULATOR}") echo "iphonesimulator${LTS_POSTFIX}" ;; - 4) + "${ARCH_VAR_MAC_CATALYST}") echo "mac-catalyst${LTS_POSTFIX}" ;; - 5) + ARCH_VAR_TVOS) echo "tvos${LTS_POSTFIX}" ;; - 6) + "${ARCH_VAR_APPLETVOS}") echo "appletvos${LTS_POSTFIX}" ;; - 7) + "${ARCH_VAR_APPLETVSIMULATOR}") echo "appletvsimulator${LTS_POSTFIX}" ;; - 8) - echo "macosx${LTS_POSTFIX}" - ;; - *) - echo "ios${LTS_POSTFIX}" + "${ARCH_VAR_MACOS}") + echo "macos${LTS_POSTFIX}" ;; esac } @@ -895,43 +904,43 @@ get_apple_architectures_for_variant() { local ARCHITECTURES="" case ${ARCHITECTURE_VARIANT} in - 2) - for index in 2 3 5 6; do + "${ARCH_VAR_IOS}") + for index in ${ARCH_ARMV7} ${ARCH_ARMV7S} ${ARCH_ARM64} ${ARCH_ARM64E} ${ARCH_I386} ${ARCH_X86_64} ${ARCH_X86_64_MAC_CATALYST} ${ARCH_ARM64_MAC_CATALYST} ${ARCH_ARM64_SIMULATOR}; do ARCHITECTURES+=" $(get_full_arch_name "${index}") " done ;; - 3) - for index in 7 9 12; do + "${ARCH_VAR_IPHONEOS}") + for index in ${ARCH_ARMV7} ${ARCH_ARMV7S} ${ARCH_ARM64} ${ARCH_ARM64E}; do ARCHITECTURES+=" $(get_full_arch_name "${index}") " done ;; - 4) - for index in 10 11; do + "${ARCH_VAR_IPHONESIMULATOR}") + for index in ${ARCH_I386} ${ARCH_X86_64} ${ARCH_ARM64_SIMULATOR}; do ARCHITECTURES+=" $(get_full_arch_name "${index}") " done ;; - 5) - for index in 5 9; do + "${ARCH_VAR_MAC_CATALYST}") + for index in ${ARCH_X86_64_MAC_CATALYST} ${ARCH_ARM64_MAC_CATALYST}; do ARCHITECTURES+=" $(get_full_arch_name "${index}") " done ;; - 6) - for index in 5; do + ARCH_VAR_TVOS) + for index in ${ARCH_ARM64} ${ARCH_X86_64}; do ARCHITECTURES+=" $(get_full_arch_name "${index}") " done ;; - 7) - for index in 9; do + "${ARCH_VAR_APPLETVOS}") + for index in ${ARCH_ARM64}; do ARCHITECTURES+=" $(get_full_arch_name "${index}") " done ;; - 8) - for index in 5 9; do + "${ARCH_VAR_APPLETVSIMULATOR}") + for index in ${ARCH_X86_64}; do ARCHITECTURES+=" $(get_full_arch_name "${index}") " done ;; - *) - for index in 2 3 5 6 7 9 10 11 12; do + "${ARCH_VAR_MACOS}") + for index in ${ARCH_ARM64} ${ARCH_X86_64}; do ARCHITECTURES+=" $(get_full_arch_name "${index}") " done ;; diff --git a/scripts/function-ios.sh b/scripts/function-ios.sh index bd37395..7482305 100755 --- a/scripts/function-ios.sh +++ b/scripts/function-ios.sh @@ -460,17 +460,17 @@ initialize_prebuilt_ios_folders() { echo -e "DEBUG: Initializing universal directories and frameworks for xcf builds\n" 1>>"${BASEDIR}"/build.log 2>&1 - if [[ $(is_apple_architecture_variant_supported 2) -eq 1 ]]; then - mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 2)" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 2)" 1>>"${BASEDIR}"/build.log 2>&1 + if [[ $(is_apple_architecture_variant_supported "${ARCH_VAR_IPHONEOS}") -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_IPHONEOS}")" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_IPHONEOS}")" 1>>"${BASEDIR}"/build.log 2>&1 fi - if [[ $(is_apple_architecture_variant_supported 3) -eq 1 ]]; then - mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 3)" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 3)" 1>>"${BASEDIR}"/build.log 2>&1 + if [[ $(is_apple_architecture_variant_supported "${ARCH_VAR_IPHONESIMULATOR}") -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_IPHONESIMULATOR}")" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_IPHONESIMULATOR}")" 1>>"${BASEDIR}"/build.log 2>&1 fi - if [[ $(is_apple_architecture_variant_supported 4) -eq 1 ]]; then - mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 4)" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 4)" 1>>"${BASEDIR}"/build.log 2>&1 + if [[ $(is_apple_architecture_variant_supported "${ARCH_VAR_MAC_CATALYST}") -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_MAC_CATALYST}")" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_MAC_CATALYST}")" 1>>"${BASEDIR}"/build.log 2>&1 fi echo -e "DEBUG: Initializing xcframework directory at ${BASEDIR}/prebuilt/$(get_xcframework_directory)\n" 1>>"${BASEDIR}"/build.log 2>&1 @@ -479,14 +479,14 @@ initialize_prebuilt_ios_folders() { mkdir -p "${BASEDIR}/prebuilt/$(get_xcframework_directory)" 1>>"${BASEDIR}"/build.log 2>&1 else - echo -e "DEBUG: Initializing default universal directory at ${BASEDIR}/prebuilt/$(get_universal_library_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "DEBUG: Initializing default universal directory at ${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_IOS}")\n" 1>>"${BASEDIR}"/build.log 2>&1 # DEFAULT BUILDS GENERATE UNIVERSAL LIBRARIES AND FRAMEWORKS - mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 1)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_IOS}")" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "DEBUG: Initializing framework directory at ${BASEDIR}/prebuilt/$(get_framework_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "DEBUG: Initializing framework directory at ${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_IOS}")\n" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 1)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_IOS}")" 1>>"${BASEDIR}"/build.log 2>&1 fi } @@ -500,13 +500,13 @@ create_universal_libraries_for_ios_default_frameworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_universal_library "${library}" 1 + create_universal_library "${library}" "${ARCH_VAR_IOS}" fi done - create_ffmpeg_universal_library 1 + create_ffmpeg_universal_library "${ARCH_VAR_IOS}" - create_ffmpeg_kit_universal_library 1 + create_ffmpeg_kit_universal_library "${ARCH_VAR_IOS}" echo -e "INFO: Universal libraries for default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } @@ -516,13 +516,13 @@ create_ios_default_frameworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_framework "${library}" 1 + create_framework "${library}" "${ARCH_VAR_IOS}" fi done - create_ffmpeg_framework 1 + create_ffmpeg_framework "${ARCH_VAR_IOS}" - create_ffmpeg_kit_framework 1 + create_ffmpeg_kit_framework "${ARCH_VAR_IOS}" echo -e "INFO: Default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } @@ -532,19 +532,19 @@ create_universal_libraries_for_ios_xcframeworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_universal_library "${library}" 2 - create_universal_library "${library}" 3 - create_universal_library "${library}" 4 + create_universal_library "${library}" "${ARCH_VAR_IPHONEOS}" + create_universal_library "${library}" "${ARCH_VAR_IPHONESIMULATOR}" + create_universal_library "${library}" "${ARCH_VAR_MAC_CATALYST}" fi done - create_ffmpeg_universal_library 2 - create_ffmpeg_universal_library 3 - create_ffmpeg_universal_library 4 + create_ffmpeg_universal_library "${ARCH_VAR_IPHONEOS}" + create_ffmpeg_universal_library "${ARCH_VAR_IPHONESIMULATOR}" + create_ffmpeg_universal_library "${ARCH_VAR_MAC_CATALYST}" - create_ffmpeg_kit_universal_library 2 - create_ffmpeg_kit_universal_library 3 - create_ffmpeg_kit_universal_library 4 + create_ffmpeg_kit_universal_library "${ARCH_VAR_IPHONEOS}" + create_ffmpeg_kit_universal_library "${ARCH_VAR_IPHONESIMULATOR}" + create_ffmpeg_kit_universal_library "${ARCH_VAR_MAC_CATALYST}" echo -e "INFO: Universal libraries for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } @@ -554,25 +554,25 @@ create_frameworks_for_ios_xcframeworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_framework "${library}" 2 - create_framework "${library}" 3 - create_framework "${library}" 4 + create_framework "${library}" "${ARCH_VAR_IPHONEOS}" + create_framework "${library}" "${ARCH_VAR_IPHONESIMULATOR}" + create_framework "${library}" "${ARCH_VAR_MAC_CATALYST}" fi done - create_ffmpeg_framework 2 - create_ffmpeg_framework 3 - create_ffmpeg_framework 4 + create_ffmpeg_framework "${ARCH_VAR_IPHONEOS}" + create_ffmpeg_framework "${ARCH_VAR_IPHONESIMULATOR}" + create_ffmpeg_framework "${ARCH_VAR_MAC_CATALYST}" - create_ffmpeg_kit_framework 2 - create_ffmpeg_kit_framework 3 - create_ffmpeg_kit_framework 4 + create_ffmpeg_kit_framework "${ARCH_VAR_IPHONEOS}" + create_ffmpeg_kit_framework "${ARCH_VAR_IPHONESIMULATOR}" + create_ffmpeg_kit_framework "${ARCH_VAR_MAC_CATALYST}" echo -e "INFO: Frameworks for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } create_ios_xcframeworks() { - export ARCHITECTURE_VARIANT_ARRAY=(2 3 4) + export ARCHITECTURE_VARIANT_ARRAY=("${ARCH_VAR_IPHONEOS}" "${ARCH_VAR_IPHONESIMULATOR}" "${ARCH_VAR_MAC_CATALYST}") echo -e "INFO: Building xcframeworks\n" 1>>"${BASEDIR}"/build.log 2>&1 for library in {0..46}; do diff --git a/scripts/function-macos.sh b/scripts/function-macos.sh index afd68be..031d473 100755 --- a/scripts/function-macos.sh +++ b/scripts/function-macos.sh @@ -372,9 +372,9 @@ initialize_prebuilt_macos_folders() { echo -e "DEBUG: Initializing universal directories and frameworks for xcf builds\n" 1>>"${BASEDIR}"/build.log 2>&1 - if [[ $(is_apple_architecture_variant_supported 8) -eq 1 ]]; then - mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 8)" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 8)" 1>>"${BASEDIR}"/build.log 2>&1 + if [[ $(is_apple_architecture_variant_supported "${ARCH_VAR_MACOS}") -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_MACOS}")" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_MACOS}")" 1>>"${BASEDIR}"/build.log 2>&1 fi echo -e "DEBUG: Initializing xcframework directory at ${BASEDIR}/prebuilt/$(get_xcframework_directory)\n" 1>>"${BASEDIR}"/build.log 2>&1 @@ -383,14 +383,14 @@ initialize_prebuilt_macos_folders() { mkdir -p "${BASEDIR}/prebuilt/$(get_xcframework_directory)" 1>>"${BASEDIR}"/build.log 2>&1 else - echo -e "DEBUG: Initializing default universal directory at ${BASEDIR}/prebuilt/$(get_universal_library_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "DEBUG: Initializing default universal directory at ${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_MACOS}")\n" 1>>"${BASEDIR}"/build.log 2>&1 # DEFAULT BUILDS GENERATE UNIVERSAL LIBRARIES AND FRAMEWORKS - mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 8)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_MACOS}")" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "DEBUG: Initializing framework directory at ${BASEDIR}/prebuilt/$(get_framework_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "DEBUG: Initializing framework directory at ${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_MACOS}")\n" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 8)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_MACOS}")" 1>>"${BASEDIR}"/build.log 2>&1 fi } @@ -404,13 +404,13 @@ create_universal_libraries_for_macos_default_frameworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_universal_library "${library}" 8 + create_universal_library "${library}" "${ARCH_VAR_MACOS}" fi done - create_ffmpeg_universal_library 8 + create_ffmpeg_universal_library "${ARCH_VAR_MACOS}" - create_ffmpeg_kit_universal_library 8 + create_ffmpeg_kit_universal_library "${ARCH_VAR_MACOS}" echo -e "INFO: Universal libraries for default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } @@ -420,13 +420,13 @@ create_macos_default_frameworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_framework "${library}" 8 + create_framework "${library}" "${ARCH_VAR_MACOS}" fi done - create_ffmpeg_framework 8 + create_ffmpeg_framework "${ARCH_VAR_MACOS}" - create_ffmpeg_kit_framework 8 + create_ffmpeg_kit_framework "${ARCH_VAR_MACOS}" echo -e "INFO: Default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } @@ -436,13 +436,13 @@ create_universal_libraries_for_macos_xcframeworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_universal_library "${library}" 8 + create_universal_library "${library}" "${ARCH_VAR_MACOS}" fi done - create_ffmpeg_universal_library 8 + create_ffmpeg_universal_library "${ARCH_VAR_MACOS}" - create_ffmpeg_kit_universal_library 8 + create_ffmpeg_kit_universal_library "${ARCH_VAR_MACOS}" echo -e "INFO: Universal libraries for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } @@ -452,19 +452,19 @@ create_frameworks_for_macos_xcframeworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_framework "${library}" 8 + create_framework "${library}" "${ARCH_VAR_MACOS}" fi done - create_ffmpeg_framework 8 + create_ffmpeg_framework "${ARCH_VAR_MACOS}" - create_ffmpeg_kit_framework 8 + create_ffmpeg_kit_framework "${ARCH_VAR_MACOS}" echo -e "INFO: Frameworks for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } create_macos_xcframeworks() { - export ARCHITECTURE_VARIANT_ARRAY=(8) + export ARCHITECTURE_VARIANT_ARRAY=("${ARCH_VAR_MACOS}") echo -e "INFO: Building xcframeworks\n" 1>>"${BASEDIR}"/build.log 2>&1 for library in {0..46}; do diff --git a/scripts/function-tvos.sh b/scripts/function-tvos.sh index f99bf79..53134ab 100755 --- a/scripts/function-tvos.sh +++ b/scripts/function-tvos.sh @@ -417,13 +417,13 @@ initialize_prebuilt_tvos_folders() { echo -e "DEBUG: Initializing universal directories and frameworks for xcf builds\n" 1>>"${BASEDIR}"/build.log 2>&1 - if [[ $(is_apple_architecture_variant_supported 6) -eq 1 ]]; then - mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 6)" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 6)" 1>>"${BASEDIR}"/build.log 2>&1 + if [[ $(is_apple_architecture_variant_supported "${ARCH_VAR_APPLETVOS}") -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_APPLETVOS}")" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_APPLETVOS}")" 1>>"${BASEDIR}"/build.log 2>&1 fi - if [[ $(is_apple_architecture_variant_supported 7) -eq 1 ]]; then - mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 7)" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 7)" 1>>"${BASEDIR}"/build.log 2>&1 + if [[ $(is_apple_architecture_variant_supported "${ARCH_VAR_APPLETVSIMULATOR}") -eq 1 ]]; then + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_APPLETVSIMULATOR}")" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_APPLETVSIMULATOR}")" 1>>"${BASEDIR}"/build.log 2>&1 fi echo -e "DEBUG: Initializing xcframework directory at ${BASEDIR}/prebuilt/$(get_xcframework_directory)\n" 1>>"${BASEDIR}"/build.log 2>&1 @@ -432,14 +432,14 @@ initialize_prebuilt_tvos_folders() { mkdir -p "${BASEDIR}/prebuilt/$(get_xcframework_directory)" 1>>"${BASEDIR}"/build.log 2>&1 else - echo -e "DEBUG: Initializing default universal directory at ${BASEDIR}/prebuilt/$(get_universal_library_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "DEBUG: Initializing default universal directory at ${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_TVOS}")\n" 1>>"${BASEDIR}"/build.log 2>&1 # DEFAULT BUILDS GENERATE UNIVERSAL LIBRARIES AND FRAMEWORKS - mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory 5)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_TVOS}")" 1>>"${BASEDIR}"/build.log 2>&1 - echo -e "DEBUG: Initializing framework directory at ${BASEDIR}/prebuilt/$(get_framework_directory 1)\n" 1>>"${BASEDIR}"/build.log 2>&1 + echo -e "DEBUG: Initializing framework directory at ${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_TVOS}")\n" 1>>"${BASEDIR}"/build.log 2>&1 - mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory 5)" 1>>"${BASEDIR}"/build.log 2>&1 + mkdir -p "${BASEDIR}/prebuilt/$(get_framework_directory "${ARCH_VAR_TVOS}")" 1>>"${BASEDIR}"/build.log 2>&1 fi } @@ -447,19 +447,19 @@ initialize_prebuilt_tvos_folders() { # DEPENDS TARGET_ARCH_LIST VARIABLE # create_universal_libraries_for_tvos_default_frameworks() { - local ROOT_UNIVERSAL_DIRECTORY_PATH="${BASEDIR}/prebuilt/$(get_universal_library_directory 1)" + local ROOT_UNIVERSAL_DIRECTORY_PATH="${BASEDIR}/prebuilt/$(get_universal_library_directory "${ARCH_VAR_TVOS}")" echo -e "INFO: Building universal libraries in ${ROOT_UNIVERSAL_DIRECTORY_PATH} for default frameworks using ${TARGET_ARCH_LIST[@]}\n" 1>>"${BASEDIR}"/build.log 2>&1 for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_universal_library "${library}" 5 + create_universal_library "${library}" "${ARCH_VAR_TVOS}" fi done - create_ffmpeg_universal_library 5 + create_ffmpeg_universal_library "${ARCH_VAR_TVOS}" - create_ffmpeg_kit_universal_library 5 + create_ffmpeg_kit_universal_library "${ARCH_VAR_TVOS}" echo -e "INFO: Universal libraries for default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } @@ -469,13 +469,13 @@ create_tvos_default_frameworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_framework "${library}" 5 + create_framework "${library}" "${ARCH_VAR_TVOS}" fi done - create_ffmpeg_framework 5 + create_ffmpeg_framework "${ARCH_VAR_TVOS}" - create_ffmpeg_kit_framework 5 + create_ffmpeg_kit_framework "${ARCH_VAR_TVOS}" echo -e "INFO: Default frameworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } @@ -485,16 +485,16 @@ create_universal_libraries_for_tvos_xcframeworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_universal_library "${library}" 6 - create_universal_library "${library}" 7 + create_universal_library "${library}" "${ARCH_VAR_APPLETVOS}" + create_universal_library "${library}" "${ARCH_VAR_APPLETVSIMULATOR}" fi done - create_ffmpeg_universal_library 6 - create_ffmpeg_universal_library 7 + create_ffmpeg_universal_library "${ARCH_VAR_APPLETVOS}" + create_ffmpeg_universal_library "${ARCH_VAR_APPLETVSIMULATOR}" - create_ffmpeg_kit_universal_library 6 - create_ffmpeg_kit_universal_library 7 + create_ffmpeg_kit_universal_library "${ARCH_VAR_APPLETVOS}" + create_ffmpeg_kit_universal_library "${ARCH_VAR_APPLETVSIMULATOR}" echo -e "INFO: Universal libraries for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } @@ -504,22 +504,22 @@ create_frameworks_for_tvos_xcframeworks() { for library in {0..46}; do if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then - create_framework "${library}" 6 - create_framework "${library}" 7 + create_framework "${library}" "${ARCH_VAR_APPLETVOS}" + create_framework "${library}" "${ARCH_VAR_APPLETVSIMULATOR}" fi done - create_ffmpeg_framework 6 - create_ffmpeg_framework 7 + create_ffmpeg_framework "${ARCH_VAR_APPLETVOS}" + create_ffmpeg_framework "${ARCH_VAR_APPLETVSIMULATOR}" - create_ffmpeg_kit_framework 6 - create_ffmpeg_kit_framework 7 + create_ffmpeg_kit_framework "${ARCH_VAR_APPLETVOS}" + create_ffmpeg_kit_framework "${ARCH_VAR_APPLETVSIMULATOR}" echo -e "INFO: Frameworks for xcframeworks built successfully\n" 1>>"${BASEDIR}"/build.log 2>&1 } create_tvos_xcframeworks() { - export ARCHITECTURE_VARIANT_ARRAY=(6 7) + export ARCHITECTURE_VARIANT_ARRAY=("${ARCH_VAR_APPLETVOS}" "${ARCH_VAR_APPLETVSIMULATOR}") echo -e "INFO: Building xcframeworks\n" 1>>"${BASEDIR}"/build.log 2>&1 for library in {0..46}; do diff --git a/scripts/function.sh b/scripts/function.sh index 2ca5004..501314f 100755 --- a/scripts/function.sh +++ b/scripts/function.sh @@ -291,7 +291,7 @@ is_library_supported_on_platform() { # IOS, MACOS AND TVOS 49 | 50 | 51 | 54 | 55) - if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then echo "0" else echo "1" @@ -342,7 +342,7 @@ is_arch_supported_on_platform() { # IOS, MACOS OR TVOS $ARCH_ARM64) - if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]]; then echo 1 else echo 0 @@ -505,12 +505,17 @@ print_unknown_arch() { exit 1 } +print_unknown_arch_variant() { + echo -e "\n(*) Unknown architecture variant \"$1\".\n\nSee $0 --help for available architecture variants.\n" + exit 1 +} + display_version() { COMMAND=$(echo "$0" | sed -e 's/\.\///g') echo -e "\ -$COMMAND v$(get_ffmpeg_kit_version)\n -Copyright (c) 2018-2021 Taner Sener\n +$COMMAND v$(get_ffmpeg_kit_version) +Copyright (c) 2018-2021 Taner Sener\n\ License LGPLv3.0: GNU LGPL version 3 or later\n\ \n\ This is free software: you can redistribute it and/or modify it under the terms of the \ @@ -536,7 +541,7 @@ display_help_options() { display_help_licensing() { echo -e "Licensing options:" - echo -e " --enable-gpl\t\t\tallow use of GPL libraries, created libs will be licensed under GPLv3.0 [no]\n" + echo -e " --enable-gpl\t\t\tallow building GPL libraries, created libs will be licensed under the GPLv3.0 [no]\n" } display_help_common_libraries() { @@ -552,7 +557,7 @@ display_help_common_libraries() { echo -e " --enable-libass\t\tbuild with libass [no]" case ${FFMPEG_KIT_BUILD_TYPE} in - ios | tvos | macos) + android) echo -e " --enable-libiconv\t\tbuild with libiconv [no]" ;; esac @@ -909,21 +914,21 @@ set_library() { set_virtual_library() { case $1 in libiconv) - if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "apple" ]]; then ENABLED_LIBRARIES[LIBRARY_APPLE_LIBICONV]=$2 else ENABLED_LIBRARIES[LIBRARY_LIBICONV]=$2 fi ;; libuuid) - if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "apple" ]]; then ENABLED_LIBRARIES[LIBRARY_APPLE_LIBUUID]=$2 else ENABLED_LIBRARIES[LIBRARY_LIBUUID]=$2 fi ;; zlib) - if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]]; then + if [[ ${FFMPEG_KIT_BUILD_TYPE} == "ios" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "tvos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "macos" ]] || [[ ${FFMPEG_KIT_BUILD_TYPE} == "apple" ]]; then ENABLED_LIBRARIES[LIBRARY_APPLE_ZLIB]=$2 else ENABLED_LIBRARIES[LIBRARY_ANDROID_ZLIB]=$2 @@ -1095,7 +1100,28 @@ print_enabled_architectures() { if [[ ${enabled} -ge 1 ]]; then echo -n ", " fi - echo -n $(get_arch_name $print_arch) + echo -n "$(get_arch_name "${print_arch}")" + enabled=$((${enabled} + 1)) + fi + done + + if [ ${enabled} -gt 0 ]; then + echo "" + else + echo "none" + fi +} + +print_enabled_architecture_variants() { + echo -n "Architecture variants: " + + let enabled=0 + for print_arch_var in {1..8}; do + if [[ ${ENABLED_ARCHITECTURE_VARIANTS[$print_arch_var]} -eq 1 ]]; then + if [[ ${enabled} -ge 1 ]]; then + echo -n ", " + fi + echo -n "$(get_apple_architecture_variant "${print_arch_var}")" enabled=$((${enabled} + 1)) fi done @@ -1118,7 +1144,7 @@ print_enabled_libraries() { if [[ ${enabled} -ge 1 ]]; then echo -n ", " fi - echo -n $(get_library_name $library) + echo -n "$(get_library_name "${library}")" enabled=$((${enabled} + 1)) fi done @@ -1130,6 +1156,33 @@ print_enabled_libraries() { fi } +print_enabled_xcframeworks() { + echo -n "xcframeworks: " + + let enabled=0 + + # SUPPLEMENTARY LIBRARIES NOT PRINTED + for library in {0..46}; do + if [[ ${ENABLED_LIBRARIES[$library]} -eq 1 ]]; then + if [[ ${enabled} -ge 1 ]]; then + echo -n ", " + fi + echo -n "$(get_library_name "${library}")" + enabled=$((${enabled} + 1)) + fi + done + + if [[ ${enabled} -ge 1 ]]; then + echo -n ", " + fi + + for FFMPEG_LIB in "${FFMPEG_LIBS[@]}"; do + echo -n "${FFMPEG_LIB}, " + done + + echo "ffmpeg-kit" +} + print_reconfigure_requested_libraries() { local counter=0 diff --git a/scripts/variable.sh b/scripts/variable.sh index 9d21684..b40d8b0 100755 --- a/scripts/variable.sh +++ b/scripts/variable.sh @@ -6,6 +6,9 @@ export FFMPEG_KIT_TMPDIR="${BASEDIR}/.tmp" # ARRAY OF ENABLED ARCHITECTURES ENABLED_ARCHITECTURES=(0 0 0 0 0 0 0 0 0 0 0 0 0) +# ARRAY OF ENABLED ARCHITECTURE VARIANTS +ENABLED_ARCHITECTURE_VARIANTS=(0 0 0 0 0 0 0 0) + # ARRAY OF ENABLED LIBRARIES ENABLED_LIBRARIES=(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0) @@ -33,6 +36,16 @@ ARCH_X86_64_MAC_CATALYST=10 # ios ARCH_ARM64_MAC_CATALYST=11 # ios ARCH_ARM64_SIMULATOR=12 # ios +# ARCH VARIANT INDEXES +ARCH_VAR_IOS=1 # ios +ARCH_VAR_IPHONEOS=2 # ios +ARCH_VAR_IPHONESIMULATOR=3 # ios +ARCH_VAR_MAC_CATALYST=4 # ios +ARCH_VAR_TVOS=5 # tvos +ARCH_VAR_APPLETVOS=6 # tvos +ARCH_VAR_APPLETVSIMULATOR=7 # tvos +ARCH_VAR_MACOS=8 # macos + # LIBRARY INDEXES LIBRARY_FONTCONFIG=0 LIBRARY_FREETYPE=1 diff --git a/tvos.sh b/tvos.sh index b856399..1358f44 100755 --- a/tvos.sh +++ b/tvos.sh @@ -6,6 +6,11 @@ if [ ! -x "$(command -v xcrun)" ]; then exit 1 fi +if [ ! -x "$(command -v xcodebuild)" ]; then + echo -e "\n(*) xcodebuild command not found. Please check your Xcode installation\n" + exit 1 +fi + # LOAD INITIAL SETTINGS export BASEDIR="$(pwd)" export FFMPEG_KIT_BUILD_TYPE="tvos"