1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
4 ;;; This file is part of GNU Guix.
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19 (define-module (gnu packages telegram)
20 #:use-module (gnu packages)
21 #:use-module (gnu packages aidc)
22 #:use-module (gnu packages animation)
23 #:use-module (gnu packages assembly)
24 #:use-module (gnu packages audio)
25 #:use-module (gnu packages autotools)
26 #:use-module (gnu packages base)
27 #:use-module (gnu packages check)
28 #:use-module (gnu packages cmake)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages cpp)
31 #:use-module (gnu packages digest)
32 #:use-module (gnu packages fcitx)
33 #:use-module (gnu packages fcitx5)
34 #:use-module (gnu packages gcc)
35 #:use-module (gnu packages glib)
36 #:use-module (gnu packages gnome)
37 #:use-module (gnu packages gnupg)
38 #:use-module (gnu packages gtk)
39 #:use-module (gnu packages image)
40 #:use-module (gnu packages kde-frameworks)
41 #:use-module (gnu packages language)
42 #:use-module (gnu packages libevent)
43 #:use-module (gnu packages libreoffice)
44 #:use-module (gnu packages linux)
45 #:use-module (gnu packages lxqt)
46 #:use-module (gnu packages pkg-config)
47 #:use-module (gnu packages protobuf)
48 #:use-module (gnu packages pulseaudio)
49 #:use-module (gnu packages python)
50 #:use-module (gnu packages qt)
51 #:use-module (gnu packages telephony)
52 #:use-module (gnu packages tls)
53 #:use-module (gnu packages video)
54 #:use-module (gnu packages xiph)
55 #:use-module (gnu packages xorg)
56 #:use-module ((guix licenses) #:prefix license:)
57 #:use-module (guix packages)
58 #:use-module (guix git-download)
59 #:use-module (guix build-system cmake)
60 #:use-module (guix build-system copy)
61 #:use-module (guix build-system glib-or-gtk)
62 #:use-module (guix build-system gnu)
63 #:use-module (guix build-system meson)
64 #:use-module (guix build-system qt))
66 (define-public webrtc-for-telegram-desktop
67 (let ((commit "fa86fcc00c218813d61a272a56feab55c76a1ab9")
71 (name "webrtc-for-telegram-desktop")
73 (git-version "0" revision commit))
79 (url "https://github.com/desktop-app/tg_owt.git")
82 (git-file-name name version))
84 (base32 "06gcrlym6vqqw7zlds9lpwyg37d5m81d87h16aps19v0v9gzan0l"))
85 (modules '((guix build utils)
91 '( ;; Custom forks which are incompatible with the ones in Guix.
92 "abseil-cpp" "libsrtp" "openh264" "rnnoise"
93 ;; Not available in Guix.
95 ;; Has cmake support files for libvpx input.
97 (with-directory-excursion "src/third_party"
98 (for-each delete-file-recursively
99 (lset-difference string=?
101 (cons* "." ".." keep))))
103 (build-system cmake-build-system)
105 `(#:tests? #f ; No target
108 "-DCMAKE_C_FLAGS=-fPIC"
109 "-DCMAKE_CXX_FLAGS=-fPIC")
111 (modify-phases %standard-phases
112 (add-after 'unpack 'copy-inputs
113 (lambda* (#:key inputs outputs #:allow-other-keys)
114 (let* ((libvpx-from (assoc-ref inputs "libvpx"))
115 (libyuv-from (assoc-ref inputs "libyuv"))
116 (libvpx-to (string-append (getcwd)
117 "/src/third_party/libvpx/source/libvpx"))
118 (libyuv-to (string-append (getcwd)
119 "/src/third_party/libyuv")))
120 (copy-recursively libvpx-from libvpx-to)
121 (copy-recursively libyuv-from libyuv-to))
124 `(("pkg-config" ,pkg-config)
125 ("python" ,python-wrapper)
130 ("libjpeg" ,libjpeg-turbo)
136 (url "https://chromium.googlesource.com/webm/libvpx")
137 (commit "5b63f0f821e94f8072eb483014cfc33b05978bb9")))
139 (git-file-name "libvpx-for-webrtc-for-telegram-desktop" version))
141 (base32 "1psvxaddihlw1k5n0anxif3qli6zyw2sa2ywn6mkb8six9myrp68"))))
147 (url "https://chromium.googlesource.com/libyuv/libyuv")
148 (commit "ad890067f661dc747a975bc55ba3767fe30d4452")))
150 (git-file-name "libyuv-for-webrtc-for-telegram-desktop" version))
152 (base32 "01knnk4h247rq536097n9n3s3brxlbby3nv3ppdgsqfda3k159ll"))))
155 ("protobuf" ,protobuf)
156 ("pulseaudio" ,pulseaudio)))
157 (synopsis "WebRTC support for Telegram Desktop")
158 (description "WebRTC-for-Telegram-Desktop is a custom WebRTC fork by
159 Telegram project, for its use in telegram desktop client.")
160 (home-page "https://github.com/desktop-app/tg_owt")
166 (license:non-copyleft "file:///src/third_party/libyuv/LICENSE")
170 (license:non-copyleft "file:///src/third_party/pffft/LICENSE")
173 ;; LibSRTP, LibVPx, UsrSCTP and Others
176 (define-public rlottie-for-telegram-desktop
177 (let ((commit "cbd43984ebdf783e94c8303c41385bf82aa36d5b")
183 (git-version "0.0.1" revision commit))
189 (url "https://github.com/desktop-app/rlottie.git")
192 (git-file-name "rlottie-for-telegram-desktop" version))
194 (base32 "1lxpbgbhps9rmck036mgmiknqrzpjxpas8n7qxykv6pwzn0c8n0c"))))
202 (modify-phases %standard-phases
203 (add-after 'unpack 'patch-cxx-flags
205 (substitute* "meson.build"
210 (define-public libtgvoip-for-telegram-desktop
211 (let ((commit "37d98e984fd6fa389262307db826d52ab86c8241")
217 (git-version "2.4.4" revision commit))
223 (url "https://github.com/telegramdesktop/libtgvoip.git")
226 (git-file-name "libtgvoip-for-telegram-desktop" version))
228 (base32 "13dzvyq8p20nlhjihv18aj6y97czk07qdl0k6v81vp6mbwcldg7h"))))
233 "--disable-dsp" ; FIXME
234 "--enable-audio-callback"
238 (modify-phases %standard-phases
239 (add-after 'unpack 'patch-linkers
241 (substitute* "Makefile.am"
242 (("\\$\\(CRYPTO_LIBS\\) \\$\\(OPUS_LIBS\\)")
243 "$(CRYPTO_LIBS) $(OPUS_LIBS) $(ALSA_LIBS) $(PULSE_LIBS)"))
244 (substitute* "tgvoip.pc.in"
246 "libcrypto opus alsa libpulse"))
249 `(("autoconf" ,autoconf)
250 ("automake" ,automake)
252 ("pkg-config" ,pkg-config)))))))
254 (define-public telegram-desktop
256 (name "telegram-desktop")
263 (url "https://github.com/telegramdesktop/tdesktop.git")
265 (string-append "v" version))))
267 (git-file-name name version))
269 (base32 "0drirhkr9gnm1g03lcqmvap5ljlk859c29gbsm63hhsgv15dlw0y"))
270 (modules '((guix build utils)
276 '( ;; Not available in Guix.
277 "SPMediaKeyTap" "statusnotifieritem" "tgcalls")))
278 (with-directory-excursion "Telegram/ThirdParty"
279 (for-each delete-file-recursively
280 (lset-difference string=?
282 (cons* "." ".." keep))))
284 (build-system qt-build-system)
286 `(#:tests? #f ; No target
288 (,@%qt-build-system-modules
289 (guix build glib-or-gtk-build-system))
291 ((guix build qt-build-system)
292 ((guix build glib-or-gtk-build-system)
293 #:prefix glib-or-gtk:)
298 ;; Client applications must provide their own API-ID and API-HASH,
299 ;; see also <https://core.telegram.org/api/obtaining_api_id>.
300 ;; In case, that the credentials below fail to work, contact
301 ;; Raghav Gururajan <rg@raghavgururajan.name>
302 "-DTDESKTOP_API_ID=2791056"
303 "-DTDESKTOP_API_HASH=582d6d0b44f7a2de949e99271fd8b3f2"
304 ;; Use bundled fonts as fallback.
305 "-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF")
307 (modify-phases %standard-phases
308 (add-after 'unpack 'make-writable
310 (for-each make-file-writable (find-files "."))
312 (add-after 'make-writable 'copy-inputs
313 (lambda* (#:key inputs outputs #:allow-other-keys)
317 (copy-recursively src dst)
318 (for-each make-file-writable (find-files dst))))
319 `(("cmake" ,(assoc-ref inputs "cmake-helpers"))
320 ("Telegram/codegen" ,(assoc-ref inputs "codegen-source"))
321 ("Telegram/lib_base" ,(assoc-ref inputs "lib-base-source"))
322 ("Telegram/lib_crl" ,(assoc-ref inputs "lib-crl-source"))
323 ("Telegram/lib_lottie"
324 ,(assoc-ref inputs "lib-lottie-source"))
325 ("Telegram/lib_qr" ,(assoc-ref inputs "lib-qr-source"))
326 ("Telegram/lib_rlottie"
327 ,(assoc-ref inputs "lib-rlottie-source"))
328 ("Telegram/lib_rpl" ,(assoc-ref inputs "lib-rpl-source"))
329 ("Telegram/lib_spellcheck"
330 ,(assoc-ref inputs "lib-spellcheck-source"))
331 ("Telegram/lib_storage"
332 ,(assoc-ref inputs "lib-storage-source"))
333 ("Telegram/lib_tl" ,(assoc-ref inputs "lib-tl-source"))
334 ("Telegram/lib_ui" ,(assoc-ref inputs "lib-ui-source"))
335 ("Telegram/lib_webrtc" ,(assoc-ref inputs "lib-webrtc-source"))
336 ("Telegram/ThirdParty/tgcalls"
337 ,(assoc-ref inputs "tgcalls-source"))))
339 (add-before 'configure 'patch-cxx-flags
341 (substitute* "cmake/options_linux.cmake"
342 (("class-memaccess") "all"))
344 (add-after 'install 'glib-or-gtk-compile-schemas
345 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
346 (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
347 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
354 (url "https://github.com/desktop-app/cmake_helpers.git")
355 (commit "a81345a28d407fb5acd5267ec6afa1864f4e8d5b")))
357 (git-file-name "cmake-helpers-for-telegram-desktop" version))
359 (base32 "0s5hxip68dmkaspjq6j30wx1r5v4prnrjza79hdbznz6i57a2248"))))
360 ("cmake-shared" ,cmake-shared)
361 ("extra-cmake-modules" ,extra-cmake-modules)
363 ("glib:bin" ,glib "bin")
364 ("gobject-introspection" ,gobject-introspection)
365 ("gtk+:bin" ,gtk+ "bin")
366 ("pkg-config" ,pkg-config)
367 ("python" ,python-wrapper)
368 ("qttools" ,qttools)))
372 ("catch" ,catch-framework2)
378 (url "https://github.com/desktop-app/codegen.git")
379 (commit "127968de8129e8ccfa6ac50721c70415a5a087c3")))
381 (git-file-name "codegen" version))
383 (base32 "036hzjrsk134ky62192nra43rsln5kh5gz20q1920s922661zky2"))))
384 ("expected" ,libexpected)
385 ("fcitx-qt5" ,fcitx-qt5)
386 ("fcitx5-qt" ,fcitx5-qt)
391 ("hunspell" ,hunspell)
398 (url "https://github.com/desktop-app/lib_base.git")
399 (commit "81df0d0b7842be2b6c88f93dfa136b8efea4c9ad")))
401 (git-file-name "lib-base-for-telegram-desktop" version))
403 (base32 "0ikddprjnjvg0ic8jr2886xq0f18syp587q6z2kci9xmdnvjl217"))))
409 (url "https://github.com/desktop-app/lib_crl.git")
410 (commit "16150bf71d79382738114b913f137ec1a1a7630c")))
412 (git-file-name "lib-crl-for-telegram-desktop" version))
414 (base32 "0qhagdr26aqb9w7wnchcmk1j7ln28x3wbkkkm06b8h0mybksbj7q"))))
420 (url "https://github.com/desktop-app/lib_lottie.git")
421 (commit "fb40f379d82ffa1fc7506e9a8dddcf48847715ae")))
423 (git-file-name "lib-lottie-for-telegram-desktop" version))
425 (base32 "1vq0mqxcrrv7akcqk9cl4mm61zw6dcfmy8adl0pcp49kynm64saw"))))
431 (url "https://github.com/desktop-app/lib_qr.git")
432 (commit "92ce41a690a463eb462089a4eb1e51e019308018")))
434 (git-file-name "lib-qr-for-telegram-desktop" version))
436 (base32 "182939nv7xs9b3bgah3gl5y9hx5r59mabd2jw3z6717vc96qi2pj"))))
437 ("lib-rlottie-source"
442 (url "https://github.com/desktop-app/lib_rlottie.git")
443 (commit "0671bf70547381effcf442ec9618e04502a8adbc")))
445 (git-file-name "lib-rlottie-for-telegram-desktop" version))
447 (base32 "05qnza7j15356s8jq16pkbyp4zr586lssmd86lz5jq23lcb3raxv"))))
453 (url "https://github.com/desktop-app/lib_rpl.git")
454 (commit "e1b96399d9031c4ef0354631e6bb375029d29d9f")))
456 (git-file-name "lib-rpl-for-telegram-desktop" version))
458 (base32 "1wvqazljd2kq1fxlj250jhjrig529499bym9p81dx33kh1l9dgss"))))
459 ("lib-spellcheck-source"
464 (url "https://github.com/desktop-app/lib_spellcheck.git")
465 (commit "1b540b38ed78e9a3cba93e9ba4ce4525ab692277")))
467 (git-file-name "lib-spellcheck-for-telegram-desktop" version))
469 (base32 "0a7042h5zrdvgs7v153ral2dh1zj84di5yjcmgcry5k4s1im9di7"))))
470 ("lib-storage-source"
475 (url "https://github.com/desktop-app/lib_storage.git")
476 (commit "cbe51722b73cfa9ff27bd59294b08aa5ee33c936")))
478 (git-file-name "lib-storage-for-telegram-desktop" version))
480 (base32 "045l5xsyagyz17gbhmmvl2miss4nb92p0dmza7yfs9pkg9gs0f87"))))
486 (url "https://github.com/desktop-app/lib_tl.git")
487 (commit "404c83d77e5edb8a39f8e9f56a6340960fe5070e")))
489 (git-file-name "lib-tl-for-telegram-desktop" version))
491 (base32 "1k34nkvvcjqw5q81n1qmklid60cvzjk4lmn9qjimk437m6wbii7f"))))
497 (url "https://github.com/desktop-app/lib_ui.git")
498 (commit "1e2799245cf2720a329ecb5cf5644fded669cce6")))
500 (git-file-name "lib-ui-for-telegram-desktop" version))
502 (base32 "0kd4njcvic2700f00qn25vn3b80vsd2flsm3pi2synnldkiy8lcw"))))
508 (url "https://github.com/desktop-app/lib_webrtc.git")
509 (commit "4bc51d6f6d5740159fdb51cb1593e80ce149ed4e")))
511 (git-file-name "lib-webrtc-for-telegram-desktop" version))
513 (base32 "06hpyq4qglrj3cb1xg8ghlmzm9ra8f5n6vm7hcy67n2wk8sy4cal"))))
514 ("libdbusmenu-qt" ,libdbusmenu-qt)
515 ("libjpeg" ,libjpeg-turbo)
516 ("libtgvoip" ,libtgvoip-for-telegram-desktop)
518 ("materialdecoration" ,materialdecoration)
524 ("pulseaudio" ,pulseaudio)
525 ("qrcodegen" ,qrcodegen-cpp)
528 ("qtimageformats" ,qtimageformats)
529 ("qtwayland" ,qtwayland)
530 ("range-v3" ,range-v3)
531 ("rlottie" ,rlottie-for-telegram-desktop)
537 (url "https://github.com/TelegramMessenger/tgcalls.git")
538 (commit "178983f72312ca8bd422bc73810fd63f1a89bd9d")))
540 (git-file-name "tgcalls-for-telegram-desktop" version))
542 (base32 "1xad65c9m6mj6zdj08flafvh8xjkd7xi9r1agcyc64y69lr427d0"))))
543 ("webrtc" ,webrtc-for-telegram-desktop)
546 ("xcb-keysyms" ,xcb-util-keysyms)
551 (synopsis "Telegram Desktop")
552 (description "Telegram desktop is the official desktop version of the
553 Telegram instant messager.")
554 (home-page "https://desktop.telegram.org/")
562 (define-public tl-parser
563 (let ((commit "1933e76f8f4fb74311be723b432e4c56e3a5ec06")
568 (git-version "0" revision commit))
574 (url "https://github.com/vysheng/tl-parser.git")
577 (git-file-name name version))
579 (base32 "13cwi247kajzpkbl86hnwmn1sn2h6rqndz6khajbqj0mlw9mv4hq"))))
580 (build-system cmake-build-system)
582 `(#:tests? #f ; No target
584 ((guix build copy-build-system)
585 ,@%cmake-build-system-modules)
587 (((guix build copy-build-system)
589 (guix build cmake-build-system)
592 (modify-phases %standard-phases
595 (apply (assoc-ref copy:%standard-phases 'install)
598 #:include ("tl-parser"))
599 ("../source" "include/tl-parser"
600 #:include-regexp ("\\.h$")))
602 (synopsis "Parse tl scheme to tlo")
603 (description "TL-Parser is a tl scheme to tlo file parser. It was formely
604 a part of telegram-cli, but now being maintained separately.")
605 (home-page "https://github.com/vysheng/tl-parser")
606 (license license:gpl2+))))
609 (let ((commit "ffb04caca71de0cddf28cd33a4575922900a59ed")
614 (git-version "2.0.1" revision commit))
620 (url "https://github.com/vysheng/tgl.git")
623 (git-file-name name version))
625 (base32 "0cf5s7ygslb5klg1qv9qdc3hivhspmvh3zkacyyhd2yyikb5p0f9"))))
626 (build-system gnu-build-system)
628 `(#:tests? #f ; No target
630 ((guix build copy-build-system)
631 ,@%gnu-build-system-modules)
633 (((guix build copy-build-system)
635 (guix build gnu-build-system)
639 ;; Use gcrypt instead of openssl.
641 ;; Enable extended queries system.
643 ;; Include libevent-based net and timers.
646 (modify-phases %standard-phases
647 (add-after 'unpack 'trigger-bootstrap
649 (delete-file "configure")
651 (add-after 'trigger-bootstrap 'patch-tl-parser
653 (delete-file "Makefile.tl-parser")
654 (substitute* "Makefile.in"
655 (("include \\$\\{srcdir\\}/Makefile\\.tl-parser")
657 (("\\$\\{EXE\\}/tl-parser")
662 (apply (assoc-ref copy:%standard-phases 'install)
666 #:include-regexp ("\\.h$"))
670 `(("autoconf" ,autoconf)
671 ("automake" ,automake)
673 ("pkg-config" ,pkg-config)))
675 `(("libevent" ,libevent)
676 ("libgcrypt" ,libgcrypt)
677 ("tl-parser" ,tl-parser)
679 (synopsis "Telegram Library")
680 (description "TGL is the telegram library for telegram-cli.")
681 (home-page "https://github.com/vysheng/tgl")
682 (license license:lgpl2.1+))))