From ef1754fa7054d64164b9fa3acd291555d328384e Mon Sep 17 00:00:00 2001 From: Sergey Fedorov Date: Sun, 25 Aug 2024 09:28:57 +0800 Subject: [PATCH] spdlog0: backport upstream fix for old systems --- devel/spdlog0/Portfile | 3 +++ devel/spdlog0/files/patch-pthread.diff | 32 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 devel/spdlog0/files/patch-pthread.diff diff --git a/devel/spdlog0/Portfile b/devel/spdlog0/Portfile index 30c3fc1b0030b..d7feb7c3cd890 100644 --- a/devel/spdlog0/Portfile +++ b/devel/spdlog0/Portfile @@ -26,4 +26,7 @@ github.tarball_from archive supported_archs noarch compiler.cxx_standard 2011 +# Backport of https://github.com/gabime/spdlog/commit/c65aa4e4889939c1afa82001db349cac237a13f8 +patchfiles patch-pthread.diff + livecheck.type none diff --git a/devel/spdlog0/files/patch-pthread.diff b/devel/spdlog0/files/patch-pthread.diff new file mode 100644 index 0000000000000..8f5d21d7279f4 --- /dev/null +++ b/devel/spdlog0/files/patch-pthread.diff @@ -0,0 +1,32 @@ +--- include/spdlog/details/os.h 2018-05-22 01:38:13.000000000 +0800 ++++ include/spdlog/details/os.h 2024-08-25 09:14:56.000000000 +0800 +@@ -49,6 +49,10 @@ + + #endif // unix + ++#if defined __APPLE__ ++#include ++#endif ++ + #ifndef __has_feature // Clang - feature checking macros. + #define __has_feature(x) 0 // Compatibility with non-clang compilers. + #endif +@@ -337,7 +341,17 @@ + return static_cast(tid); + #elif __APPLE__ + uint64_t tid; +- pthread_threadid_np(nullptr, &tid); ++#if (MAC_OS_X_VERSION_MAX_ALLOWED < 1060) || defined(__POWERPC__) ++ tid = pthread_mach_thread_np(pthread_self()); ++#elif MAC_OS_X_VERSION_MIN_REQUIRED < 1060 ++ if (&pthread_threadid_np) { ++ pthread_threadid_np(nullptr, &tid); ++ } else { ++ tid = pthread_mach_thread_np(pthread_self()); ++ } ++#else ++ pthread_threadid_np(nullptr, &tid); ++#endif + return static_cast(tid); + #else // Default to standard C++11 (other Unix) + return static_cast(std::hash()(std::this_thread::get_id()));