commit:     917c023b4cb681a4895434f2a2b66c2bbe2eab44
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Tue Aug  2 08:28:12 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Sat Sep 24 08:53:46 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=917c023b

kde-frameworks/knotifications: Fix build with USE -X

Upstream commit 0450e434116acdc640b0c8256228feec8b363e47

Bug: https://bugs.gentoo.org/813450
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../files/knotifications-5.98.0-without_x11.patch  | 81 ++++++++++++++++++++++
 ...98.0.ebuild => knotifications-5.98.0-r1.ebuild} | 11 +--
 2 files changed, 87 insertions(+), 5 deletions(-)

diff --git 
a/kde-frameworks/knotifications/files/knotifications-5.98.0-without_x11.patch 
b/kde-frameworks/knotifications/files/knotifications-5.98.0-without_x11.patch
new file mode 100644
index 000000000000..358b873bb5e2
--- /dev/null
+++ 
b/kde-frameworks/knotifications/files/knotifications-5.98.0-without_x11.patch
@@ -0,0 +1,81 @@
+From 0450e434116acdc640b0c8256228feec8b363e47 Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <ast...@gentoo.org>
+Date: Tue, 2 Aug 2022 10:14:51 +0200
+Subject: [PATCH] Add CMake option to build WITHOUT_X11
+
+We want to be able to build without X11 support even if some of the used
+libraries may not work w/o X11 themselves yet or need to be built with
+X11 support for other reverse dependencies.
+
+HAVE_X11 already exists and is set automagically so far, but using
+-DCMAKE_DISABLE_FIND_PACKAGE_X11 will break if any dependencies list X11
+as required in their cmake config.
+
+Introducing this option means there is no behavior change by default,
+cmake will just skip finding X11 or adding unwanted features if the
+option is enabled.
+
+Signed-off-by: Andreas Sturmlechner <ast...@gentoo.org>
+---
+ CMakeLists.txt                  | 15 +++++++++------
+ KF5NotificationsConfig.cmake.in |  2 +-
+ src/CMakeLists.txt              |  2 +-
+ 3 files changed, 11 insertions(+), 8 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a59f704..8e6763f 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -75,14 +75,17 @@ if (QT_MAJOR_VERSION STREQUAL "5")
+ endif()
+ 
+ if (NOT APPLE AND NOT WIN32)
+-    find_package(X11)
++    option(WITHOUT_X11 "Build without X11 support (skips finding X11)." OFF)
++    if(NOT WITHOUT_X11)
++        find_package(X11)
++        set(HAVE_X11 ${X11_FOUND})
++        set(HAVE_XTEST ${X11_XTest_FOUND})
++        if(X11_FOUND AND QT_MAJOR_VERSION STREQUAL "5")
++            find_package(Qt5X11Extras ${REQUIRED_QT_VERSION} NO_MODULE 
REQUIRED)
++        endif()
++    endif()
+ endif()
+ 
+-set(HAVE_X11 ${X11_FOUND})
+-set(HAVE_XTEST ${X11_XTest_FOUND})
+-if(X11_FOUND AND QT_MAJOR_VERSION STREQUAL "5")
+-    find_package(Qt5X11Extras ${REQUIRED_QT_VERSION} NO_MODULE REQUIRED)
+-endif()
+ if(APPLE)
+    find_package(Qt5MacExtras ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE)
+ endif()
+diff --git a/KF5NotificationsConfig.cmake.in b/KF5NotificationsConfig.cmake.in
+index b0dbea8..dc97209 100644
+--- a/KF5NotificationsConfig.cmake.in
++++ b/KF5NotificationsConfig.cmake.in
+@@ -36,7 +36,7 @@ if (NOT @BUILD_SHARED_LIBS@)
+         find_dependency(Qt5TextToSpeech @REQUIRED_QT_VERSION@)
+     endif()
+ 
+-    if(@X11_FOUND@)
++    if(@HAVE_X11@)
+         if (NOT TARGET Qt6::Gui)
+             find_dependency(Qt5X11Extras @REQUIRED_QT_VERSION@)
+         endif()
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index 7f47f54..8f63201 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -143,7 +143,7 @@ if (Qt5TextToSpeech_FOUND)
+     target_link_libraries(KF5Notifications PRIVATE Qt5::TextToSpeech)
+ endif()
+ 
+-if(X11_FOUND)
++if(HAVE_X11)
+    target_link_libraries(KF5Notifications PRIVATE ${X11_X11_LIB})
+     if (TARGET Qt5::X11Extras)
+         target_link_libraries(KF5Notifications PRIVATE Qt5::X11Extras)
+-- 
+GitLab
+

diff --git a/kde-frameworks/knotifications/knotifications-5.98.0.ebuild 
b/kde-frameworks/knotifications/knotifications-5.98.0-r1.ebuild
similarity index 86%
rename from kde-frameworks/knotifications/knotifications-5.98.0.ebuild
rename to kde-frameworks/knotifications/knotifications-5.98.0-r1.ebuild
index abc6ea34994f..bae13cc8e50c 100644
--- a/kde-frameworks/knotifications/knotifications-5.98.0.ebuild
+++ b/kde-frameworks/knotifications/knotifications-5.98.0-r1.ebuild
@@ -9,6 +9,7 @@ QTMIN=5.15.5
 inherit ecm frameworks.kde.org
 
 DESCRIPTION="Framework for notifying the user of an event"
+
 LICENSE="LGPL-2.1+"
 KEYWORDS="~amd64 ~arm ~arm64 ~loong ~ppc64 ~riscv ~x86"
 IUSE="dbus nls phonon qml speech X"
@@ -19,7 +20,7 @@ RDEPEND="
        >=dev-qt/qtwidgets-${QTMIN}:5
        =kde-frameworks/kconfig-${PVCUT}*:5
        =kde-frameworks/kcoreaddons-${PVCUT}*:5
-       =kde-frameworks/kwindowsystem-${PVCUT}*:5[X=]
+       =kde-frameworks/kwindowsystem-${PVCUT}*:5[X?]
        dbus? ( dev-libs/libdbusmenu-qt[qt5(+)] )
        !phonon? ( media-libs/libcanberra )
        phonon? ( >=media-libs/phonon-4.11.0 )
@@ -34,9 +35,9 @@ RDEPEND="
 DEPEND="${RDEPEND}
        X? ( x11-base/xorg-proto )
 "
-BDEPEND="
-       nls? ( >=dev-qt/linguist-tools-${QTMIN}:5 )
-"
+BDEPEND="nls? ( >=dev-qt/linguist-tools-${QTMIN}:5 )"
+
+PATCHES=( "${FILESDIR}/${P}-without_x11.patch" )
 
 src_configure() {
        local mycmakeargs=(
@@ -44,7 +45,7 @@ src_configure() {
                $(cmake_use_find_package !phonon Canberra)
                $(cmake_use_find_package qml Qt5Qml)
                $(cmake_use_find_package speech Qt5TextToSpeech)
-               $(cmake_use_find_package X X11)
+               -DWITHOUT_X11=$(usex !X)
        )
 
        ecm_src_configure

Reply via email to