git: 2a21be706886 - main - graphics/spectacle: Unbreak option PIPEWIRE off

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Tue, 11 Feb 2025 19:02:59 UTC
The branch main has been updated by vvd:

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

commit 2a21be706886d1d9e3d92f8a8694d06530b3c345
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2025-02-11 18:45:24 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2025-02-11 18:58:45 +0000

    graphics/spectacle: Unbreak option PIPEWIRE off
    
    Upstream bugreport: https://bugs.kde.org/show_bug.cgi?id=499828
    
    PR:             284605
    Approved by:    arrowd, makc (maintainers kde)
---
 graphics/spectacle/Makefile                       |  3 +-
 graphics/spectacle/files/extra-patch-pipewire-off | 93 ++++++++++++++---------
 2 files changed, 57 insertions(+), 39 deletions(-)

diff --git a/graphics/spectacle/Makefile b/graphics/spectacle/Makefile
index 35d9aeb2ae8d..712aea6c14e1 100644
--- a/graphics/spectacle/Makefile
+++ b/graphics/spectacle/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	spectacle
 DISTVERSION=	${KDE_APPLICATIONS_VERSION}
+PORTREVISION=	1
 CATEGORIES=	graphics kde kde-applications
 
 MAINTAINER=	kde@FreeBSD.org
@@ -26,7 +27,7 @@ USE_XORG=	x11 xcb xext xfixes
 
 OPTIONS_DEFINE=			DOCS PIPEWIRE
 OPTIONS_DEFAULT=		PIPEWIRE
-PIPEWIRE_DESC=			Screen capture via PipeWire
+PIPEWIRE_DESC=			Screen capture via PipeWire (required for Wayland)
 PIPEWIRE_USE=			KDE=kpipewire
 PIPEWIRE_CMAKE_BOOL_OFF=	DISABLE_PIPEWIRE
 PIPEWIRE_EXTRA_PATCHES_OFF=	${FILESDIR}/extra-patch-pipewire-off
diff --git a/graphics/spectacle/files/extra-patch-pipewire-off b/graphics/spectacle/files/extra-patch-pipewire-off
index b5dd3843f7ff..4858ec011602 100644
--- a/graphics/spectacle/files/extra-patch-pipewire-off
+++ b/graphics/spectacle/files/extra-patch-pipewire-off
@@ -1,15 +1,17 @@
---- CMakeLists.txt.orig	2023-05-09 03:35:10 UTC
+--- CMakeLists.txt.orig	2025-01-30 23:53:22 UTC
 +++ CMakeLists.txt
-@@ -74,10 +74,14 @@ find_package(PlasmaWaylandProtocols REQUIRED)
- if (QT_MAJOR_VERSION EQUAL "5")
-     find_package(QtWaylandScanner REQUIRED)
- endif()
+@@ -86,12 +86,16 @@ find_package(LayerShellQt REQUIRED)
+ find_package(Wayland REQUIRED COMPONENTS Client)
+ find_package(PlasmaWaylandProtocols REQUIRED)
+ find_package(LayerShellQt REQUIRED)
 -find_package(KPipeWire)
 +option(DISABLE_PIPEWIRE "Disable PipeWire support." OFF)
 +if(NOT DISABLE_PIPEWIRE)
 +    find_package(KPipeWire REQUIRED)
 +    set(PIPEWIRE_FOUND 1)
 +endif()
+ find_package(OpenCV REQUIRED core imgproc)
+ 
  set_package_properties(KPipeWire PROPERTIES DESCRIPTION
      "Used to record pipewire streams into a file"
 -    TYPE REQUIRED
@@ -17,11 +19,11 @@
  )
  
  # optional components
---- src/CMakeLists.txt.orig	2023-05-09 03:35:10 UTC
+--- src/CMakeLists.txt.orig	2025-01-30 23:53:22 UTC
 +++ src/CMakeLists.txt
