allow overriding sdk version while building apple platforms, improves #168

This commit is contained in:
Taner Sener 2021-10-09 15:14:44 +01:00
parent d0ddcaf4df
commit 72e8fa4612
14 changed files with 146 additions and 28 deletions

View File

@ -3,8 +3,29 @@ name: ios build scripts
on: [ push, pull_request ] on: [ push, pull_request ]
jobs: jobs:
build-main-on-macos: build-main-on-macos-bigsur:
name: ios main name: ios main on big sur
runs-on: macos-11
strategy:
matrix:
xcode: [ '12.5.1', '13.0' ]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- name: set up xcode
run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh
- name: run the build script
run: ./ios.sh --xcframework --enable-ios-audiotoolbox --enable-ios-avfoundation --enable-ios-bzip2 --enable-ios-libiconv --enable-ios-videotoolbox --enable-ios-zlib
- name: print build logs
if: ${{ always() }}
run: cat build.log
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-main-on-macos-catalina:
name: ios main on catalina
runs-on: macos-10.15 runs-on: macos-10.15
strategy: strategy:
matrix: matrix:

View File

@ -3,8 +3,29 @@ name: macos build scripts
on: [ push, pull_request ] on: [ push, pull_request ]
jobs: jobs:
build-main-on-macos: build-main-on-macos-bigsur:
name: macos main name: macos main on big sur
runs-on: macos-11
strategy:
matrix:
xcode: [ '12.5.1', '13.0' ]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- name: set up xcode
run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh
- name: run the build script
run: ./macos.sh --xcframework --enable-macos-audiotoolbox --enable-macos-avfoundation --enable-macos-bzip2 --enable-macos-coreimage --enable-macos-libiconv --enable-macos-opencl --enable-macos-opengl --enable-macos-videotoolbox --enable-macos-zlib
- name: print build logs
if: ${{ always() }}
run: cat build.log
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-main-on-macos-catalina:
name: macos main on catalina
runs-on: macos-10.15 runs-on: macos-10.15
strategy: strategy:
matrix: matrix:

View File

@ -3,8 +3,29 @@ name: tvos build scripts
on: [ push, pull_request ] on: [ push, pull_request ]
jobs: jobs:
build-main-on-macos: build-main-on-macos-bigsur:
name: tvos main name: tvos main on big sur
runs-on: macos-11
strategy:
matrix:
xcode: [ '12.5.1', '13.0' ]
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v2
- name: set up xcode
run: echo "export DEVELOPER_DIR=/Applications/Xcode_${{ matrix.xcode }}.app/Contents/Developer" > ~/.xcode.for.ffmpeg.kit.sh
- name: run the build script
run: ./tvos.sh --xcframework --enable-tvos-bzip2 --enable-tvos-audiotoolbox --enable-tvos-libiconv --enable-tvos-videotoolbox --enable-tvos-zlib
- name: print build logs
if: ${{ always() }}
run: cat build.log
- name: print ffbuild logs
if: ${{ failure() }}
run: '[[ -f ./src/ffmpeg/ffbuild/config.log ]] && tail -50 ./src/ffmpeg/ffbuild/config.log'
build-main-on-macos-catalina:
name: tvos main on catalina
runs-on: macos-10.15 runs-on: macos-10.15
strategy: strategy:
matrix: matrix:

10
ios.sh
View File

@ -123,6 +123,16 @@ while [ ! $# -eq 0 ]; do
disable_arch "${DISABLED_ARCH}" disable_arch "${DISABLED_ARCH}"
;; ;;
--target=*)
TARGET=$(echo $1 | sed -e 's/^--[A-Za-z]*=//g')
export IOS_MIN_VERSION=${TARGET}
;;
--mac-catalyst-target=*)
TARGET=$(echo $1 | sed -e 's/^--[A-Za-z]*-[A-Za-z]*-[A-Za-z]*=//g')
export MAC_CATALYST_MIN_VERSION=${TARGET}
;;
*) *)
print_unknown_option "$1" print_unknown_option "$1"
;; ;;

View File

@ -123,6 +123,11 @@ while [ ! $# -eq 0 ]; do
disable_arch "${DISABLED_ARCH}" disable_arch "${DISABLED_ARCH}"
;; ;;
--target=*)
TARGET=$(echo $1 | sed -e 's/^--[A-Za-z]*=//g')
export MACOS_MIN_VERSION=${TARGET}
;;
*) *)
print_unknown_option "$1" print_unknown_option "$1"
;; ;;

View File

