From 13b8e9fe160a50dfe38361413ba1a7a154ce18cb Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 29 Dec 2020 10:52:10 -0800 Subject: [PATCH] {ios,xcframework}build.sh: make min version(s) more visible add IOS_MIN_VERSION, MACOSX_MIN_VERSION and MACOSX_CATALYST_MIN_VERSION to allow control of the minimum versions supported based on the deployment target; based on feedback from: e8e8db98 add xcframeworkbuild.sh https://github.com/webmproject/libwebp/commit/e8e8db985a1cfa550a41f9a92f2d204da967297a Change-Id: I9fbca072bf00c4cb8e59143371a2d3522d22808b --- iosbuild.sh | 5 ++++- xcframeworkbuild.sh | 13 +++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/iosbuild.sh b/iosbuild.sh index 044745f0..7c5e691b 100755 --- a/iosbuild.sh +++ b/iosbuild.sh @@ -13,6 +13,9 @@ set -e +# Set this variable based on the desired minimum deployment target. +readonly IOS_MIN_VERSION=6.0 + # Extract the latest SDK version from the final field of the form: iphoneosX.Y readonly SDK=$(xcodebuild -showsdks \ | grep iphoneos | sort | tail -n 1 | awk '{print substr($NF, 9)}' @@ -118,7 +121,7 @@ for PLATFORM in ${PLATFORMS}; do SDKROOT="${PLATFORMSROOT}/" SDKROOT+="${PLATFORM}.platform/Developer/SDKs/${PLATFORM}${SDK}.sdk/" CFLAGS="-arch ${ARCH2:-${ARCH}} -pipe -isysroot ${SDKROOT} -O3 -DNDEBUG" - CFLAGS+=" -miphoneos-version-min=6.0 ${EXTRA_CFLAGS}" + CFLAGS+=" -miphoneos-version-min=${IOS_MIN_VERSION} ${EXTRA_CFLAGS}" set -x export PATH="${DEVROOT}/usr/bin:${OLDPATH}" diff --git a/xcframeworkbuild.sh b/xcframeworkbuild.sh index 70770e7e..3bc16b0e 100755 --- a/xcframeworkbuild.sh +++ b/xcframeworkbuild.sh @@ -12,6 +12,11 @@ set -e +# Set these variables based on the desired minimum deployment target. +readonly IOS_MIN_VERSION=6.0 +readonly MACOSX_MIN_VERSION=10.15 +readonly MACOSX_CATALYST_MIN_VERSION=13.0 + # Extract Xcode version. readonly XCODE=$(xcodebuild -version | grep Xcode | cut -d " " -f2) if [[ -z "${XCODE}" ]] || [[ "${XCODE%%.*}" -lt 11 ]]; then @@ -135,10 +140,14 @@ for (( i = 0; i < $NUM_PLATFORMS; ++i )); do CFLAGS="-pipe -isysroot ${SDKROOT} -O3 -DNDEBUG" case "${PLATFORM}" in iPhone*) - CFLAGS+=" -miphoneos-version-min=6.0 -fembed-bitcode" + CFLAGS+=" -miphoneos-version-min=${IOS_MIN_VERSION} -fembed-bitcode" ;; MacOSX-Catalyst*) - CFLAGS+=" -target ${ARCH}-apple-ios13.0-macabi" + CFLAGS+=" -target" + CFLAGS+=" ${ARCH}-apple-ios${MACOSX_CATALYST_MIN_VERSION}-macabi" + ;; + MacOSX*) + CFLAGS+=" -mmacosx-version-min=${MACOSX_MIN_VERSION}" ;; esac