From 6a759836e5e76bb7b69b0ac244eea76b0d290512 Mon Sep 17 00:00:00 2001
From: Oleg Oshmyan <chortos@inbox.lv>
Date: Mon, 14 Oct 2024 15:20:42 +0300
Subject: [PATCH] coretext: fix building with 10.5 SDK

Turns out MacOSX10.5.sdk also defines __MAC_10_6
(but not MAC_OS_X_VERSION_10_6 or kCTFontURLAttribute).

Looking back, I switched from AvailabilityMacros.h to Availability.h
late in the development of https://github.com/libass/libass/issues/595,
and this switch may have gone untested back then.
This has been reported to successfuly compile more recently,
and this is a mystery, but it's possible that the reporter inadvertently
tested code with additional local changes that worked around this.

Fixes: https://github.com/libass/libass/issues/837
---
 libass/ass_coretext.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libass/ass_coretext.c b/libass/ass_coretext.c
index 36ed71afb..030ff8efa 100644
--- libass/ass_coretext.c
+++ libass/ass_coretext.c
@@ -19,7 +19,7 @@
 #include "config.h"
 #include "ass_compat.h"
 
-#include <Availability.h>
+#include <AvailabilityMacros.h>
 #include <CoreFoundation/CoreFoundation.h>
 #include <TargetConditionals.h>
 #if TARGET_OS_IPHONE
@@ -87,13 +87,13 @@ static char *get_font_file(CTFontDescriptorRef fontd)
 {
     CFURLRef url = NULL;
     if (false) {}
-#ifdef __MAC_10_6
+#ifdef MAC_OS_X_VERSION_10_6
     // Declared in SDKs since 10.6, including iOS SDKs
     else if (CHECK_AVAILABLE(kCTFontURLAttribute, macOS 10.6, *)) {
         url = CTFontDescriptorCopyAttribute(fontd, kCTFontURLAttribute);
     }
 #endif
-#if !TARGET_OS_IPHONE && (!defined(__MAC_10_6) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_6)
+#if !TARGET_OS_IPHONE && MAC_OS_X_VERSION_MIN_REQUIRED < 1060
     // ATS is declared deprecated in newer macOS SDKs
     // and not declared at all in iOS SDKs
     else {