@ -31,16 +31,16 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
armv7 | armv7s | i386) armv7 | armv7s | i386)
# SUPPORTED UNTIL IOS SDK 10.3.1 # SUPPORTED UNTIL IOS SDK 10.3.1
if [[ $(echo "$2 > 10.4" | bc) -eq 1 ]]; then if [[ $(compare_versions "$2" "10.3.1") -le 0 ]]; then
local SUPPORTED=0
else
local SUPPORTED=1 local SUPPORTED=1
else
local SUPPORTED=0
fi fi
;; ;;
arm64e) arm64e)
# INTRODUCED IN IOS SDK 10.1 # INTRODUCED IN IOS SDK 10.1
if [[ $(echo "$2 > 10" | bc) -eq 1 ]]; then if [[ $(compare_versions "$2" "10.1") -ge 1 ]]; then
local SUPPORTED=1 local SUPPORTED=1
else else
local SUPPORTED=0 local SUPPORTED=0
@ -48,8 +48,8 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
;; ;;
x86-64-mac-catalyst) x86-64-mac-catalyst)
# INTRODUCED IN IOS SDK 13 # INTRODUCED IN IOS SDK 13.0
if [[ $(echo "$2 > 12.4" | bc) -eq 1 ]]; then if [[ $(compare_versions "$2" "13") -ge 1 ]]; then
local SUPPORTED=1 local SUPPORTED=1
else else
local SUPPORTED=0 local SUPPORTED=0
@ -57,8 +57,8 @@ disable_ios_architecture_not_supported_on_detected_sdk_version() {
;; ;;
arm64-*) arm64-*)
# INTRODUCED IN IOS SDK 14 # INTRODUCED IN IOS SDK 14.0
if [[ $(echo "$2 > 13.7" | bc) -eq 1 ]]; then if [[ $(compare_versions "$2" "14") -ge 1 ]]; then
local SUPPORTED=1 local SUPPORTED=1
else else
local SUPPORTED=0 local SUPPORTED=0
@ -87,8 +87,8 @@ disable_tvos_architecture_not_supported_on_detected_sdk_version() {
case ${ARCH_NAME} in case ${ARCH_NAME} in
arm64-simulator) arm64-simulator)
# INTRODUCED IN TVOS SDK 14 # INTRODUCED IN TVOS SDK 14.0
if [[ $(echo "$2 > 13.4" | bc) -eq 1 ]]; then if [[ $(compare_versions "$2" "14") -ge 1 ]]; then
local SUPPORTED=1 local SUPPORTED=1
else else
local SUPPORTED=0 local SUPPORTED=0
@ -117,8 +117,8 @@ disable_macos_architecture_not_supported_on_detected_sdk_version() {
case ${ARCH_NAME} in case ${ARCH_NAME} in
arm64) arm64)
# INTRODUCED IN MACOS SDK 11 # INTRODUCED IN MACOS SDK 11.0
if [[ $(echo "$2 > 10.16" | bc) -eq 1 ]]; then if [[ $(compare_versions "$2" "11") -ge 1 ]]; then
local SUPPORTED=1 local SUPPORTED=1
else else
local SUPPORTED=0 local SUPPORTED=0
@ -1235,7 +1235,7 @@ get_min_version_cflags() {
get_min_sdk_version() { get_min_sdk_version() {
case ${ARCH} in case ${ARCH} in
*-mac-catalyst) *-mac-catalyst)
echo "13.0" echo "${MAC_CATALYST_MIN_VERSION}"
;; ;;
*) *)
case ${FFMPEG_KIT_BUILD_TYPE} in case ${FFMPEG_KIT_BUILD_TYPE} in

View File