-@@ -9,6 +9,10 @@ kconfig_add_kcfg_files(SPECTACLE_SRCS GENERATE_MOC Gui
- ecm_qt_declare_logging_category(SPECTACLE_SRCS HEADER spectacle_core_debug.h IDENTIFIER SPECTACLE_CORE_LOG CATEGORY_NAME org.kde.spectacle.core DESCRIPTION "spectacle (core)" EXPORT SPECTACLE)
- ecm_qt_declare_logging_category(SPECTACLE_SRCS HEADER spectacle_gui_debug.h IDENTIFIER SPECTACLE_GUI_LOG CATEGORY_NAME org.kde.spectacle.gui DESCRIPTION "spectacle (gui)" EXPORT SPECTACLE)
+@@ -16,6 +16,10 @@ ecm_qt_declare_logging_category(SPECTACLE_SRCS
+     EXPORT SPECTACLE
+ )
  
 +if(PIPEWIRE_FOUND)
 +    list(APPEND SPECTACLE_SRCS Platforms/VideoPlatformWayland.cpp)
@@ -30,34 +32,34 @@
  add_executable(spectacle
      ${SPECTACLE_SRCS}
      Main.cpp
-@@ -45,7 +49,6 @@ add_executable(spectacle
-     Platforms/PlatformKWinWayland.cpp
-     Platforms/PlatformKWinWayland2.cpp
+@@ -58,7 +62,6 @@ add_executable(spectacle
+     Platforms/PlatformNull.cpp
+     Platforms/ImagePlatformKWin.cpp
      Platforms/VideoPlatform.cpp
 -    Platforms/VideoPlatformWayland.cpp
      Platforms/screencasting.cpp
+ )
  
-     ../resources.qrc
-@@ -84,6 +87,10 @@ endif()
+@@ -99,6 +102,10 @@ target_include_directories(spectacle PUBLIC ${OpenCV_I
  
- ki18n_wrap_ui(spectacle Gui/SettingsDialog/GeneralOptions.ui Gui/SettingsDialog/SaveOptions.ui)
+ target_include_directories(spectacle PUBLIC ${OpenCV_INCLUDE_DIRS})
  
 +if(PIPEWIRE_FOUND)
-+    target_link_libraries(spectacle K::KPipeWireRecord)
++    target_link_libraries(spectacle PRIVATE K::KPipeWireRecord)
 +endif()
 +
- target_link_libraries(
-     spectacle
-         Qt::Concurrent
-@@ -107,7 +114,6 @@ target_link_libraries(
-         KF${QT_MAJOR_VERSION}::XmlGui
-         KF${QT_MAJOR_VERSION}::GuiAddons
-         KF${QT_MAJOR_VERSION}::Kirigami2
--        K::KPipeWireRecord
-         Wayland::Client
- )
- 
---- src/Config.h.in.orig	2023-05-16 10:09:13 UTC
+ target_link_libraries(spectacle PRIVATE
+     Qt::Concurrent
+     Qt::DBus
+@@ -124,7 +131,6 @@ target_link_libraries(spectacle PRIVATE
+     KF6::StatusNotifierItem
+     KF6::PrisonScanner
+     KF6::Crash
+-    K::KPipeWireRecord
+     Wayland::Client
+     LayerShellQt::Interface
+     ${OpenCV_LIBRARIES}
+--- src/Config.h.in.orig	2025-01-30 23:53:22 UTC
 +++ src/Config.h.in
 @@ -7,6 +7,9 @@
  /* Define to 1 if we have Purpose */
@@ -69,26 +71,41 @@
  /* Set the Spectacle version from CMake */
  #cmakedefine SPECTACLE_VERSION "@SPECTACLE_VERSION@"
  
---- src/Platforms/PlatformLoader.cpp.orig	2023-05-09 03:35:10 UTC
+--- src/Platforms/PlatformLoader.cpp.orig	2025-01-30 23:53:22 UTC
 +++ src/Platforms/PlatformLoader.cpp
-@@ -10,7 +10,9 @@
- #include "PlatformKWinWayland.h"
- #include "PlatformKWinWayland2.h"
+@@ -11,7 +11,9 @@
+ 
+ #include "ImagePlatformKWin.h"
  #include "PlatformNull.h"
 +#ifdef PIPEWIRE_FOUND
  #include "VideoPlatformWayland.h"
 +#endif
  
  #ifdef XCB_FOUND
- #include "PlatformXcb.h"
-@@ -44,8 +46,10 @@ PlatformPtr loadPlatform()
+ #include "ImagePlatformXcb.h"
+@@ -74,9 +76,12 @@ VideoPlatformPtr getForcedVideoPlatform()
+         return nullptr;
+     }
  
- VideoPlatformPtr loadVideoPlatform()
- {
++#ifdef PIPEWIRE_FOUND
+     if (platformName == VideoPlatformWayland::staticMetaObject.className()) {
+         return std::make_unique<VideoPlatformWayland>();
+-    } else if (platformName == VideoPlatformNull::staticMetaObject.className()) {
++    } else
++#endif
++    if (platformName == VideoPlatformNull::staticMetaObject.className()) {
+         return std::make_unique<VideoPlatformNull>();
+     } else if (!platformName.isEmpty()) {
+         qWarning() << "SPECTACLE_VIDEO_PLATFORM:" << platformName << "is invalid";
+@@ -90,9 +95,11 @@ VideoPlatformPtr loadVideoPlatform()
+     if (auto platform = getForcedVideoPlatform()) {
+         return platform;
+     }
 +#ifdef PIPEWIRE_FOUND
      if (KWindowSystem::isPlatformWayland()) {
          return std::make_unique<VideoPlatformWayland>();
      }
 +#endif
-     return std::make_unique<VideoPlatformNull>();
- }
+     if (KWindowSystem::isPlatformX11()) {
+         return std::make_unique<VideoPlatformNull>(i18nc("@info", "Screen recording is not available on X11."));
+     }