use min deployment target to auto-disable not-supported architectures

This commit is contained in:
Taner Sener 2021-10-31 21:50:08 +00:00
parent 2afdbd88af
commit 431e95fd73
8 changed files with 40 additions and 41 deletions

10
ios.sh
View File

@ -160,13 +160,9 @@ if [[ -n ${DISPLAY_HELP} ]]; then
fi
# DISABLE NOT SUPPORTED ARCHITECTURES
disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARMV7}" "${DETECTED_IOS_SDK_VERSION}"
disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARMV7S}" "${DETECTED_IOS_SDK_VERSION}"
disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_I386}" "${DETECTED_IOS_SDK_VERSION}"
disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARM64E}" "${DETECTED_IOS_SDK_VERSION}"
disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_X86_64_MAC_CATALYST}" "${DETECTED_IOS_SDK_VERSION}"
disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARM64_MAC_CATALYST}" "${DETECTED_IOS_SDK_VERSION}"
disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARM64_SIMULATOR}" "${DETECTED_IOS_SDK_VERSION}"
disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARMV7}"
disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_ARMV7S}"
disable_ios_architecture_not_supported_on_detected_sdk_version "${ARCH_I386}"
# CHECK SOME RULES FOR .framework BUNDLES

View File

@ -154,9 +154,6 @@ if [[ -n ${DISPLAY_HELP} ]]; then
exit 0
fi
# DISABLE NOT SUPPORTED ARCHITECTURES
disable_macos_architecture_not_supported_on_detected_sdk_version "${ARCH_ARM64}" "${DETECTED_MACOS_SDK_VERSION}"
echo -e "\nBuilding ffmpeg-kit ${BUILD_TYPE_ID}shared library for macOS\n"
echo -e -n "INFO: Building ffmpeg-kit ${BUILD_VERSION} ${BUILD_TYPE_ID}for macOS: " 1>>"${BASEDIR}"/build.log 2>&1
echo -e "$(date)\n" 1>>"${BASEDIR}"/build.log 2>&1

View File