@ -25,7 +25,7 @@ libraries are created under the prebuilt folder.\n"
echo -e "Usage: ./$COMMAND [OPTION]...\n" echo -e "Usage: ./$COMMAND [OPTION]...\n"
echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\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" 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_licensing display_help_licensing
echo -e "Architectures:" echo -e "Architectures:"
@ -60,6 +60,7 @@ libraries are created under the prebuilt folder.\n"
enable_main_build() { enable_main_build() {
export IOS_MIN_VERSION=12.1 export IOS_MIN_VERSION=12.1
export MAC_CATALYST_MIN_VERSION=14.0
} }
enable_lts_build() { enable_lts_build() {
@ -68,6 +69,9 @@ enable_lts_build() {
# XCODE 7.3 HAS IOS SDK 9.3 # XCODE 7.3 HAS IOS SDK 9.3
export IOS_MIN_VERSION=9.3 export IOS_MIN_VERSION=9.3
# MAC CATALYST IS INTRODUCED IN 13.0
export MAC_CATALYST_MIN_VERSION=13.0
# IOS SDK 9.3 SUPPORTS VIDEOTOOLBOX # IOS SDK 9.3 SUPPORTS VIDEOTOOLBOX
# HOWEVER, THE LATEST FFMPEG VERSION USES SDK 11.0 APIS # HOWEVER, THE LATEST FFMPEG VERSION USES SDK 11.0 APIS
# THEREFORE, VIDEOTOOLBOX IS DISABLED IN LTS RELEASES # THEREFORE, VIDEOTOOLBOX IS DISABLED IN LTS RELEASES

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 "Usage: ./$COMMAND [OPTION]...\n"
echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\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" 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_licensing display_help_licensing
echo -e "Architectures:" 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 "Usage: ./$COMMAND [OPTION]...\n"
echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\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" 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_licensing display_help_licensing
echo -e "Architectures:" echo -e "Architectures:"

View File

@ -587,6 +587,9 @@ display_help_options() {
if [ -n "$3" ]; then if [ -n "$3" ]; then
echo -e "$3" echo -e "$3"
fi fi
if [ -n "$4" ]; then
echo -e "$4"
fi
echo -e "" echo -e ""
} }
@ -1814,3 +1817,31 @@ create_file() {
rm -f "$1" rm -f "$1"
echo "" > "$1" 1>>"${BASEDIR}"/build.log 2>&1 echo "" > "$1" 1>>"${BASEDIR}"/build.log 2>&1
} }
compare_versions() {
VERSION_PARTS_1=($(echo $1 | tr "." " "))
VERSION_PARTS_2=($(echo $2 | tr "." " "))
for((i=0;(i<${#VERSION_PARTS_1[@]})&&(i<${#VERSION_PARTS_2[@]});i++))
do
if [[ ${VERSION_PARTS_1[$i]} -gt ${VERSION_PARTS_2[$i]} ]]; then
echo "1"
return;
elif [[ ${VERSION_PARTS_1[$i]} -lt ${VERSION_PARTS_2[$i]} ]]; 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

@ -23,8 +23,8 @@ fi
# ENABLE COMMON FUNCTIONS # ENABLE COMMON FUNCTIONS
source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1
echo -e "\nBuilding ${ARCH} platform\n" echo -e "\nBuilding ${ARCH} platform targeting iOS SDK ${IOS_MIN_VERSION} and Mac Catalyst ${MAC_CATALYST_MIN_VERSION}\n"
echo -e "\nINFO: Starting new build for ${ARCH} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1 echo -e "\nINFO: Starting new build for ${ARCH} targeting iOS SDK ${IOS_MIN_VERSION} and Mac Catalyst ${MAC_CATALYST_MIN_VERSION} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1
# SET BASE INSTALLATION DIRECTORY FOR THIS ARCHITECTURE # SET BASE INSTALLATION DIRECTORY FOR THIS ARCHITECTURE
export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)" export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)"

View File

@ -23,8 +23,8 @@ fi
# ENABLE COMMON FUNCTIONS # ENABLE COMMON FUNCTIONS
source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1
echo -e "\nBuilding ${ARCH} platform\n" echo -e "\nBuilding ${ARCH} platform targeting macOS SDK ${MACOS_MIN_VERSION}\n"
echo -e "\nINFO: Starting new build for ${ARCH} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1 echo -e "\nINFO: Starting new build for ${ARCH} targeting macOS SDK ${MACOS_MIN_VERSION} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1
# SET BASE INSTALLATION DIRECTORY FOR THIS ARCHITECTURE # SET BASE INSTALLATION DIRECTORY FOR THIS ARCHITECTURE
export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)" export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)"

View File

@ -23,8 +23,8 @@ fi
# ENABLE COMMON FUNCTIONS # ENABLE COMMON FUNCTIONS
source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1 source "${BASEDIR}"/scripts/function-"${FFMPEG_KIT_BUILD_TYPE}".sh 1>>"${BASEDIR}"/build.log 2>&1 || exit 1
echo -e "\nBuilding ${ARCH} platform\n" echo -e "\nBuilding ${ARCH} platform targeting tvOS SDK ${TVOS_MIN_VERSION}\n"
echo -e "\nINFO: Starting new build for ${ARCH} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1 echo -e "\nINFO: Starting new build for ${ARCH} targeting tvOS SDK ${TVOS_MIN_VERSION} at $(date)\n" 1>>"${BASEDIR}"/build.log 2>&1
# SET BASE INSTALLATION DIRECTORY FOR THIS ARCHITECTURE # SET BASE INSTALLATION DIRECTORY FOR THIS ARCHITECTURE
export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)" export LIB_INSTALL_BASE="${BASEDIR}/prebuilt/$(get_build_directory)"

View File

@ -123,6 +123,11 @@ while [ ! $# -eq 0 ]; do
disable_arch "${DISABLED_ARCH}" disable_arch "${DISABLED_ARCH}"
;; ;;
--target=*)
TARGET=$(echo $1 | sed -e 's/^--[A-Za-z]*=//g')
export TVOS_MIN_VERSION=${TARGET}
;;
*) *)
print_unknown_option "$1" print_unknown_option "$1"
;; ;;