git: 1905b82aecac - 2025Q4 - devel/spdlog: fix botched gmt offset calculation

From: Matthias Andree <mandree_at_FreeBSD.org>
Date: Sun, 02 Nov 2025 02:18:09 UTC
The branch 2025Q4 has been updated by mandree:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1905b82aecac71de1d875abcab973ac3dd2ce598

commit 1905b82aecac71de1d875abcab973ac3dd2ce598
Author:     Matthias Andree <mandree@FreeBSD.org>
AuthorDate: 2025-11-02 02:08:57 +0000
Commit:     Matthias Andree <mandree@FreeBSD.org>
CommitDate: 2025-11-02 02:17:26 +0000

    devel/spdlog: fix botched gmt offset calculation
    
    The upstream code has like a handful of bugs in the place that should
    obtain the GMT offset for a struct tm, and os-inl.h is a botch.
    
    Strip the bogus workaround code and use tm.tm_gmtoff.
    
    Reported by:    diizzy@
    URL:            https://github.com/gabime/spdlog/issues/3483
    Approved by:    portmgr@ (just-fix-it blanket)
    
    (based on commit 9f6a8a34ed864c5a40d987d6d102898ee124a821)
---
 devel/spdlog/Makefile                              |  2 +-
 .../files/patch-include_spdlog_details_os-inl.h    | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/devel/spdlog/Makefile b/devel/spdlog/Makefile
index 5c527c89b6a7..78f30fdd0d63 100644
--- a/devel/spdlog/Makefile
+++ b/devel/spdlog/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	spdlog
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.15.2
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	devel
 
 MAINTAINER=	vanilla@FreeBSD.org
diff --git a/devel/spdlog/files/patch-include_spdlog_details_os-inl.h b/devel/spdlog/files/patch-include_spdlog_details_os-inl.h
new file mode 100644
index 000000000000..494b1276160c
--- /dev/null
+++ b/devel/spdlog/files/patch-include_spdlog_details_os-inl.h
@@ -0,0 +1,22 @@
+The calculate_gmt_offset attempt is a botch. It gets localtm passed in from the
+self-test's yesterday, and then calls time() anew to obtain ::gmtime_r() by way of details::os::gmtime(),
+and that cannot possibly work.
+
+https://github.com/gabime/spdlog/issues/3483
+
+Fix: Disable the non-working code and use tm_gmtoff instead.
+
+--- include/spdlog/details/os-inl.h.orig	2025-03-29 11:01:07 UTC
++++ include/spdlog/details/os-inl.h
+@@ -265,10 +265,7 @@ SPDLOG_INLINE int utc_minutes_offset(const std::tm &tm
+     return offset;
+ #else
+ 
+-    #if defined(sun) || defined(__sun) || defined(_AIX) || \
+-        (defined(__NEWLIB__) && !defined(__TM_GMTOFF)) ||  \
+-        (!defined(__APPLE__) && !defined(_BSD_SOURCE) && !defined(_GNU_SOURCE) && \
+-            (!defined(_POSIX_VERSION) || (_POSIX_VERSION < 202405L)))
++    #if 0
+     // 'tm_gmtoff' field is BSD extension and it's missing on SunOS/Solaris
+     struct helper {
+         static long int calculate_gmt_offset(const std::tm &localtm = details::os::localtime(),