git: ca9de74ce4b1 - main - x11/mate-panel: fix build with clang 15

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Mon, 16 Jan 2023 19:05:21 UTC
The branch main has been updated by dim (src committer):

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

commit ca9de74ce4b13b979ea5f24c88c111a2f9b24dfa
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-01-07 00:28:09 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-01-16 19:04:46 +0000

    x11/mate-panel: fix build with clang 15
    
    During an exp-run for llvm 15 (see bug 265425), it turned out that
    x11/mate-panel failed to build with clang 15:
    
      clock-location.c:454:22: error: incompatible pointer to integer conversion assigning to 'glong' (aka 'long') from 'char *(int, int)' [-Wint-conversion]
              sys_timezone = timezone;
                           ^ ~~~~~~~~
      clock-location.c:462:24: error: incompatible pointer to integer conversion assigning to 'glong' (aka 'long') from 'char *(int, int)' [-Wint-conversion]
              local_timezone = timezone;
                             ^ ~~~~~~~~
    
    This is because 'timezone' as a global external variable does not exist
    on FreeBSD: it is a glibc-ism. Use struct tm's tm_gmtoff field instead,
    which has its sign reversed from the glibc global. There is also no need
    to manually account for DST, as tm_gmtoff includes that.
    
    PR:             268795
    Approved by:    portmgr (tcberner)
    MFH:            2023Q1
---
 .../files/patch-applets_clock_clock-location.c     | 30 ++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/x11/mate-panel/files/patch-applets_clock_clock-location.c b/x11/mate-panel/files/patch-applets_clock_clock-location.c
new file mode 100644
index 000000000000..5f784e380463
--- /dev/null
+++ b/x11/mate-panel/files/patch-applets_clock_clock-location.c
@@ -0,0 +1,30 @@
+--- applets/clock/clock-location.c.orig	2022-01-26 15:27:16 UTC
++++ applets/clock/clock-location.c
+@@ -451,19 +451,27 @@ clock_location_get_offset (ClockLocation *loc)
+ 
+         unsetenv ("TZ");
+         tm = localtime (&t);
++#ifdef __FreeBSD__
++        sys_timezone = -tm->tm_gmtoff;
++#else        
+         sys_timezone = timezone;
+ 
+         if (tm->tm_isdst > 0) {
+                 sys_timezone -= 3600;
+         }
++#endif
+ 
+         setenv ("TZ", priv->timezone, 1);
+         tm = localtime (&t);
++#ifdef __FreeBSD__
++        local_timezone = -tm->tm_gmtoff;
++#else        
+         local_timezone = timezone;
+ 
+         if (tm->tm_isdst > 0) {
+                 local_timezone -= 3600;
+         }
++#endif
+ 
+         offset = local_timezone - sys_timezone;
+