From 881965da18dee93aa38570a0d2fe292c37365bd8 Mon Sep 17 00:00:00 2001
From: Sergey Fedorov <barracuda@macos-powerpc.org>
Date: Fri, 13 Dec 2024 17:03:57 +0800
Subject: [PATCH] ofstub.cc: fix environ for Apple

---
 ofstd/libsrc/ofstub.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git ofstd/libsrc/ofstub.cc ofstd/libsrc/ofstub.cc
index c1df7068e..bba147e26 100644
--- ofstd/libsrc/ofstub.cc
+++ ofstd/libsrc/ofstub.cc
@@ -141,6 +141,11 @@ static OFString getLastErrorString()
   return OFString();
 }
 
+#elif defined(__APPLE__)
+
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+
 #else /* _WIN32 */
 
 extern char** environ; // required to exist by the Single Unix Specification
