Bug 497136

Summary: Kleopatra doesn't build on macOS due to not having Wayland
Product: [Applications] kleopatra Reporter: Valentin Kulesh <leshy>
Component: generalAssignee: Ingo Klöcker <kloecker>
Status: RESOLVED FIXED    
Severity: normal CC: aheinecke, kdepim-bugs, mutz
Priority: NOR    
Version: 4.0.0.241190   
Target Milestone: ---   
Platform: Homebrew (macOS)   
OS: macOS   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Valentin Kulesh 2024-12-06 17:58:07 UTC
SUMMARY
Kleopatra has Wayland specific code guarded by `#ifdef Q_OS_UNIX`, which also matches macOS.
That's why `#include <KWaylandExtras>` is attempted, but such a header doesn't exist on macOS build.
A different kind of guard is required.

A similar solution has been found in KIO.
See: https://invent.kde.org/frameworks/kio/-/blob/c36a98157c7ece4ccaf784b3346460acfac94ccc/CMakeLists.txt#L129

The fix is proposed.
MR: https://invent.kde.org/pim/kleopatra/-/merge_requests/334
Commit: https://invent.kde.org/pim/kleopatra/-/commit/3d7308a7f38a70ab161d6acf621131461a4bb2be

STEPS TO REPRODUCE
1. Setup Homebrew (macOS) environment, all the Kleopatra dependencies are accounted for.
2. Checkout v24.11.90 tag from Kleopatra repository.
2. Do `cmake -S . -B build --install-prefix <prefix>`
3. Do `cmake --build build`

OBSERVED RESULT
Build fails due to missing `KWaylandExtras` header.

EXPECTED RESULT
Build completes.

SOFTWARE/OS VERSIONS
macOS: 15.1
KDE Frameworks Version: 6.8.0 (built from sources myself)
Qt Version: 6.7.3 (Homebrew, from bottle)

ADDITIONAL INFORMATION
The proposed fix is already well tested.
Comment 2 Ingo Klöcker 2024-12-09 20:09:32 UTC
Git commit 15fd4482574fd364610a81f3541acb651f5aa125 by Ingo Klöcker, on behalf of Valentin Kulesh.
Committed on 09/12/2024 at 20:03.
Pushed by kloecker into branch 'release/24.12'.

Fix build on macOS due to not having Wayland (variant 2)

Wayland-specific stuff is guarded by `#ifdef Q_OS_UNIX`,
 which also matches macOS.

Replaced with `#ifdef HAVE_WAYLAND` guard.

The guard is based on `__has_include` feature of C++17.
(cherry picked from commit 31a0953ff5385d077e10296d56a530afd453e9e3)

M  +5    -4    src/mainwindow.cpp

https://invent.kde.org/pim/kleopatra/-/commit/15fd4482574fd364610a81f3541acb651f5aa125