git: 46c2184d862f - main - x11-wm/plasma5-kwin: unbreak on FreeBSD < 13 after d06d26f8c45e

From: Jan Beich <jbeich_at_FreeBSD.org>
Date: Thu, 16 Feb 2023 00:43:07 UTC
The branch main has been updated by jbeich:

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

commit 46c2184d862f3344afdea9d9a203929b80243535
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-02-08 11:22:24 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-02-16 00:36:18 +0000

    x11-wm/plasma5-kwin: unbreak on FreeBSD < 13 after d06d26f8c45e
    
    PR:             269406
    Approved by:    tcberner
---
 ...patch-src_backends_drm_drm__qpainter__layer.cpp | 20 +++++++
 ...1_windowed_x11__windowed__qpainter__backend.cpp | 17 ++++++
 .../plasma5-kwin/files/patch-src_utils_ramfile.cpp | 68 ++++++++++++++++++++++
 3 files changed, 105 insertions(+)

diff --git a/x11-wm/plasma5-kwin/files/patch-src_backends_drm_drm__qpainter__layer.cpp b/x11-wm/plasma5-kwin/files/patch-src_backends_drm_drm__qpainter__layer.cpp
new file mode 100644
index 000000000000..18ff88315524
--- /dev/null
+++ b/x11-wm/plasma5-kwin/files/patch-src_backends_drm_drm__qpainter__layer.cpp
@@ -0,0 +1,20 @@
+src/backends/drm/drm_qpainter_layer.cpp:54:79: error: use of undeclared identifier 'errno'
+        qCWarning(KWIN_DRM, "Failed to create dumb framebuffer: %s", strerror(errno));
+                                                                              ^
+src/backends/drm/drm_qpainter_layer.cpp:66:87: error: use of undeclared identifier 'errno'
+                qCWarning(KWIN_DRM, "Failed to create dumb framebuffer: %s", strerror(errno));
+                                                                                      ^
+src/backends/drm/drm_qpainter_layer.cpp:121:94: error: use of undeclared identifier 'errno'
+        qCWarning(KWIN_DRM, "Failed to create dumb framebuffer for the cursor: %s", strerror(errno));
+                                                                                             ^
+
+--- src/backends/drm/drm_qpainter_layer.cpp.orig	2023-01-03 18:08:37 UTC
++++ src/backends/drm/drm_qpainter_layer.cpp
+@@ -19,6 +19,7 @@
+ #include "drm_qpainter_backend.h"
+ #include "drm_virtual_output.h"
+ 
++#include <cerrno>
+ #include <drm_fourcc.h>
+ 
+ namespace KWin
diff --git a/x11-wm/plasma5-kwin/files/patch-src_backends_x11_windowed_x11__windowed__qpainter__backend.cpp b/x11-wm/plasma5-kwin/files/patch-src_backends_x11_windowed_x11__windowed__qpainter__backend.cpp
new file mode 100644
index 000000000000..938bf51a26ff
--- /dev/null
+++ b/x11-wm/plasma5-kwin/files/patch-src_backends_x11_windowed_x11__windowed__qpainter__backend.cpp
@@ -0,0 +1,17 @@
+src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp:47:71: error: use of undeclared identifier 'errno'
+        qCWarning(KWIN_X11WINDOWED) << "shmget() failed:" << strerror(errno);
+                                                                      ^
+src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp:54:70: error: use of undeclared identifier 'errno'
+        qCWarning(KWIN_X11WINDOWED) << "shmat() failed:" << strerror(errno);
+                                                                     ^
+
+--- src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp~	2023-02-09 12:15:33.000000000 +0000
++++ src/backends/x11/windowed/x11_windowed_qpainter_backend.cpp	2023-02-16 00:34:26.599527784 +0000
+@@ -11,6 +11,7 @@
+ #include "x11_windowed_logging.h"
+ #include "x11_windowed_output.h"
+ 
++#include <cerrno>
+ #include <string.h>
+ #include <sys/shm.h>
+ #include <xcb/present.h>
diff --git a/x11-wm/plasma5-kwin/files/patch-src_utils_ramfile.cpp b/x11-wm/plasma5-kwin/files/patch-src_utils_ramfile.cpp
new file mode 100644
index 000000000000..4de0b5f5fa4a
--- /dev/null
+++ b/x11-wm/plasma5-kwin/files/patch-src_utils_ramfile.cpp
@@ -0,0 +1,68 @@
+FreeBSD < 13 lacks https://cgit.freebsd.org/src/commit/?id=af755d3e4859
+
+src/utils/ramfile.cpp:57:117: error: use of undeclared identifier 'errno'
+        qCWarning(KWIN_CORE).nospace() << name << ": Failed to remove temporary file from filesystem: " << strerror(errno);
+                                                                                                                    ^
+src/utils/ramfile.cpp:80:17: error: use of undeclared identifier 'F_SEAL_SHRINK'
+    int seals = F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_SEAL;
+                ^
+src/utils/ramfile.cpp:80:33: error: use of undeclared identifier 'F_SEAL_GROW'
+    int seals = F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_SEAL;
+                                ^
+src/utils/ramfile.cpp:80:47: error: use of undeclared identifier 'F_SEAL_SEAL'
+    int seals = F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_SEAL;
+                                              ^
+src/utils/ramfile.cpp:82:18: error: use of undeclared identifier 'F_SEAL_WRITE'
+        seals |= F_SEAL_WRITE;
+                 ^
+src/utils/ramfile.cpp:85:21: error: use of undeclared identifier 'F_ADD_SEALS'
+    if (fcntl(fd(), F_ADD_SEALS, seals) != 0) {
+                    ^
+src/utils/ramfile.cpp:139:35: error: use of undeclared identifier 'F_GET_SEALS'
+    const int seals = fcntl(fd(), F_GET_SEALS);
+                                  ^
+src/utils/ramfile.cpp:141:21: error: use of undeclared identifier 'F_SEAL_WRITE'
+        if (seals & F_SEAL_WRITE) {
+                    ^
+
+--- src/utils/ramfile.cpp.orig	2023-01-03 18:08:37 UTC
++++ src/utils/ramfile.cpp
+@@ -16,6 +16,7 @@
+ #include <fcntl.h>
+ #include <sys/mman.h>
+ #include <unistd.h>
++#include <cerrno>
+ #include <utility>
+ 
+ namespace KWin
+@@ -77,6 +78,7 @@ RamFile::RamFile(const char *name, const void *inData,
+     m_tmp->unmap(data);
+ #endif
+ 
++#ifdef F_SEAL_SEAL
+     int seals = F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_SEAL;
+     if (flags.testFlag(RamFile::Flag::SealWrite)) {
+         seals |= F_SEAL_WRITE;
+@@ -85,6 +87,7 @@ RamFile::RamFile(const char *name, const void *inData,
+     if (fcntl(fd(), F_ADD_SEALS, seals) != 0) {
+         qCDebug(KWIN_CORE).nospace() << name << ": Failed to seal RamFile: " << strerror(errno);
+     }
++#endif
+ 
+     guard.dismiss();
+ }
+@@ -136,12 +139,14 @@ RamFile::Flags RamFile::effectiveFlags() const
+ {
+     Flags flags = {};
+ 
++#ifdef F_SEAL_SEAL
+     const int seals = fcntl(fd(), F_GET_SEALS);
+     if (seals > 0) {
+         if (seals & F_SEAL_WRITE) {
+             flags.setFlag(Flag::SealWrite);
+         }
+     }
++#endif
+ 
+     return flags;
+ }