diff mbox series

[bug#57675,v9,RECURSIVE,CLONE,8/9] gnu: telegram-desktop: Update to 4.2.0.

Message ID y76edw45ebm.wl-hako@ultrarare.space
State Accepted
Headers show
Series gnu: telegram-desktop: Update to 4.2.0. | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git-branch success View Git branch
cbaines/applying patch success View Laminar job
cbaines/issue success View issue

Commit Message

Hilton Chain Sept. 22, 2022, 2:32 a.m. UTC
* gnu/packages/patches/telegram-desktop-allow-disable-libtgvoip.patch: New
file.
* gnu/local.mk (dist_patch_DATA): Add patch.
* gnu/packages/telegram.scm (dispatch-for-telegram-desktop): New variable.
(tgcalls-for-telegram-desktop): Bump to submodule checkout.
(rlottie-for-telegram-desktop): Bump to submodule checkout.
[snippet]: Switch off werror.
[arguments]: Use inherited ones.
(telegram-desktop): Update to 4.2.0.
[patches]: Add telegram-desktop-allow-disable-libtgvoip.patch.
[arguments]<#:configure-flags>: Unbundle rlottie.
<#:phases>: Adjusted according to unbundled package.
[native-inputs]: Add clang-toolchain.
Remove cmake-shared, extra-cmake-modules and qttools-5.
[inputs]: Replace qtbase-5 with qtbase.
Add abseil-cpp-cxxstd17, kcoreaddons, libvpx, qt5compat, wayland, webkitgtk.
Remove catch2, fcitx-qt5, fcitx5-qt, gtk+, hime, kwayland, libdbusmenu-qt,
libtgvoip-for-telegram-desktop, libx11, materialdecoration, nimf and qt5ct.
[propagated-inputs]: Remove dconf.
[license]: Adjusted accordingly.
---
 gnu/local.mk                                  |   1 +
 ...gram-desktop-allow-disable-libtgvoip.patch | 125 ++++++++++++++++
 gnu/packages/telegram.scm                     | 138 +++++++++---------
 3 files changed, 199 insertions(+), 65 deletions(-)
 create mode 100644 gnu/packages/patches/telegram-desktop-allow-disable-libtgvoip.patch
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 10ee65fdd5..e8d0178293 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1871,6 +1871,7 @@  dist_patch_DATA =						\
   %D%/packages/patches/teensy-loader-cli-help.patch		\
   %D%/packages/patches/tensorflow-c-api-fix.patch		\
   %D%/packages/patches/texinfo-5-perl-compat.patch		\
+  %D%/packages/patches/telegram-desktop-allow-disable-libtgvoip.patch   \
   %D%/packages/patches/telegram-purple-adjust-test.patch	\
   %D%/packages/patches/texi2html-document-encoding.patch	\
   %D%/packages/patches/texi2html-i18n.patch			\
diff --git a/gnu/packages/patches/telegram-desktop-allow-disable-libtgvoip.patch b/gnu/packages/patches/telegram-desktop-allow-disable-libtgvoip.patch
new file mode 100644
index 0000000000..3c062cbd9a
--- /dev/null
+++ b/gnu/packages/patches/telegram-desktop-allow-disable-libtgvoip.patch
@@ -0,0 +1,125 @@ 
+From 4d1a8351ee82728912fcf7ad0070049b2910c393 Mon Sep 17 00:00:00 2001
+From: Klemens Nanni <klemens@posteo.de>
+Date: Wed, 2 Mar 2022 01:07:48 +0100
+Subject: [PATCH] Introduce TDESKTOP_DISABLE_LEGACY_TGVOIP
+
+Originally from Alt Linux[0], OpenBSD has so far adapted the removal of
+tgvoip in the official net/tdesktop build.
+
+tgcalls provides everything needed for calls;  audio/video/desktop
+sharing calls have been working fine across different operating systems
+and telegram desktop/mobile versions without problems.
+
+0: http://www.sisyphus.ru/cgi-bin/srpm.pl/Sisyphus/telegram-desktop/getpatch/1
+---
+ Telegram/CMakeLists.txt                   | 6 +++---
+ Telegram/SourceFiles/calls/calls_call.cpp | 6 ++++++
+ Telegram/cmake/lib_tgcalls.cmake          | 4 ++++
+ Telegram/cmake/telegram_options.cmake     | 8 ++++++++
+ 4 files changed, 21 insertions(+), 3 deletions(-)
+
+diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt
+index fb2bf370f..5d9578f2d 100644
+--- a/Telegram/CMakeLists.txt
++++ b/Telegram/CMakeLists.txt
+@@ -28,7 +28,9 @@ get_filename_component(res_loc Resources REALPATH)
+ include(cmake/telegram_options.cmake)
+ include(cmake/lib_ffmpeg.cmake)
+ include(cmake/lib_stripe.cmake)
+-include(cmake/lib_tgvoip.cmake)
++if (NOT TDESKTOP_DISABLE_LEGACY_TGVOIP)
++    include(cmake/lib_tgvoip.cmake)
++endif()
+ include(cmake/lib_tgcalls.cmake)
+ include(cmake/td_export.cmake)
+ include(cmake/td_mtproto.cmake)
+@@ -52,9 +54,7 @@ target_prepare_qrc(Telegram)
+ 
+ target_link_libraries(Telegram
+ PRIVATE
+-    tdesktop::lib_tgcalls_legacy
+     tdesktop::lib_tgcalls
+-    tdesktop::lib_tgvoip
+ 
+     # Order in this list defines the order of include paths in command line.
+     # We need to place desktop-app::external_minizip this early to have its
+diff --git a/Telegram/SourceFiles/calls/calls_call.cpp b/Telegram/SourceFiles/calls/calls_call.cpp
+index 6894d5d90..cd03620e7 100644
+--- a/Telegram/SourceFiles/calls/calls_call.cpp
++++ b/Telegram/SourceFiles/calls/calls_call.cpp
+@@ -39,8 +39,10 @@ class InstanceImpl;
+ class InstanceV2Impl;
+ class InstanceV2ReferenceImpl;
+ class InstanceV2_4_0_0Impl;
++#ifndef TDESKTOP_DISABLE_LEGACY_TGVOIP
+ class InstanceImplLegacy;
+ void SetLegacyGlobalServerConfig(const std::string &serverConfig);
++#endif
+ } // namespace tgcalls
+ 
+ namespace Calls {
+@@ -56,7 +58,9 @@ const auto Register = tgcalls::Register<tgcalls::InstanceImpl>();
+ const auto RegisterV2 = tgcalls::Register<tgcalls::InstanceV2Impl>();
+ const auto RegV2Ref = tgcalls::Register<tgcalls::InstanceV2ReferenceImpl>();
+ const auto RegisterV240 = tgcalls::Register<tgcalls::InstanceV2_4_0_0Impl>();
++#ifndef TDESKTOP_DISABLE_LEGACY_TGVOIP
+ const auto RegisterLegacy = tgcalls::Register<tgcalls::InstanceImplLegacy>();
++#endif
+ 
+ [[nodiscard]] base::flat_set<int64> CollectEndpointIds(
+ 		const QVector<MTPPhoneConnection> &list) {
+@@ -1322,7 +1326,9 @@ Call::~Call() {
+ }
+ 
+ void UpdateConfig(const std::string &data) {
++#ifndef TDESKTOP_DISABLE_LEGACY_TGVOIP
+ 	tgcalls::SetLegacyGlobalServerConfig(data);
++#endif
+ }
+ 
+ } // namespace Calls
+diff --git a/Telegram/cmake/lib_tgcalls.cmake b/Telegram/cmake/lib_tgcalls.cmake
+index 34a5ba418..8a784be2c 100644
+--- a/Telegram/cmake/lib_tgcalls.cmake
++++ b/Telegram/cmake/lib_tgcalls.cmake
+@@ -267,6 +267,10 @@ PRIVATE
+     ${tgcalls_loc}
+ )
+ 
++if (TDESKTOP_DISABLE_LEGACY_TGVOIP)
++    return()
++endif()
++
+ add_library(lib_tgcalls_legacy STATIC)
+ init_target(lib_tgcalls_legacy)
+ 
+diff --git a/Telegram/cmake/telegram_options.cmake b/Telegram/cmake/telegram_options.cmake
+index 1c3c25431..033f2bc95 100644
+--- a/Telegram/cmake/telegram_options.cmake
++++ b/Telegram/cmake/telegram_options.cmake
+@@ -4,7 +4,9 @@
+ # For license and copyright information please follow this link:
+ # https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
+ 
++option(TDESKTOP_DISABLE_LEGACY_TGVOIP "Disable legacy tgvoip support." OFF)
+ option(TDESKTOP_API_TEST "Use test API credentials." OFF)
++
+ set(TDESKTOP_API_ID "0" CACHE STRING "Provide 'api_id' for the Telegram API access.")
+ set(TDESKTOP_API_HASH "" CACHE STRING "Provide 'api_hash' for the Telegram API access.")
+ 
+@@ -40,6 +42,12 @@ if (TDESKTOP_API_ID STREQUAL "0" OR TDESKTOP_API_HASH STREQUAL "")
+     " ")
+ endif()
+ 
++if (TDESKTOP_DISABLE_LEGACY_TGVOIP)
++    target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_LEGACY_TGVOIP)
++else()
++    target_link_libraries(Telegram PRIVATE tdesktop::lib_tgcalls_legacy tdesktop::lib_tgvoip)
++endif()
++
+ if (DESKTOP_APP_DISABLE_SPELLCHECK)
+     target_compile_definitions(Telegram PRIVATE TDESKTOP_DISABLE_SPELLCHECK)
+ else()
+-- 
+2.37.3
+
diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index fc0b50e1c1..85108c4278 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -1,5 +1,6 @@ 
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
+;;; Copyright © 2022 Hilton Chain <hako@ultrarare.space>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -43,6 +44,7 @@  (define-module (gnu packages telegram)
   #:use-module (gnu packages libevent)
   #:use-module (gnu packages libreoffice)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages llvm)
   #:use-module (gnu packages lxqt)
   #:use-module (gnu packages lua)
   #:use-module (gnu packages perl)
@@ -60,6 +62,7 @@  (define-module (gnu packages telegram)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages video)
   #:use-module (gnu packages web)
+  #:use-module (gnu packages webkit)
   #:use-module (gnu packages xdisorg)
   #:use-module (gnu packages xiph)
   #:use-module (gnu packages xorg)
@@ -105,9 +108,24 @@  (define crc32c-for-telegram-desktop
        (base32
         "0cddf8z7v33gfb2k60lkzwa97g20m1v81cnvllm3q9ylpnx8g6f4")))))
 
