diff mbox series

[bug#57675,v3,5/7] gnu: telegram-desktop: Update to 4.1.1.

Message ID y76bkrm8bjf.wl-hako@ultrarare.space
State Accepted
Headers show
Series gnu: telegram-desktop: Update to 4.1.1. | 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
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. 11, 2022, 10:12 a.m. UTC
* gnu/packages/patches/telegram-desktop-fix-gcc12-cstdint.patch: New file.
* gnu/packages/telegram.scm (telegram-desktop): Update to 4.1.1.
[patches]: Add telegram-desktop-fix-gcc12-cstdint.patch.
[snippet]: Sync with source tree.
Add libtgvoip, rlottie and dispatch.
[arguments]: Use App ID from Telegram's official Snap builds.
Comment out to default configurations.
Drop unneeded phases.
[native-inputs]: Drop cmake-shared, extra-cmake-modules, glib:bin, gtk+:bin
and qttools-5.
[inputs]: Drop libexpected, fcitx-qt5, fcitx5-qt, glib, hime, gtk+, kwayland,
libx11, catch-framework2, materialdecoration, nimf, qt5ct, libdbusmenu-qt,
qtbase-5, libtgvoip-for-telegram-desktop and rlottie-for-telegram-desktop.
Add abseil-cpp-cxxstd17, qt5compat, qtbase, qtwayland, wayland, webkitgtk and
libvpx.
[propageted-inputs]: Drop dconf.
[license]: Sync with source tree.
* gnu/local.mk: Add patch.
---
 gnu/local.mk                                  |   1 +
 .../telegram-desktop-fix-gcc12-cstdint.patch  |  10 +
 gnu/packages/telegram.scm                     | 175 ++++++++++--------
 3 files changed, 105 insertions(+), 81 deletions(-)
 create mode 100644 gnu/packages/patches/telegram-desktop-fix-gcc12-cstdint.patch

--
2.37.3

Comments

Liliana Marie Prikler Sept. 11, 2022, 11:17 a.m. UTC | #1
Am Sonntag, dem 11.09.2022 um 18:12 +0800 schrieb Hilton Chain:
> [arguments]: Use App ID from Telegram's official Snap builds.
This patch should probably be separated from the rest here.  As for the
rest, the same complaints as in v2 apply.

Cheers
diff mbox series

Patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 683f6bfe0d..1247a09a8e 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1868,6 +1868,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-fix-gcc12-cstdint.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-fix-gcc12-cstdint.patch b/gnu/packages/patches/telegram-desktop-fix-gcc12-cstdint.patch
new file mode 100644
index 0000000000..a3d67e0c9a
--- /dev/null
+++ b/gnu/packages/patches/telegram-desktop-fix-gcc12-cstdint.patch
@@ -0,0 +1,10 @@ 
+--- a/Telegram/ThirdParty/tgcalls/tgcalls/utils/gzip.h
++++ b/Telegram/ThirdParty/tgcalls/tgcalls/utils/gzip.h
+@@ -2,6 +2,7 @@
+ #define TGCALLS_UTILS_GZIP_H
+
+ #include <absl/types/optional.h>
++#include <cstdint>
+ #include <vector>
+
+ namespace tgcalls {
diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index cdd3816082..b943b3c4a2 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -1,6 +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.
 ;;;
 ;;; GNU Guix is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@  (define-module (gnu packages telegram)
   #:use-module (gnu packages compression)
   #:use-module (gnu packages cpp)
   #:use-module (gnu packages digest)
+  #:use-module (gnu packages enchant)
   #:use-module (gnu packages fcitx)
   #:use-module (gnu packages fcitx5)
   #:use-module (gnu packages freedesktop)
@@ -60,6 +61,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)
@@ -258,7 +260,7 @@  (define-public libtgvoip-for-telegram-desktop
 (define-public telegram-desktop
   (package
     (name "telegram-desktop")
-    (version "2.9.3")
+    (version "4.1.1")
     (source
      (origin
        (method git-fetch)
@@ -269,16 +271,25 @@  (define-public telegram-desktop
          (recursive? #t)))
        (file-name
         (git-file-name name version))
+       (patches
+        (search-patches
+         ;; Cherry-picked from upstream, remove when bumping.
+         "telegram-desktop-fix-gcc12-cstdint.patch"))
        (sha256
-        (base32 "07mw09gmxy2pcga856wbsqmbgl2l5a3ix0hr5p6hlvk7pq260s36"))
+        (base32 "0b8nwimks6hfnb3bqik8d4s9z689hhj4p9ykqgc36pmpr54nyma8"))
        (modules '((guix build utils)
                   (ice-9 ftw)
                   (srfi srfi-1)))
        (snippet
         `(begin
            (let ((keep
-                  '( ;; Not available in Guix.
-                    "SPMediaKeyTap" "statusnotifieritem" "tgcalls")))
+                  '(;; Own fork, legacy library only used for backward
+                    ;; compatibility.
+                    "libtgvoip"
+                    ;; Own fork with custom API.
+                    "rlottie"
+                    ;; Not available in Guix.
+                    "dispatch" "tgcalls")))
              (with-directory-excursion "Telegram/ThirdParty"
                (for-each delete-file-recursively
                          (lset-difference string=?
@@ -286,102 +297,104 @@  (define-public telegram-desktop
                                           (cons* "." ".." keep)))))))))
     (build-system qt-build-system)
     (arguments
-     `(#:tests? #f                      ; No target
-       #:imported-modules
-       (,@%qt-build-system-modules
-        (guix build glib-or-gtk-build-system))
-       #:modules
-       ((guix build qt-build-system)
-        ((guix build glib-or-gtk-build-system)
-         #:prefix glib-or-gtk:)
-        (guix build utils)
-        (ice-9 match))
-       #:configure-flags
-       (list
-        ;; Client applications must provide their own API-ID and API-HASH,
-        ;; see also <https://core.telegram.org/api/obtaining_api_id>.
-        ;; In case, that the credentials below fail to work, contact
-        ;;   Raghav Gururajan <rg@raghavgururajan.name>
-        "-DTDESKTOP_API_ID=2791056"
-        "-DTDESKTOP_API_HASH=582d6d0b44f7a2de949e99271fd8b3f2"
-        ;; Disable WebkitGTK support as it fails to link
-        "-DDESKTOP_APP_DISABLE_WEBKITGTK=ON"
-        ;; Use bundled fonts as fallback.
-        "-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF")
-       #:phases
-       (modify-phases %standard-phases
-         (add-after 'unpack 'make-writable
-           (lambda _
-             (for-each make-file-writable (find-files "."))))
-         (add-before 'configure 'patch-cxx-flags
-           (lambda _
-             (substitute* "cmake/options_linux.cmake"
-               (("class-memaccess") "all"))))
-         (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")
-           `(,gtk+ "bin")
-           pkg-config
-           python-wrapper
-           qttools-5))
+     (list #:tests? #f                  ;No target
+           #:imported-modules
+           `(,@%qt-build-system-modules
+             (guix build glib-or-gtk-build-system))
+           #:modules
+           '((guix build qt-build-system)
+             ((guix build glib-or-gtk-build-system) #:prefix glib-or-gtk:)
+             (guix build utils)
+             (ice-9 match))
+           #:configure-flags
+           #~`(;; https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml
+               ;; see also <https://core.telegram.org/api/obtaining_api_id>.
+               "-DTDESKTOP_API_ID=611335"
+               "-DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c"
+               ,(string-append "-DTDESKTOP_LAUTCHER_BASENAME=" #$name)
+               "-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON"
+               "-DDESKTOP_APP_DISABLE_AUTOUPDATE=ON"
+               ;; NOTE: Options commented are default values.
+               ;; See also: comments in inputs.
+               ;; "-DDESKTOP_APP_LOTTIE_USE_CACHE=ON"
+               ;; "-DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=OFF"
+               ;; "-DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=OFF"
+               ;; "-DDESKTOP_APP_DISABLE_X11_INTEGRATION=OFF"
+               ;; "-DDESKTOP_APP_USE_ALLOCATION_TRACER=OFF"
+               ;; "-DDESKTOP_APP_USE_PACKAGED=ON"
+               ;; "-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF"
+               ;; "-DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF"
+               ;; "-DDESKTOP_APP_DISABLE_SPELLCHECK=OFF"
+               ;; "-DDESKTOP_APP_USE_HUNSPELL_ONLY=OFF"
+               ;; "-DDESKTOP_APP_USE_ENCHANT=OFF"
+               ;; "-DDESKTOP_APP_NO_PDB=OFF"
+               ;; "-DDESKTOP_APP_DISABLE_JEMALLOC=OFF"
+               )
+           #:phases
+           #~(modify-phases %standard-phases
+               (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 pkg-config python-wrapper))
     (inputs
-     (list alsa-lib
+     (list abseil-cpp-cxxstd17
+           alsa-lib
            c++-gsl
-           catch-framework2
-           libexpected
-           fcitx-qt5
-           fcitx5-qt
            ffmpeg
-           glib
-           glibmm-2.64
-           gtk+
-           hime
-           hunspell
            jemalloc
-           kwayland
-           libdbusmenu-qt
+           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_USE_ENCHANT
+           ;; enchant
+           ;; 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+
-      ;; Others
-      license:gpl3+))))
+    (license (list
+              ;; Telegram/ThirdParty/dispatch
+              license:asl2.0
+              ;; Telegram/ThirdParty/rlottie/src/vector/pixman
+              ;; Telegram/ThirdParty/rlottie/src/vector/stb
+              ;; Telegram/ThirdParty/rlottie/src/vector/rapidjson
+              license:expat
+              ;; Telegram/ThirdParty/rlottie/src/vector/freetype
+              license:freetype
+              ;; Telegram/ThirdParty/rlottie
+              ;; Telegram/ThirdParty/rlottie/src/vector
+              license:lgpl2.1+
+              ;; Telegram/ThirdParty/tgcalls
+              license:lgpl3
+              ;; Others
+              license:gpl3+))))

 (define-public tl-parser
   (let ((commit "1933e76f8f4fb74311be723b432e4c56e3a5ec06")