@ -22,7 +22,6 @@ get_external_library_version() {
#
# 1. architecture index
# 2. detected sdk version
#
disable_ios_architecture_not_supported_on_detected_sdk_version() {
local ARCH_NAME=$(get_arch_name $1)
@ -31,7 +30,7 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
armv7 | armv7s | i386)
# SUPPORTED UNTIL IOS SDK 10.3.1
if [[ $(compare_versions "$2" "10.3.1") -le 0 ]]; then
if [[ $(compare_versions "$IOS_MIN_VERSION" "10.3.1") -le 0 ]]; then
local SUPPORTED=1
else
local SUPPORTED=0
@ -40,7 +39,7 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
arm64e)
# INTRODUCED IN IOS SDK 10.1
if [[ $(compare_versions "$2" "10.1") -ge 1 ]]; then
if [[ $(compare_versions "$IOS_MIN_VERSION" "10.1") -ge 1 ]]; then
local SUPPORTED=1
else
local SUPPORTED=0
@ -49,16 +48,25 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
x86-64-mac-catalyst)
# INTRODUCED IN IOS SDK 13.0
if [[ $(compare_versions "$2" "13") -ge 1 ]]; then
if [[ $(compare_versions "$MAC_CATALYST_MIN_VERSION" "13.0") -ge 1 ]]; then
local SUPPORTED=1
else
local SUPPORTED=0
fi
;;
arm64-*)
arm64-mac-catalyst)
# INTRODUCED IN IOS SDK 14.0
if [[ $(compare_versions "$2" "14") -ge 1 ]]; then
if [[ $(compare_versions "$MAC_CATALYST_MIN_VERSION" "14.0") -ge 1 ]]; then
local SUPPORTED=1
else
local SUPPORTED=0
fi
;;
arm64-simulator)
# INTRODUCED IN IOS SDK 14.0
if [[ $(compare_versions "$IOS_MIN_VERSION" "14.0") -ge 1 ]]; then
local SUPPORTED=1
else
local SUPPORTED=0
@ -71,7 +79,7 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
if [[ ${SUPPORTED} -ne 1 ]]; then
if [[ -z ${BUILD_FORCE} ]]; then
echo -e "INFO: Disabled ${ARCH_NAME} architecture which is not supported on SDK $2\n" 1>>"${BASEDIR}"/build.log 2>&1
echo -e "INFO: Disabled ${ARCH_NAME} architecture which is not supported on iOS SDK $IOS_MIN_VERSION and Mac Catalyst $MAC_CATALYST_MIN_VERSION\n" 1>>"${BASEDIR}"/build.log 2>&1
disable_arch "${ARCH_NAME}"
fi
fi
@ -79,7 +87,6 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
#
# 1. architecture index
# 2. detected sdk version
#
disable_tvos_architecture_not_supported_on_detected_sdk_version() {
local ARCH_NAME=$(get_arch_name $1)
@ -88,7 +95,7 @@ disable_tvos_architecture_not_supported_on_detected_sdk_version() {
arm64-simulator)
# INTRODUCED IN TVOS SDK 14.0
if [[ $(compare_versions "$2" "14") -ge 1 ]]; then
if [[ $(compare_versions "$TVOS_MIN_VERSION" "14.0") -ge 1 ]]; then
local SUPPORTED=1
else
local SUPPORTED=0
@ -101,7 +108,7 @@ disable_tvos_architecture_not_supported_on_detected_sdk_version() {
if [[ ${SUPPORTED} -ne 1 ]]; then
if [[ -z ${BUILD_FORCE} ]]; then
echo -e "INFO: Disabled ${ARCH_NAME} architecture which is not supported on SDK $2\n" 1>>"${BASEDIR}"/build.log 2>&1
echo -e "INFO: Disabled ${ARCH_NAME} architecture which is not supported on tvOS SDK $TVOS_MIN_VERSION\n" 1>>"${BASEDIR}"/build.log 2>&1
disable_arch "${ARCH_NAME}"
fi
fi
@ -109,7 +116,6 @@ disable_tvos_architecture_not_supported_on_detected_sdk_version() {
#
# 1. architecture index
# 2. detected sdk version
#
disable_macos_architecture_not_supported_on_detected_sdk_version() {
local ARCH_NAME=$(get_arch_name $1)
@ -118,7 +124,7 @@ disable_macos_architecture_not_supported_on_detected_sdk_version() {
arm64)
# INTRODUCED IN MACOS SDK 11.0
if [[ $(compare_versions "$2" "11") -ge 1 ]]; then
if [[ $(compare_versions "$MACOS_MIN_VERSION" "11.0") -ge 1 ]]; then
local SUPPORTED=1
else
local SUPPORTED=0
@ -131,7 +137,7 @@ disable_macos_architecture_not_supported_on_detected_sdk_version() {
if [[ ${SUPPORTED} -ne 1 ]]; then
if [[ -z ${BUILD_FORCE} ]]; then
echo -e "INFO: Disabled ${ARCH_NAME} architecture which is not supported on SDK $2\n" 1>>"${BASEDIR}"/build.log 2>&1
echo -e "INFO: Disabled ${ARCH_NAME} architecture which is not supported on macOS SDK $MACOS_MIN_VERSION\n" 1>>"${BASEDIR}"/build.log 2>&1
disable_arch "${ARCH_NAME}"
fi
fi

View File

@ -25,7 +25,7 @@ libraries are created under the prebuilt folder.\n"
echo -e "Usage: ./$COMMAND [OPTION]...\n"
echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n"
display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles and universal libraries" " -l, --lts build lts packages to support sdk 9.3+ devices" " --target=ios sdk version\t\t\toverride minimum deployment target" " --mac-catalyst-target=ios sdk version\toverride minimum deployment target for mac catalyst"
display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles and universal libraries" " -l, --lts build lts packages to support sdk 9.3+ devices" " --target=ios sdk version\t\t\toverride minimum deployment target [12.1]" " --mac-catalyst-target=ios sdk version\toverride minimum deployment target for mac catalyst [14.0]"
display_help_licensing
echo -e "Architectures:"

View File

@ -17,7 +17,7 @@ When compilation ends, libraries are created under the prebuilt folder.\n"
echo -e "Usage: ./$COMMAND [OPTION]...\n"
echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n"
display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles and universal libraries" " -l, --lts build lts packages to support sdk 10.11+ devices" " --target=macos sdk version\toverride minimum deployment target"
display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles and universal libraries" " -l, --lts build lts packages to support sdk 10.11+ devices" " --target=macos sdk version\toverride minimum deployment target [10.15]"
display_help_licensing
echo -e "Architectures:"

View File

@ -18,7 +18,7 @@ set explicitly. When compilation ends, libraries are created under the prebuilt
echo -e "Usage: ./$COMMAND [OPTION]...\n"
echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n"
display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles and universal libraries" " -l, --lts build lts packages to support sdk 9.2+ devices" " --target=tvos sdk version\toverride minimum deployment target"
display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles and universal libraries" " -l, --lts build lts packages to support sdk 9.2+ devices" " --target=tvos sdk version\toverride minimum deployment target [11.0]"
display_help_licensing
echo -e "Architectures:"

View File

@ -1981,23 +1981,26 @@ compare_versions() {
for((i=0;(i<${#VERSION_PARTS_1[@]})&&(i<${#VERSION_PARTS_2[@]});i++))
do
if [[ ${VERSION_PARTS_1[$i]} -gt ${VERSION_PARTS_2[$i]} ]]; then
local CURRENT_PART_1=${VERSION_PARTS_1[$i]}
local CURRENT_PART_2=${VERSION_PARTS_2[$i]}
if [[ -z ${CURRENT_PART_1} ]]; then
CURRENT_PART_1=0
fi
if [[ -z ${CURRENT_PART_2} ]]; then
CURRENT_PART_2=0
fi
if [[ CURRENT_PART_1 -gt CURRENT_PART_2 ]]; then
echo "1"
return;
elif [[ ${VERSION_PARTS_1[$i]} -lt ${VERSION_PARTS_2[$i]} ]]; then
elif [[ CURRENT_PART_1 -lt CURRENT_PART_2 ]]; then
echo "-1"
return;
fi
done
if [[ ${#VERSION_PARTS_1[@]} -gt ${#VERSION_PARTS_2[@]} ]]; then
echo "1"
return;
elif [[ ${#VERSION_PARTS_1[@]} -lt ${#VERSION_PARTS_2[@]} ]]; then
echo "-1"
return;
else
echo "0"
return;
fi
}

View File

@ -154,9 +154,6 @@ if [[ -n ${DISPLAY_HELP} ]]; then
exit 0
fi
# DISABLE NOT SUPPORTED ARCHITECTURES
disable_tvos_architecture_not_supported_on_detected_sdk_version "${ARCH_ARM64_SIMULATOR}" "${DETECTED_TVOS_SDK_VERSION}"
# CHECK SOME RULES FOR .framework BUNDLES
# 1. DISABLE arm64-simulator WHEN arm64 IS ENABLED IN framework BUNDLES