sdl12-compat: update SDL_platform.h from SDL2.

From c1eb2fecf9c5fc05e2efce0e2a135cd7474a4874 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Sat, 27 May 2023 18:56:56 +0300
Subject: [PATCH] update SDL_platform.h from SDL2.

---
 include/SDL/SDL_platform.h | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/include/SDL/SDL_platform.h b/include/SDL/SDL_platform.h
index 63149f8d8..13fb98f38 100644
--- a/include/SDL/SDL_platform.h
+++ b/include/SDL/SDL_platform.h
@@ -70,13 +70,34 @@ requirement is dropped too. Send patches. :) */
 
 #if defined(__APPLE__)
 /* lets us know what version of Mac OS X we're compiling on */
-#include "AvailabilityMacros.h"
-#include "TargetConditionals.h"
-#if defined(TARGET_OS_TV) && TARGET_OS_TV
+#include <AvailabilityMacros.h>
+#include <TargetConditionals.h>
+
+/* Fix building with older SDKs that don't define these
+   See this for more information:
+   https://stackoverflow.com/questions/12132933/preprocessor-macro-for-os-x-targets
+*/
+#ifndef TARGET_OS_MACCATALYST
+#define TARGET_OS_MACCATALYST 0
+#endif
+#ifndef TARGET_OS_IOS
+#define TARGET_OS_IOS 0
+#endif
+#ifndef TARGET_OS_IPHONE
+#define TARGET_OS_IPHONE 0
+#endif
+#ifndef TARGET_OS_TV
+#define TARGET_OS_TV 0
+#endif
+#ifndef TARGET_OS_SIMULATOR
+#define TARGET_OS_SIMULATOR 0
+#endif
+
+#if TARGET_OS_TV
 #undef __TVOS__
 #define __TVOS__ 1
 #endif
-#if defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
+#if TARGET_OS_IPHONE
 /* if compiling for iOS */
 #undef __IPHONEOS__
 #define __IPHONEOS__ 1