diff mbox series

[bug#45721,v15] Add Telegram Desktop.

Message ID 5b7bbe10360a9a6bec44c99ac66b0e075f3ed924.camel@student.tugraz.at
State Accepted
Headers show
Series [bug#45721,v15] Add Telegram Desktop. | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Leo Prikler Jan. 17, 2021, 7:08 p.m. UTC
Hi Raghav and everyone else listening on this topic,

this was supposed to be a short set of mostly cosmetic changes before
pushing your patch, but alas, I discovered, that gsl actually conflicts
with an existing package.  I've verified, that Telegram still runs with
the changes I've made and I don't think I have anything else to add,
but someone else should look over these patches once again to make sure
that I didn't overlook anything.

Also there's the question as to whether Telegram Desktop actually runs
under QtWayland.  If someone would be willing to check, that'd be very
nice.

Regards,
Leo

Comments

Raghav Gururajan Jan. 17, 2021, 9:59 p.m. UTC | #1
Hi Leo!

> this was supposed to be a short set of mostly cosmetic changes before
> pushing your patch, but alas, I discovered, that gsl actually conflicts
> with an existing package.  I've verified, that Telegram still runs with
> the changes I've made and I don't think I have anything else to add,
> but someone else should look over these patches once again to make sure
> that I didn't overlook anything.

Thank you!

Regards,
RG.
diff mbox series

Patch

From 33b8103d31f4bbb34a5130a616f2c3c6bf6b706d Mon Sep 17 00:00:00 2001
From: Raghav Gururajan <rg@raghavgururajan.name>
Date: Sun, 17 Jan 2021 09:30:22 -0500
Subject: [PATCH 13/13] gnu: Add telegram-desktop.

* gnu/packages/telegram.scm (telegram-desktop): New variable.

Signed-off-by: Leo Prikler <leo.prikler@student.tugraz.at>
---
 gnu/packages/telegram.scm | 160 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 159 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/telegram.scm b/gnu/packages/telegram.scm
index 0fd47f4f5d..ad7bcb2e6c 100644
--- a/gnu/packages/telegram.scm
+++ b/gnu/packages/telegram.scm
@@ -18,20 +18,42 @@ 
 
 (define-module (gnu packages telegram)
   #:use-module (gnu packages)
+  #:use-module (gnu packages aidc)
   #:use-module (gnu packages assembly)
+  #:use-module (gnu packages audio)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages check)
+  #:use-module (gnu packages cmake)
+  #:use-module (gnu packages compression)
+  #:use-module (gnu packages cpp)
+  #:use-module (gnu packages digest)
+  #:use-module (gnu packages fcitx)
+  #:use-module (gnu packages fcitx5)
+  #:use-module (gnu packages gcc)
+  #:use-module (gnu packages glib)
+  #:use-module (gnu packages gnome)
+  #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
+  #:use-module (gnu packages kde-frameworks)
+  #:use-module (gnu packages language)
+  #:use-module (gnu packages libreoffice)
   #:use-module (gnu packages linux)
+  #:use-module (gnu packages lxqt)
   #:use-module (gnu packages pkg-config)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages pulseaudio)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages qt)
   #:use-module (gnu packages tls)
   #:use-module (gnu packages video)
   #:use-module (gnu packages xiph)
+  #:use-module (gnu packages xorg)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (guix git-download)
-  #:use-module (guix build-system cmake))
+  #:use-module (guix build-system cmake)
+  #:use-module (guix build-system glib-or-gtk)
+  #:use-module (guix build-system qt))
 
 (define-public tg-owt
   (let ((commit "fa86fcc00c218813d61a272a56feab55c76a1ab9")
@@ -141,3 +163,139 @@  for its use in telegram desktop client.")
         license:gpl3
         ;; LibSRTP, LibVPx, UsrSCTP and Others
         license:bsd-3)))))
+
+(define-public telegram-desktop
+  (package
+    (name "telegram-desktop")
+    (version "2.5.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri
+        (git-reference
+         (url "https://github.com/telegramdesktop/tdesktop.git")
+         (commit
+          (string-append "v" version))
+         (recursive? #t)))
+       (file-name
+        (git-file-name name version))
+       (sha256
+        (base32 "1qw9vaa482dbz97mzwjzmy3fw72s5bk3hyacyz98ms652xgld6js"))
+       (modules '((guix build utils)
+                  (ice-9 ftw)
+                  (srfi srfi-1)))
+       (snippet
+        `(begin
+           (let ((keep
+                  '( ;; Custom forks which are incompatible with the ones in Guix.
+                    "libtgvoip" "rlottie"
+                    ;; Not available in Guix.
+                    "SPMediaKeyTap" "statusnotifieritem" "tgcalls")))
+             (with-directory-excursion "Telegram/ThirdParty"
+               (for-each delete-file-recursively
+                         (lset-difference string=?
+                                          (scandir ".")
+                                          (cons* "." ".." keep))))
+             #t)))))
+    (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))
+       #:configure-flags
+       ;; 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>
+       (list
+        "-DTDESKTOP_API_ID=2791056"
+        "-DTDESKTOP_API_HASH=582d6d0b44f7a2de949e99271fd8b3f2")
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'make-writable
+           (lambda _
+             (for-each make-file-writable (find-files "."))
+             #t))
+         (add-after 'make-writable 'disable-emojis
+           (lambda _
+             ;; FIXME: Emoji sprites do not get loaded, causing
+             ;; the application to crash upon launch.
+             (substitute* "Telegram/lib_ui/ui/emoji_config.cpp"
+               (("bool _unsupported = false")
+                "bool _unsupported = true")
+               (("		generateCache\\(\\);")
+                "//generateCache();"))
+             #t))
+         (add-before 'configure 'patch-cxx-flags
+           (lambda _
+             (substitute* "cmake/options_linux.cmake"
+               (("class-memaccess") "all"))
+             #t))
+         (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
+     `(("cmake-shared" ,cmake-shared)
+       ("extra-cmake-modules" ,extra-cmake-modules)
+       ("gcc" ,gcc-9)
+       ("glib:bin" ,glib "bin")
+       ("gobject-introspection" ,gobject-introspection)
+       ("gtk+:bin" ,gtk+ "bin")
+       ("pkg-config" ,pkg-config)
+       ("python" ,python-wrapper)
+       ("qttools" ,qttools)))
+    (inputs
+     `(("alsa" ,alsa-lib)
+       ("c++-gsl" ,c++-gsl)
+       ("catch" ,catch-framework2)
+       ("expected" ,libexpected)
+       ("fcitx-qt5" ,fcitx-qt5)
+       ("fcitx5-qt" ,fcitx5-qt)
+       ("ffmpeg" ,ffmpeg)
+       ("glib" ,glib)
+       ("gtk+" ,gtk+)
+       ("hime" ,hime)
+       ("hunspell" ,hunspell)
+       ("iconv" ,libiconv)
+       ("libdbusmenu-qt" ,libdbusmenu-qt)
+       ("libjpeg" ,libjpeg-turbo)
+       ;; ("libtgvoip" ,libtgvoip)
+       ("lz4" ,lz4)
+       ("materialdecoration" ,materialdecoration)
+       ("minizip" ,minizip)
+       ("nimf" ,nimf)
+       ("openal" ,openal)
+       ("openssl" ,openssl)
+       ("opus" ,opus)
+       ("pulseaudio" ,pulseaudio)
+       ("qrcodegen" ,qrcodegen-cpp)
+       ("qt" ,qtbase)
+       ("qt5ct" ,qt5ct)
+       ("qtwayland" ,qtwayland)
+       ("range-v3" ,range-v3)
+       ;; ("rlottie" ,rlottie)
+       ("tg-owt" ,tg-owt)
+       ("x11" ,libx11)
+       ("xcb" ,libxcb)
+       ("xcb-keysyms" ,xcb-util-keysyms)
+       ("xxhash" ,xxhash)
+       ("zlib" ,zlib)))
+    (propagated-inputs
+     `(("dconf" ,dconf)))
+    (synopsis "Telegram Desktop")
+    (description "Telegram desktop is the official desktop version of the
+Telegram instant messager.")
+    (home-page "https://desktop.telegram.org/")
+    (license
+     (list
+      ;; ThirdParty
+      license:lgpl2.1+
+      ;; Others
+      license:gpl3+))))
-- 
2.30.0