configure.ac | 134 ++++++++++++++--------------------------------------------- 1 file changed, 34 insertions(+), 100 deletions(-)
New commits: commit 92f8b5ac2e699ed3fbd6e086dd40007b22c3838f Author: Christian Lohmaier <lohmaier+libreoff...@googlemail.com> AuthorDate: Mon Nov 21 14:51:32 2022 +0100 Commit: Tor Lillqvist <t...@collabora.com> CommitDate: Fri Dec 16 15:32:28 2022 +0000 macOS: simplify SDK handling, remove the upper limit of SDK …both for building as well as for min-required version The newer versions of XCode/the corresponding SDK it comes with didn't cause any problems in the last years, and checking for a max-sdk version just causes more work when working on a newer system, either forcing to have multiple versions of Xcode around and switching between those for no reason, or always patching configure to accept the currently used version when bisecting stuff. Addition by tml: We still want to default to --with-macosx-version-min-required=10.12 in this branch. Change-Id: I0dac9f90afe7d4490d44a1036fa8d358d29da57f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/144206 Tested-by: Tor Lillqvist <t...@collabora.com> Reviewed-by: Tor Lillqvist <t...@collabora.com> diff --git a/configure.ac b/configure.ac index 9793ed40bdd9..4585a22fc362 100644 --- a/configure.ac +++ b/configure.ac @@ -3294,63 +3294,34 @@ if test $_os = Darwin; then # The SDK in the currently selected Xcode should be found. AC_MSG_CHECKING([what macOS SDK to use]) - for macosx_sdk in 13.0 12.3 12.1 12.0 11.3 11.1 11.0 10.15 10.14 10.13; do - MACOSX_SDK_PATH=`xcrun --sdk macosx${macosx_sdk} --show-sdk-path 2> /dev/null` - if test -d "$MACOSX_SDK_PATH"; then - break - else - MACOSX_SDK_PATH="`xcode-select -print-path`/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${macosx_sdk}.sdk" - if test -d "$MACOSX_SDK_PATH"; then - break - fi - fi - done + # XCode only ships with a single SDK for a while now, and using older SDKs alongside is not + # really supported anymore, instead you'd use different copies of Xcode, each with their own + # SDK, and thus xcrun will pick the SDK that matches the currently selected Xcode version + # also restricting the SDK version to "known good" versions doesn't seem necessary anyomre, the + # problems that existed in the PPC days with target versions not being respected or random + # failures seems to be a thing of the past or rather: limiting either the Xcode version or the + # SDK version is enough, no need to do both... + MACOSX_SDK_PATH=`xcrun --sdk macosx --show-sdk-path 2> /dev/null` if test ! -d "$MACOSX_SDK_PATH"; then AC_MSG_ERROR([Could not find an appropriate macOS SDK]) fi - - AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH]) + macosx_sdk=`xcodebuild -version -sdk "$MACOSX_SDK_PATH" SDKVersion` MACOSX_SDK_BUILD_VERSION=$(xcodebuild -version -sdk "$MACOSX_SDK_PATH" ProductBuildVersion) - case $macosx_sdk in - 10.13) - MACOSX_SDK_VERSION=101300 - ;; - 10.14) - MACOSX_SDK_VERSION=101400 - ;; - 10.15) - MACOSX_SDK_VERSION=101500 - ;; - 11.0) - MACOSX_SDK_VERSION=110000 - ;; - 11.1) - MACOSX_SDK_VERSION=110100 - ;; - 11.3) - MACOSX_SDK_VERSION=110300 - ;; - 12.0) - MACOSX_SDK_VERSION=120000 - ;; - 12.1) - MACOSX_SDK_VERSION=120100 - ;; - 12.3) - MACOSX_SDK_VERSION=120300 - ;; - 13.0) - MACOSX_SDK_VERSION=130000 - ;; - *) - AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported]) - ;; - esac - + # format changed between 10.9 and 10.10 - up to 10.9 it was just four digits (1090), starting + # with macOS 10.10 it was switched to account for x.y.z with six digits, 10.10 is 101000, + # 10.10.2 is 101002 + # we don't target the lower versions anymore, so it doesn't matter that we don't generate the + # correct version in case such an old SDK is specified, it will be rejected later anyway + MACOSX_SDK_VERSION=$(echo $macosx_sdk | $AWK -F. '{ print $1*10000+$2*100+$3 }') + if test $MACOSX_SDK_VERSION -lt 101400; then + AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported, lowest supported version is 10.14]) + fi if test "$host_cpu" = arm64 -a $MACOSX_SDK_VERSION -lt 110000; then - AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon]) + AC_MSG_ERROR([macOS SDK $macosx_sdk is not supported for Apple Silicon (need at least 11.0)]) fi + AC_MSG_RESULT([macOS SDK $macosx_sdk at $MACOSX_SDK_PATH]) + AC_MSG_CHECKING([what minimum version of macOS to require]) if test "$with_macosx_version_min_required" = "" ; then if test "$host_cpu" = x86_64; then with_macosx_version_min_required="10.12"; @@ -3358,6 +3329,19 @@ if test $_os = Darwin; then with_macosx_version_min_required="11.0"; fi fi + # see same notes about MACOSX_SDK_VERSION above + MAC_OS_X_VERSION_MIN_REQUIRED=$(echo $with_macosx_version_min_required | $AWK -F. '{ print $1*10000+$2*100+$3 }') + if test $MAC_OS_X_VERSION_MIN_REQUIRED -lt 101200; then + AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, minimum supported version is 10.12]) + fi + AC_MSG_RESULT([$with_macosx_version_min_required]) + + AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk]) + if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then + AC_MSG_ERROR([the version minimum required ($with_macosx_version_min_required) cannot be greater than the sdk level ($macosx_sdk)]) + else + AC_MSG_RESULT([yes]) + fi # export this so that "xcrun" invocations later return matching values DEVELOPER_DIR="${MACOSX_SDK_PATH%/SDKs*}" @@ -3379,48 +3363,6 @@ if test $_os = Darwin; then my_xcode_ver1=$(xcrun xcodebuild -version | tail -n 1) MACOSX_XCODE_BUILD_VERSION=${my_xcode_ver1#Build version } - case "$with_macosx_version_min_required" in - 10.12) - MAC_OS_X_VERSION_MIN_REQUIRED="101200" - ;; - 10.13) - MAC_OS_X_VERSION_MIN_REQUIRED="101300" - ;; - 10.14) - MAC_OS_X_VERSION_MIN_REQUIRED="101400" - ;; - 10.15) - MAC_OS_X_VERSION_MIN_REQUIRED="101500" - ;; - 10.16) - MAC_OS_X_VERSION_MIN_REQUIRED="101600" - ;; - 11.0) - MAC_OS_X_VERSION_MIN_REQUIRED="110000" - ;; - 11.1) - MAC_OS_X_VERSION_MIN_REQUIRED="110100" - ;; - 11.3) - MAC_OS_X_VERSION_MIN_REQUIRED="110300" - ;; - 12.0) - MAC_OS_X_VERSION_MIN_REQUIRED="120000" - ;; - 12.1) - MAC_OS_X_VERSION_MIN_REQUIRED="120100" - ;; - 12.3) - MAC_OS_X_VERSION_MIN_REQUIRED="120300" - ;; - 13.0) - MAC_OS_X_VERSION_MIN_REQUIRED="130000" - ;; - *) - AC_MSG_ERROR([with-macosx-version-min-required $with_macosx_version_min_required is not a supported value, supported values are 10.12--13.0]) - ;; - esac - LIBTOOL=/usr/bin/libtool INSTALL_NAME_TOOL=install_name_tool if test -z "$save_CC"; then @@ -3456,14 +3398,6 @@ if test $_os = Darwin; then RANLIB=`xcrun -find ranlib` fi - AC_MSG_CHECKING([that macosx-version-min-required is coherent with macos-with-sdk]) - if test $MAC_OS_X_VERSION_MIN_REQUIRED -gt $MACOSX_SDK_VERSION; then - AC_MSG_ERROR([the version minimum required cannot be greater than the sdk level]) - else - AC_MSG_RESULT([ok]) - fi - AC_MSG_NOTICE([MAC_OS_X_VERSION_MIN_REQUIRED=$MAC_OS_X_VERSION_MIN_REQUIRED]) - AC_MSG_CHECKING([whether to do code signing]) if test -z "$enable_macosx_code_signing" -o "$enable_macosx_code_signing" == "no" ; then