+(define dispatch-for-telegram-desktop
+  (let ((commit "ecc678d79f38cf63d24b6d16e18f69a9117d8d73")
+        (revision "14"))
+    (origin
+      (method git-fetch)
+      (uri (git-reference
+            (url "https://github.com/apple/swift-corelibs-libdispatch.git")
+            (commit commit)))
+      (file-name
+       (git-file-name
+        "dispatch-for-telegram-desktop" (git-version "5.6" revision commit)))
+      (sha256
+       (base32
+        "0hy4q6x3bgphazmpl3v62995abc9fpi8y7yg9aiblzsqkxmgjmqn")))))
+
 (define tgcalls-for-telegram-desktop
-  (let ((commit "81e97fa52e25b7775b62ce07bb653533d81e91b3")
-        (revision "738"))
+  (let ((commit "82c4921045c440b727c38e464f3a0539708423ff")
+        (revision "921"))
     (origin
       (method git-fetch)
       (uri (git-reference
@@ -118,7 +136,7 @@  (define tgcalls-for-telegram-desktop
                   (git-version "0" revision commit)))
       (sha256
        (base32
-        "0fvad87hyxli83xn19mgf8jjrrh6y6iaig14pckpbkg33vf4wqkj")))))
+        "1109r17abh66yz91b65fn2g4ryfybnsr5g6075sjhbah1gccv9mk")))))
 
 (define-public webrtc-for-telegram-desktop
   (let ((commit "621f3da55331733bf0d1b223786b96b68c03dca1")
@@ -213,8 +231,8 @@  (define-public webrtc-for-telegram-desktop
          license:bsd-3))))))
 
 (define-public rlottie-for-telegram-desktop
-  (let ((commit "cbd43984ebdf783e94c8303c41385bf82aa36d5b")
-        (revision "671"))
+  (let ((commit "8c69fc20cf2e150db304311f1233a4b55a8892d7")
+        (revision "678"))
     (hidden-package
      (package
        (inherit rlottie)
@@ -230,21 +248,12 @@  (define-public rlottie-for-telegram-desktop
           (file-name
            (git-file-name "rlottie-for-telegram-desktop" version))
           (sha256
-           (base32 "1lxpbgbhps9rmck036mgmiknqrzpjxpas8n7qxykv6pwzn0c8n0c"))))
-       (arguments
-        `(#:configure-flags
-          (list
-           "-Dlog=true"
-           "-Ddumptree=true"
-           "-Dtest=true")
-          #:phases
-          (modify-phases %standard-phases
-            (add-after 'unpack 'patch-cxx-flags
-              (lambda _
-                (substitute* "meson.build"
-                  (("werror=true")
-                   "werror=false"))
-                #t)))))))))
+           (base32 "14gwg3sn6xdx9ymnx5r0vfm4pk8dwk92s10a1wdvfbjpyrxll64i"))
+          (modules '((guix build utils)))
+          (snippet
+           #~(begin
+               (substitute* "meson.build"
+                 (("werror=true") "werror=false"))))))))))
 
 (define-public libtgvoip-for-telegram-desktop
   (let ((commit "13a5fcb16b04472d808ce122abd695dbf5d206cd")
@@ -290,7 +299,7 @@  (define-public libtgvoip-for-telegram-desktop
 (define-public telegram-desktop
   (package
     (name "telegram-desktop")
-    (version "2.9.3")
+    (version "4.2.0")
     (source
      (origin
        (method git-fetch)
@@ -301,15 +310,19 @@  (define-public telegram-desktop
        (file-name
         (git-file-name name version))
        (sha256
-        (base32 "07mw09gmxy2pcga856wbsqmbgl2l5a3ix0hr5p6hlvk7pq260s36"))
+        (base32 "1wpqn79pbarz48kmrh6gciw4a9y5hiki5qczlvj8smvx9is6yrf8"))
+       (patches
+        (search-patches
+         ;; https://github.com/telegramdesktop/tdesktop/pull/24126
+         "telegram-desktop-allow-disable-libtgvoip.patch"))
        (modules '((guix build utils)
                   (ice-9 ftw)
                   (srfi srfi-1)))
        (snippet
         #~(begin
             (let ((keep
-                   '( ;; Not available in Guix.
-                     "SPMediaKeyTap" "statusnotifieritem" "tgcalls")))
+                   '(;; Not available in Guix.
+                     "dispatch" "tgcalls")))
               (with-directory-excursion "Telegram/ThirdParty"
                 (for-each delete-file-recursively
                           (lset-difference string=?
@@ -335,88 +348,83 @@  (define-public telegram-desktop
               ;; also stored in <#$source/snap/snapcraft.yaml>.
               "-DTDESKTOP_API_ID=611335"
               "-DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c"
-              ;; Disable WebkitGTK support as it fails to link
-              "-DDESKTOP_APP_DISABLE_WEBKITGTK=ON"
-              ;; Use bundled fonts as fallback.
-              "-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF")
+              "-DTDESKTOP_DISABLE_LEGACY_TGVOIP=ON"
+              "-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON"
+              "-DDESKTOP_APP_DISABLE_AUTOUPDATE=ON"
+              "-DDESKTOP_APP_USE_PACKAGED_RLOTTIE=ON"
+              (string-append "-DTDESKTOP_LAUTCHER_BASENAME=" #$name))
            #:phases
            #~(modify-phases %standard-phases
                (add-after 'unpack 'make-writable
                  (lambda _
                    (for-each make-file-writable (find-files "."))))
-               (add-after 'make-writable 'copy-inputs
+               (add-after 'make-writable 'copy-sources
                  (lambda _
                    (for-each
                     (match-lambda
                       ((dst src)
                        (copy-recursively src dst)
                        (for-each make-file-writable (find-files dst))))
-                    '(("Telegram/ThirdParty/tgcalls" #$tgcalls-for-telegram-desktop)))))
-               (add-before 'configure 'patch-cxx-flags
-                 (lambda _
-                   (substitute* "cmake/options_linux.cmake" (("class-memaccess") "all"))))
+                    '(("Telegram/ThirdParty/dispatch" #$dispatch-for-telegram-desktop)
+                      ("Telegram/ThirdParty/tgcalls" #$tgcalls-for-telegram-desktop)))))
                (add-after 'install 'glib-or-gtk-compile-schemas
                  (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
                (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
                  (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
     (native-inputs
-     (list cmake-shared
-           extra-cmake-modules
-           `(,glib "bin")
+     (list `(,glib "bin")
            `(,gtk+ "bin")
+           clang-toolchain
            pkg-config
-           python-wrapper
-           qttools-5))
+           python-wrapper))
     (inputs
-     (list alsa-lib
+     (list abseil-cpp-cxxstd17
+           alsa-lib
            c++-gsl
-           catch2
-           libexpected
-           fcitx-qt5
-           fcitx5-qt
            ffmpeg
-           glib
-           glibmm-2.64
-           gtk+
-           hime
-           hunspell
            jemalloc
-           kwayland
-           libdbusmenu-qt
+           kcoreaddons
+           libexpected
            libjpeg-turbo
-           libtgvoip-for-telegram-desktop
-           lz4
-           materialdecoration
+           libvpx
            minizip
-           nimf
            openal
            openssl
            opus
            pulseaudio
            qrcodegen-cpp
-           qtbase-5
-           qtsvg-5
-           qt5ct
+           qt5compat
+           qtbase
            qtimageformats
-           qtwayland
+           qtsvg-5
            range-v3
            rlottie-for-telegram-desktop
            rnnoise
            webrtc-for-telegram-desktop
-           libx11
-           libxcb
-           xcb-util-keysyms
            xxhash
-           zlib))
-    (propagated-inputs (list dconf))
+           zlib
+           ;; DESKTOP_APP_DISABLE_DBUS_INTEGRATION
+           glibmm-2.64
+           ;; DESKTOP_APP_DISABLE_SPELLCHECK
+           hunspell
+           ;; DESKTOP_APP_LOTTIE_USE_CACHE
+           lz4
+           ;; DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION
+           qtwayland wayland
+           ;; DESKTOP_APP_DISABLE_X11_INTEGRATION
+           libxcb xcb-util-keysyms
+           ;; Optional
+           webkitgtk))
     (synopsis "Telegram Desktop")
     (description "Telegram desktop is the official desktop version of the
 Telegram instant messenger.")
     (home-page "https://desktop.telegram.org/")
     (license
      (list
-      ;; ThirdParty
-      license:lgpl2.1+
+      ;; Telegram/ThirdParty/dispatch
+      license:asl2.0
+      ;; Telegram/ThirdParty/tgcalls
+      license:lgpl3
       ;; Others
       license:gpl3+))))