From bb380e5977be982aa76428ba052632036cd51d32 Mon Sep 17 00:00:00 2001 From: Dima Panov Date: Thu, 28 Sep 2023 18:43:15 +0300 Subject: [PATCH] net-im/telegram-desktop: update to 4.9.8 release * Backport webview patches from upstream * Fix build with qt5, required #include is still provided by QtServiceSupport module but moved to QtGui in Qt6 PR: 274143 --- net-im/telegram-desktop/Makefile | 7 ++- net-im/telegram-desktop/distinfo | 6 +-- ...tform_linux_webview__linux__compositor.cpp | 14 ++++++ ...atform_linux_webview__linux__webkitgtk.cpp | 48 +++++++++++++++++++ .../patch-cmake_external_qt_CMakeLists.txt | 44 +++++++++++++++++ .../patch-cmake_external_qt_package.cmake | 11 +++++ 6 files changed, 123 insertions(+), 7 deletions(-) create mode 100644 net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__compositor.cpp create mode 100644 net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkitgtk.cpp create mode 100644 net-im/telegram-desktop/files/patch-cmake_external_qt_CMakeLists.txt create mode 100644 net-im/telegram-desktop/files/patch-cmake_external_qt_package.cmake diff --git a/net-im/telegram-desktop/Makefile b/net-im/telegram-desktop/Makefile index 83722a3781024..d104f840c0a7c 100644 --- a/net-im/telegram-desktop/Makefile +++ b/net-im/telegram-desktop/Makefile @@ -1,6 +1,5 @@ PORTNAME= telegram-desktop -DISTVERSION= 4.9.3 -PORTREVISION= 1 +DISTVERSION= 4.9.8 CATEGORIES= net-im MASTER_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/releases/download/v${DISTVERSION}/ DISTNAME= tdesktop-${DISTVERSION}-full @@ -60,7 +59,7 @@ GH_PROJECT= tdesktop .if ${FLAVOR} == qt5 USES+= kde:5 qt:5 -USE_QT= buildtools:build core dbus gui imageformats network qmake:build \ +USE_QT= buildtools:build core dbus declarative gui imageformats network qmake:build \ svg wayland widgets USE_KDE= coreaddons kimageformats .else @@ -106,7 +105,7 @@ TELEGRAM_API_ID= 601761 .include .if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400000 && ${OSVERSION} < 1400079 -USES+= llvm:build +USES+= llvm:max=15,build .else USES+= compiler:c++20-lang .endif diff --git a/net-im/telegram-desktop/distinfo b/net-im/telegram-desktop/distinfo index ee9cbae152359..69c861bf77d04 100644 --- a/net-im/telegram-desktop/distinfo +++ b/net-im/telegram-desktop/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1695648456 -SHA256 (tdesktop-4.9.3-full.tar.gz) = 2ef462651d397d807576f5df3a5d3de2764accf8d155a0b4d576a354a614d107 -SIZE (tdesktop-4.9.3-full.tar.gz) = 69517868 +TIMESTAMP = 1695904525 +SHA256 (tdesktop-4.9.8-full.tar.gz) = af041ecb623ee7603781e0ff2b262e15bb8de2858a9a42982a10396bc9014d53 +SIZE (tdesktop-4.9.8-full.tar.gz) = 73655253 diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__compositor.cpp b/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__compositor.cpp new file mode 100644 index 0000000000000..c46fa3c116347 --- /dev/null +++ b/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__compositor.cpp @@ -0,0 +1,14 @@ +--- Telegram/lib_webview/webview/platform/linux/webview_linux_compositor.cpp.orig 2023-09-22 07:01:01 UTC ++++ Telegram/lib_webview/webview/platform/linux/webview_linux_compositor.cpp +@@ -199,8 +199,9 @@ Compositor::Compositor() + const auto output = new Output(this, xdgSurface); + + output->chrome().surfaceCompleted() | rpl::start_with_next([=] { +- const auto parent = qvariant_cast( +- popup->parentXdgSurface()->property("output"))->window(); ++ const auto parent = (*static_cast( ++ popup->parentXdgSurface()->property("output").constData() ++ ))->window(); + if (_private->widget + && parent == _private->widget->quickWindow()) { + output->window()->setTransientParent( diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkitgtk.cpp b/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkitgtk.cpp new file mode 100644 index 0000000000000..3a97b98103f6f --- /dev/null +++ b/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkitgtk.cpp @@ -0,0 +1,48 @@ +--- Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk.cpp.orig 2023-09-22 07:01:01 UTC ++++ Telegram/lib_webview/webview/platform/linux/webview_linux_webkitgtk.cpp +@@ -33,6 +33,13 @@ constexpr auto kHelperObjectPath = "/org/desktop_app/G + constexpr auto kMasterObjectPath = "/org/desktop_app/GtkIntegration/Webview/Master"; + constexpr auto kHelperObjectPath = "/org/desktop_app/GtkIntegration/Webview/Helper"; + ++void (* const SetGraphicsApi)(QSGRendererInterface::GraphicsApi) = ++#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) ++ QQuickWindow::setGraphicsApi; ++#else // Qt >= 6.0.0 ++ QQuickWindow::setSceneGraphBackend; ++#endif // Qt < 6.0.0 ++ + std::string SocketPath; + + inline std::string SocketPathToDBusAddress(const std::string &socketPath) { +@@ -116,12 +123,10 @@ Instance::Instance(bool remoting) + Ui::GL::CheckCapabilities(nullptr)); + switch (backend) { + case Ui::GL::Backend::Raster: +- QQuickWindow::setGraphicsApi( +- QSGRendererInterface::Software); ++ SetGraphicsApi(QSGRendererInterface::Software); + break; + case Ui::GL::Backend::OpenGL: +- QQuickWindow::setGraphicsApi( +- QSGRendererInterface::OpenGL); ++ SetGraphicsApi(QSGRendererInterface::OpenGL); + break; + } + return true; +@@ -637,11 +642,11 @@ void Instance::setOpaqueBg(QColor opaqueBg) { + return; + } + +- GdkRGBA rgba{ +- opaqueBg.redF(), +- opaqueBg.greenF(), +- opaqueBg.blueF(), +- opaqueBg.alphaF(), ++ const GdkRGBA rgba{ ++ float(opaqueBg.redF()), ++ float(opaqueBg.greenF()), ++ float(opaqueBg.blueF()), ++ float(opaqueBg.alphaF()), + }; + webkit_web_view_set_background_color( + WEBKIT_WEB_VIEW(_webview), diff --git a/net-im/telegram-desktop/files/patch-cmake_external_qt_CMakeLists.txt b/net-im/telegram-desktop/files/patch-cmake_external_qt_CMakeLists.txt new file mode 100644 index 0000000000000..3604617e930c0 --- /dev/null +++ b/net-im/telegram-desktop/files/patch-cmake_external_qt_CMakeLists.txt @@ -0,0 +1,44 @@ +--- cmake/external/qt/CMakeLists.txt.orig 2023-09-13 17:06:28 UTC ++++ cmake/external/qt/CMakeLists.txt +@@ -16,6 +16,8 @@ if (DESKTOP_APP_USE_PACKAGED) + Qt::CorePrivate + Qt::Gui + Qt::GuiPrivate ++ $ ++ $ + $ + Qt::Widgets + Qt::WidgetsPrivate +@@ -36,6 +38,7 @@ INTERFACE + ${qt_loc}/include + ${qt_loc}/include/QtCore + ${qt_loc}/include/QtGui ++ $<$:${qt_loc}/include/QtServiceSupport> + $<$:${qt_loc}/include/QtOpenGL> + ${qt_loc}/include/QtWidgets + $<$:${qt_loc}/include/QtOpenGLWidgets> +@@ -46,9 +49,11 @@ INTERFACE + $<$:${qt_loc}/include/QtWaylandCompositor> + ${qt_loc}/include/QtCore/${qt_version} + ${qt_loc}/include/QtGui/${qt_version} ++ ${qt_loc}/include/QtServiceSupport/${qt_version} + ${qt_loc}/include/QtWidgets/${qt_version} + ${qt_loc}/include/QtCore/${qt_version}/QtCore + ${qt_loc}/include/QtGui/${qt_version}/QtGui ++ ${qt_loc}/include/QtServiceSupport/${qt_version}/QtServiceSupport + ${qt_loc}/include/QtWidgets/${qt_version}/QtWidgets + ) + +@@ -92,6 +97,12 @@ set(common_qt_libs + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Gui + lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}Core + ) ++ ++if (TARGET Qt::ServiceSupport) ++ list(PREPEND common_qt_libs ++ lib/${qt_lib_prefix}Qt${QT_VERSION_MAJOR}ServiceSupport ++ ) ++endif() + + if (TARGET Qt::OpenGL) + list(PREPEND common_qt_libs diff --git a/net-im/telegram-desktop/files/patch-cmake_external_qt_package.cmake b/net-im/telegram-desktop/files/patch-cmake_external_qt_package.cmake new file mode 100644 index 0000000000000..9c9fe0c93f1de --- /dev/null +++ b/net-im/telegram-desktop/files/patch-cmake_external_qt_package.cmake @@ -0,0 +1,11 @@ +--- cmake/external/qt/package.cmake.orig 2023-09-13 17:06:28 UTC ++++ cmake/external/qt/package.cmake +@@ -45,6 +45,8 @@ if (QT_VERSION_MAJOR GREATER_EQUAL 6) + set(qt_version_6_5_or_greater 1) + endif() + find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL OpenGLWidgets REQUIRED) ++else() ++ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS ServiceSupport REQUIRED) + endif() + + # QtWaylandScanner cmake integration from Qt 6 is used