commit 51f9e99d1d4b362a19683f88c135baa8e3dfe47b
Author: Vitaly Zaitsev <vitaly(a)easycoding.org>
Date: Thu Jan 20 11:15:28 2022 +0100
Always use packaged kwayland stuff.
telegram-desktop-desktop-validation-fix.patch | 17 +++++
telegram-desktop-downgrade-ecm-version.patch | 13 ++++
telegram-desktop-unbundled-kwayland-stuff.patch | 86 +++++++++++++++++++++++++
telegram-desktop.spec | 22 +++----
4 files changed, 127 insertions(+), 11 deletions(-)
---
diff --git a/telegram-desktop-desktop-validation-fix.patch
b/telegram-desktop-desktop-validation-fix.patch
new file mode 100644
index 0000000..aaca23b
--- /dev/null
+++ b/telegram-desktop-desktop-validation-fix.patch
@@ -0,0 +1,17 @@
+--- a/lib/xdg/telegramdesktop.desktop
++++ b/lib/xdg/telegramdesktop.desktop
+@@ -1,5 +1,5 @@
+ [Desktop Entry]
+-Version=1.5
++Version=1.0
+ Name=Telegram Desktop
+ Comment=Official desktop version of Telegram messaging app
+ TryExec=telegram-desktop
+@@ -12,7 +12,6 @@ Categories=Chat;Network;InstantMessaging;Qt;
+ MimeType=x-scheme-handler/tg;
+ Keywords=tg;chat;im;messaging;messenger;sms;tdesktop;
+ Actions=Quit;
+-SingleMainWindow=true
+ X-GNOME-UsesNotifications=true
+ X-GNOME-SingleWindow=true
+
diff --git a/telegram-desktop-downgrade-ecm-version.patch
b/telegram-desktop-downgrade-ecm-version.patch
new file mode 100644
index 0000000..c786b59
--- /dev/null
+++ b/telegram-desktop-downgrade-ecm-version.patch
@@ -0,0 +1,13 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 3ce9c88..63d652c 100644
+--- a/Telegram/ThirdParty/kwayland/CMakeLists.txt
++++ b/Telegram/ThirdParty/kwayland/CMakeLists.txt
+@@ -5,7 +5,7 @@ project(KWayland VERSION ${KF_VERSION})
+
+ # ECM setup
+ include(FeatureSummary)
+-find_package(ECM 5.90.0 NO_MODULE)
++find_package(ECM 5.89.0 NO_MODULE)
+ set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake
Modules." URL "https://commits.kde.org/extra-cmake-modules")
+ feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES)
+ set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/Modules)
diff --git a/telegram-desktop-unbundled-kwayland-stuff.patch
b/telegram-desktop-unbundled-kwayland-stuff.patch
new file mode 100644
index 0000000..0a141c8
--- /dev/null
+++ b/telegram-desktop-unbundled-kwayland-stuff.patch
@@ -0,0 +1,86 @@
+--- a/cmake/external/kwayland/CMakeLists.txt
++++ b/cmake/external/kwayland/CMakeLists.txt
+@@ -20,62 +20,6 @@ add_library(external_kwayland_bundled STATIC IMPORTED)
+
+ include(ExternalProject)
+
+-ExternalProject_Add(extra-cmake-modules
+- URL ${third_party_loc}/extra-cmake-modules
+- CMAKE_GENERATOR Ninja
+- CMAKE_ARGS
+- -DCMAKE_BUILD_TYPE=Release
+- -DCMAKE_INSTALL_PREFIX=<BINARY_DIR>
+- -DCMAKE_INSTALL_DATADIR=share
+- -DBUILD_TESTING=OFF
+- BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR>
+- COMMAND ${CMAKE_COMMAND} --install <BINARY_DIR>
+- STEP_TARGETS build
+- EXCLUDE_FROM_ALL TRUE
+- BUILD_BYPRODUCTS <BINARY_DIR>/share/ECM/cmake/ECMConfig.cmake
+-)
+-
+-ExternalProject_Get_property(extra-cmake-modules BINARY_DIR)
+-set(extra_cmake_modules_binary_dir ${BINARY_DIR})
+-
+-ExternalProject_Add(wayland-protocols
+- URL ${third_party_loc}/wayland-protocols
+- CONFIGURE_COMMAND meson
+- --prefix=<BINARY_DIR>
+- --libdir=lib
+- --buildtype=release
+- -Dtests=false
+- <BINARY_DIR> <SOURCE_DIR>
+- BUILD_COMMAND meson compile -C <BINARY_DIR>
+- COMMAND meson install -C <BINARY_DIR>
+- STEP_TARGETS build
+- EXCLUDE_FROM_ALL TRUE
+- BUILD_BYPRODUCTS <BINARY_DIR>/lib/wayland-protocols.pc
+-)
+-
+-ExternalProject_Get_property(wayland-protocols BINARY_DIR)
+-set(wayland_protocols_binary_dir ${BINARY_DIR})
+-
+-ExternalProject_Add(plasma-wayland-protocols
+- URL ${third_party_loc}/plasma-wayland-protocols
+- CMAKE_GENERATOR Ninja
+- CMAKE_ARGS
+- -DCMAKE_BUILD_TYPE=Release
+- -DCMAKE_INSTALL_PREFIX=<BINARY_DIR>
+- -DCMAKE_INSTALL_LIBDIR=lib
+- -DECM_DIR=${extra_cmake_modules_binary_dir}/share/ECM/cmake
+- BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR>
+- COMMAND ${CMAKE_COMMAND} --install <BINARY_DIR>
+- STEP_TARGETS build
+- EXCLUDE_FROM_ALL TRUE
+- BUILD_BYPRODUCTS
<BINARY_DIR>/lib/cmake/PlasmaWaylandProtocols/PlasmaWaylandProtocolsConfig.cmake
+-)
+-
+-ExternalProject_Add_StepDependencies(plasma-wayland-protocols configure
extra-cmake-modules-build)
+-
+-ExternalProject_Get_property(plasma-wayland-protocols BINARY_DIR)
+-set(plasma_wayland_protocols_binary_dir ${BINARY_DIR})
+-
+ set(kwayland_patch_command)
+ if (DESKTOP_APP_QT6)
+ set(kwayland_patch_command PATCH_COMMAND patch -p1 <
${CMAKE_CURRENT_SOURCE_DIR}/kwayland-qt6.patch)
+@@ -88,9 +32,6 @@ ExternalProject_Add(kwayland
+ -DCMAKE_BUILD_TYPE=Release
+ -DBUILD_SHARED_LIBS=OFF
+ -DBUILD_TESTING=OFF
+- -DCMAKE_PREFIX_PATH=${wayland_protocols_binary_dir}
+- -DECM_DIR=${extra_cmake_modules_binary_dir}/share/ECM/cmake
+-
-DPlasmaWaylandProtocols_DIR=${plasma_wayland_protocols_binary_dir}/lib/cmake/PlasmaWaylandProtocols
+ ${kwayland_patch_command}
+ BUILD_COMMAND ${CMAKE_COMMAND} --build <BINARY_DIR> --target KF5WaylandClient
+ STEP_TARGETS build
+@@ -98,9 +39,6 @@ ExternalProject_Add(kwayland
+ BUILD_BYPRODUCTS <BINARY_DIR>/lib/libKF5WaylandClient.a
+ )
+
+-ExternalProject_Add_StepDependencies(kwayland configure extra-cmake-modules-build)
+-ExternalProject_Add_StepDependencies(kwayland configure wayland-protocols-build)
+-ExternalProject_Add_StepDependencies(kwayland configure plasma-wayland-protocols-build)
+
+ ExternalProject_Get_property(kwayland SOURCE_DIR)
+ ExternalProject_Get_property(kwayland BINARY_DIR)
+
diff --git a/telegram-desktop.spec b/telegram-desktop.spec
index 845d9a8..78ea303 100644
--- a/telegram-desktop.spec
+++ b/telegram-desktop.spec
@@ -37,6 +37,11 @@ URL:
https://github.com/telegramdesktop/%{appname}
Summary: Telegram Desktop official messaging app
Source0: %{url}/releases/download/v%{version}/%{appname}-%{version}-full.tar.gz
+# Downstream patches.
+Patch0: %{name}-desktop-validation-fix.patch
+Patch1: %{name}-unbundled-kwayland-stuff.patch
+Patch2: %{name}-downgrade-ecm-version.patch
+
# Telegram Desktop require more than 8 GB of RAM on linking stage.
# Disabling all low-memory architectures.
ExclusiveArch: x86_64 aarch64
@@ -133,19 +138,17 @@ Provides: bundled(rlottie) = 0~git
BuildRequires: cmake(KF5Wayland)
BuildRequires: cmake(Qt5Concurrent)
BuildRequires: cmake(Qt5WaylandClient)
-BuildRequires: extra-cmake-modules
BuildRequires: qt5-qtbase-static
%else
+BuildRequires: cmake(PlasmaWaylandProtocols)
BuildRequires: cmake(Qt6Concurrent)
BuildRequires: cmake(Qt6WaylandClient)
-BuildRequires: meson
+BuildRequires: pkgconfig(wayland-protocols)
BuildRequires: qt6-qtbase-static
-Provides: bundled(extra-cmake-modules) = 5.90.0
-Provides: bundled(kf5-kwayland) = 5.90.0
-Provides: bundled(plasma-wayland-protocols) = 1.6.0
-Provides: bundled(wayland-protocols) = 1.24
+Provides: bundled(kf5-kwayland) = 5.89.0
%endif
BuildRequires: pkgconfig(wayland-client)
+BuildRequires: extra-cmake-modules
%endif
%if %{enable_x11}
@@ -190,11 +193,11 @@ business messaging needs.
%autosetup -n %{appname}-%{version}-full -p1
# Unbundling libraries...
-rm -rf
Telegram/ThirdParty/{GSL,QR,SPMediaKeyTap,dispatch,expected,fcitx-qt5,fcitx5-qt,jemalloc,hime,hunspell,lz4,materialdecoration,minizip,nimf,qt5ct,range-v3,xxHash}
+rm -rf
Telegram/ThirdParty/{GSL,QR,SPMediaKeyTap,dispatch,expected,extra-cmake-modules,fcitx-qt5,fcitx5-qt,jemalloc,hime,hunspell,lz4,materialdecoration,minizip,nimf,plasma-wayland-protocols,qt5ct,range-v3,wayland-protocols,xxHash}
# Unbundling kwayland and libdbusmenu-qt if build against Qt5...
%if %{use_qt5}
-rm -rf
Telegram/ThirdParty/{extra-cmake-modules,kwayland,plasma-wayland-protocols,libdbusmenu-qt,wayland-protocols}
+rm -rf Telegram/ThirdParty/{kwayland,libdbusmenu-qt}
%endif
# Unbundling rlottie if build against packaged version...
@@ -207,9 +210,6 @@ rm -rf Telegram/ThirdParty/rlottie
rm -rf Telegram/ThirdParty/libtgvoip
%endif
-# Patching metainfo file to pass automatic checks...
-sed -e 's/Version=1.5/Version=1.0/g' -e '/SingleMainWindow/d' -i
lib/xdg/telegramdesktop.desktop
-
%build
# Building Telegram Desktop using cmake...
%cmake -G Ninja \