diff --git a/android.sh b/android.sh index 9eff915..07a6671 100755 --- a/android.sh +++ b/android.sh @@ -86,6 +86,10 @@ while [ ! $# -eq 0 ]; do -f | --force) export BUILD_FORCE="1" ;; + --jobs=*) + JOB_COUNT=$(echo $1 | sed -e 's/^--[A-Za-z]*=//g') + export BUILD_JOBS="${JOB_COUNT}" + ;; --reconf-*) CONF_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') diff --git a/ios.sh b/ios.sh index 0a77724..04264eb 100755 --- a/ios.sh +++ b/ios.sh @@ -28,8 +28,9 @@ if [[ -f ${XCODE_FOR_FFMPEG_KIT} ]]; then fi # DETECT IOS SDK VERSION -export DETECTED_IOS_SDK_VERSION="$(xcrun --sdk iphoneos --show-sdk-version 2>>${BASEDIR}/build.log)" -echo -e "\nINFO: Using SDK ${DETECTED_IOS_SDK_VERSION} by Xcode provided at $(xcode-select -p)\n" 1>>"${BASEDIR}"/build.log 2>&1 +export DETECTED_IOS_SDK_VERSION="$(xcrun --sdk iphoneos --show-sdk-version 2>>"${BASEDIR}"/build.log)" +XCODE_PATH=$(xcode-select -p 2>>"${BASEDIR}"/build.log) +echo -e "\nINFO: Using SDK ${DETECTED_IOS_SDK_VERSION} by Xcode provided at ${XCODE_PATH}\n" 1>>"${BASEDIR}"/build.log 2>&1 echo -e "INFO: Build options: $*\n" 1>>"${BASEDIR}"/build.log 2>&1 # SET DEFAULT BUILD OPTIONS @@ -98,6 +99,10 @@ while [ ! $# -eq 0 ]; do -f | --force) export BUILD_FORCE="1" ;; + --jobs=*) + JOB_COUNT=$(echo $1 | sed -e 's/^--[A-Za-z]*=//g') + export BUILD_JOBS="${JOB_COUNT}" + ;; --reconf-*) CONF_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') @@ -185,7 +190,7 @@ if [[ -n ${BUILD_FULL} ]]; then fi # DISABLE SPECIFIED LIBRARIES -for disabled_library in ${disabled_libraries[@]}; do +for disabled_library in "${disabled_libraries[@]}"; do set_library "${disabled_library}" 0 done diff --git a/linux.sh b/linux.sh index b5e77da..6fbb3ed 100755 --- a/linux.sh +++ b/linux.sh @@ -59,6 +59,10 @@ while [ ! $# -eq 0 ]; do -f | --force) export BUILD_FORCE="1" ;; + --jobs=*) + JOB_COUNT=$(echo $1 | sed -e 's/^--[A-Za-z]*=//g') + export BUILD_JOBS="${JOB_COUNT}" + ;; --reconf-*) CONF_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') diff --git a/macos.sh b/macos.sh index abff479..9c94ce3 100755 --- a/macos.sh +++ b/macos.sh @@ -28,8 +28,9 @@ if [[ -f ${XCODE_FOR_FFMPEG_KIT} ]]; then fi # DETECT MACOS SDK VERSION -export DETECTED_MACOS_SDK_VERSION="$(xcrun --sdk macosx --show-sdk-version 2>>${BASEDIR}/build.log)" -echo -e "\nINFO: Using SDK ${DETECTED_MACOS_SDK_VERSION} by Xcode provided at $(xcode-select -p)\n" 1>>"${BASEDIR}"/build.log 2>&1 +export DETECTED_MACOS_SDK_VERSION="$(xcrun --sdk macosx --show-sdk-version 2>>"${BASEDIR}"/build.log)" +XCODE_PATH=$(xcode-select -p 2>>"${BASEDIR}"/build.log) +echo -e "\nINFO: Using SDK ${DETECTED_MACOS_SDK_VERSION} by Xcode provided at ${XCODE_PATH}\n" 1>>"${BASEDIR}"/build.log 2>&1 echo -e "\nINFO: Build options: $*\n" 1>>"${BASEDIR}"/build.log 2>&1 # SET DEFAULT BUILD OPTIONS @@ -95,6 +96,10 @@ while [ ! $# -eq 0 ]; do -f | --force) export BUILD_FORCE="1" ;; + --jobs=*) + JOB_COUNT=$(echo $1 | sed -e 's/^--[A-Za-z]*=//g') + export BUILD_JOBS="${JOB_COUNT}" + ;; --reconf-*) CONF_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g') diff --git a/scripts/function-android.sh b/scripts/function-android.sh index 1505ee7..f93aca6 100755 --- a/scripts/function-android.sh +++ b/scripts/function-android.sh @@ -33,7 +33,7 @@ under the prebuilt folder.\n" echo -e "Usage: ./$COMMAND [OPTION]... [VAR=VALUE]...\n" echo -e "Specify environment variables as VARIABLE=VALUE to override default build options.\n" - display_help_options " -l, --lts\t\t\tbuild lts packages to support API 16+ devices\n --api-level=api\t\toverride Android api level\n --toolchain=path\t\toverride the default (llvm) toolchain path\n --no-ffmpeg-kit-protocols\tdisable custom ffmpeg-kit protocols (saf)" + display_help_options " -l, --lts\t\t\tbuild lts packages to support API 16+ devices\n --jobs=N\t\t\tnumber of jobs to run [auto]\n --api-level=api\t\toverride Android api level [24]\n --toolchain=path\t\toverride the default (llvm) toolchain path\n --no-ffmpeg-kit-protocols\tdisable custom ffmpeg-kit protocols (saf) [no]" display_help_licensing echo -e "Architectures:" diff --git a/scripts/function-ios.sh b/scripts/function-ios.sh index ed7b58f..89c98c5 100755 --- a/scripts/function-ios.sh +++ b/scripts/function-ios.sh @@ -27,7 +27,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" " -l, --lts build lts packages to support sdk 10+ 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_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles" " -l, --lts build lts packages to support sdk 10+ devices\n --jobs=N\t\t\t\t\tnumber of jobs to run [auto]" " --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:" diff --git a/scripts/function-linux.sh b/scripts/function-linux.sh index bf4b451..1b9989c 100755 --- a/scripts/function-linux.sh +++ b/scripts/function-linux.sh @@ -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 " -l, --lts\t\t\tbuild lts packages to support older devices" + display_help_options " -l, --lts\t\t\tbuild lts packages to support older devices\n --jobs=N\t\t\tnumber of jobs to run [auto]" display_help_licensing echo -e "Architectures:" diff --git a/scripts/function-macos.sh b/scripts/function-macos.sh index 60eb51d..3eea70e 100755 --- a/scripts/function-macos.sh +++ b/scripts/function-macos.sh @@ -19,7 +19,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" " -l, --lts build lts packages to support sdk 10.12+ devices" " --target=macos sdk version\toverride minimum deployment target [10.15]" + display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles" " -l, --lts build lts packages to support sdk 10.12+ devices\n --jobs=N\t\t\t\tnumber of jobs to run [auto]" " --target=macos sdk version\toverride minimum deployment target [10.15]" display_help_licensing echo -e "Architectures:" diff --git a/scripts/function-tvos.sh b/scripts/function-tvos.sh index 12b27a2..2ef0741 100755 --- a/scripts/function-tvos.sh +++ b/scripts/function-tvos.sh @@ -20,7 +20,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" " -l, --lts build lts packages to support sdk 10.0+ devices" " --target=tvos sdk version\toverride minimum deployment target [11.0]" + display_help_options " -x, --xcframework\t\tbuild xcframework bundles instead of framework bundles" " -l, --lts build lts packages to support sdk 10.0+ devices\n --jobs=N\t\t\tnumber of jobs to run [auto]" " --target=tvos sdk version\toverride minimum deployment target [11.0]" display_help_licensing echo -e "Architectures:" diff --git a/scripts/function.sh b/scripts/function.sh index 06e3565..df29d50 100755 --- a/scripts/function.sh +++ b/scripts/function.sh @@ -2235,7 +2235,9 @@ is_gnu_config_files_up_to_date() { } get_cpu_count() { - if [ "$(uname)" == "Darwin" ]; then + if [ -n "${BUILD_JOBS}" ]; then + echo "${BUILD_JOBS}" + elif [ "$(uname)" == "Darwin" ]; then echo $(sysctl -n hw.logicalcpu) else echo $(nproc) diff --git a/tvos.sh b/tvos.sh index b0dc5ce..6221dac 100755 --- a/tvos.sh +++ b/tvos.sh @@ -28,8 +28,9 @@ if [[ -f ${XCODE_FOR_FFMPEG_KIT} ]]; then fi # DETECT TVOS SDK VERSION -export DETECTED_TVOS_SDK_VERSION="$(xcrun --sdk appletvos --show-sdk-version 2>>${BASEDIR}/build.log)" -echo -e "\nINFO: Using SDK ${DETECTED_TVOS_SDK_VERSION} by Xcode provided at $(xcode-select -p)\n" 1>>"${BASEDIR}"/build.log 2>&1 +export DETECTED_TVOS_SDK_VERSION="$(xcrun --sdk appletvos --show-sdk-version 2>>"${BASEDIR}"/build.log)" +XCODE_PATH=$(xcode-select -p 2>>"${BASEDIR}"/build.log) +echo -e "\nINFO: Using SDK ${DETECTED_TVOS_SDK_VERSION} by Xcode provided at ${XCODE_PATH}\n" 1>>"${BASEDIR}"/build.log 2>&1 echo -e "\nINFO: Build options: $*\n" 1>>"${BASEDIR}"/build.log 2>&1 # SET DEFAULT BUILD OPTIONS @@ -98,6 +99,10 @@ while [ ! $# -eq 0 ]; do -f | --force) export BUILD_FORCE="1" ;; + --jobs=*) + JOB_COUNT=$(echo $1 | sed -e 's/^--[A-Za-z]*=//g') + export BUILD_JOBS="${JOB_COUNT}" + ;; --reconf-*) CONF_LIBRARY=$(echo $1 | sed -e 's/^--[A-Za-z]*-//g')