git: 058327d15649 - main - devel/qt6-base: repair timezone-loading

From: Adriaan de Groot <adridg_at_FreeBSD.org>
Date: Tue, 11 Mar 2025 13:21:53 UTC
The branch main has been updated by adridg:

URL: https://cgit.FreeBSD.org/ports/commit/?id=058327d15649593fcb4758ad7cf3a4c722bede7c

commit 058327d15649593fcb4758ad7cf3a4c722bede7c
Author:     Adriaan de Groot <adridg@FreeBSD.org>
AuthorDate: 2025-03-11 13:18:07 +0000
Commit:     Adriaan de Groot <adridg@FreeBSD.org>
CommitDate: 2025-03-11 13:21:51 +0000

    devel/qt6-base: repair timezone-loading
    
    This is basically the same patch as in devel/qt5-core, but
    written anew and a little more compact. On FreeBSD, prefer
    reading from /var/db/zoneinfo which contains the name of the
    system timezone. (And /etc/localtime is a complete tzinfo file,
    not suitable for finding the name in a way suitable for this
    bit of code).
    
    Reported-by:    Martin Birgmeier
    PR:     285244
---
 devel/qt6-base/Makefile                              |  2 +-
 .../patch-src_corelib_time_qtimezoneprivate__tz.cpp  | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/devel/qt6-base/Makefile b/devel/qt6-base/Makefile
index 08996d70549f..b305993db175 100644
--- a/devel/qt6-base/Makefile
+++ b/devel/qt6-base/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	base
 DISTVERSION=	${QT6_VERSION}
-PORTREVISION=	3
+PORTREVISION=	4
 CATEGORIES=	devel
 PKGNAMEPREFIX=	qt6-
 
diff --git a/devel/qt6-base/files/patch-src_corelib_time_qtimezoneprivate__tz.cpp b/devel/qt6-base/files/patch-src_corelib_time_qtimezoneprivate__tz.cpp
new file mode 100644
index 000000000000..e77da3e4be7a
--- /dev/null
+++ b/devel/qt6-base/files/patch-src_corelib_time_qtimezoneprivate__tz.cpp
@@ -0,0 +1,20 @@
+--- src/corelib/time/qtimezoneprivate_tz.cpp.orig	2025-03-11 12:45:59 UTC
++++ src/corelib/time/qtimezoneprivate_tz.cpp
+@@ -1312,8 +1312,16 @@ class ZoneNameReader (public)
+         const StatIdent local = identify("/etc/localtime");
+         const StatIdent tz = identify("/etc/TZ");
+         const StatIdent timezone = identify("/etc/timezone");
++        const StatIdent db_zoneinfo = identify("/var/db/zoneinfo");
+         if (!m_name.isEmpty() && m_last.isValid()
+-            && (m_last == local || m_last == tz || m_last == timezone)) {
++            && (m_last == local || m_last == tz || m_last == timezone || m_last == db_zoneinfo)) {
++            return m_name;
++        }
++
++        // FreeBSD usually has /var/db/zoneinfo with the name of the TZ
++        m_name = etcContent(QStringLiteral("/var/db/zoneinfo"));
++        if (!m_name.isEmpty()) {
++            m_last = db_zoneinfo;
+             return m_name;
+         }
+