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 gtk)
38 #:use-module (gnu packages image)
39 #:use-module (gnu packages kde-frameworks)
40 #:use-module (gnu packages language)
41 #:use-module (gnu packages libreoffice)
42 #:use-module (gnu packages linux)
43 #:use-module (gnu packages lxqt)
44 #:use-module (gnu packages pkg-config)
45 #:use-module (gnu packages protobuf)
46 #:use-module (gnu packages pulseaudio)
47 #:use-module (gnu packages python)
48 #:use-module (gnu packages qt)
49 #:use-module (gnu packages telephony)
50 #:use-module (gnu packages tls)
51 #:use-module (gnu packages video)
52 #:use-module (gnu packages xiph)
53 #:use-module (gnu packages xorg)
54 #:use-module ((guix licenses) #:prefix license:)
55 #:use-module (guix packages)
56 #:use-module (guix git-download)
57 #:use-module (guix build-system cmake)
58 #:use-module (guix build-system glib-or-gtk)
59 #:use-module (guix build-system gnu)
60 #:use-module (guix build-system meson)
61 #:use-module (guix build-system qt))
63 (define-public webrtc-for-telegram-desktop
64 (let ((commit "fa86fcc00c218813d61a272a56feab55c76a1ab9")
68 (name "webrtc-for-telegram-desktop")
70 (git-version "0" revision commit))
76 (url "https://github.com/desktop-app/tg_owt.git")
79 (git-file-name name version))
81 (base32 "06gcrlym6vqqw7zlds9lpwyg37d5m81d87h16aps19v0v9gzan0l"))
82 (modules '((guix build utils)
88 '( ;; Custom forks which are incompatible with the ones in Guix.
89 "abseil-cpp" "libsrtp" "openh264" "rnnoise"
90 ;; Not available in Guix.
92 ;; Has cmake support files for libvpx input.
94 (with-directory-excursion "src/third_party"
95 (for-each delete-file-recursively
96 (lset-difference string=?
98 (cons* "." ".." keep))))
100 (build-system cmake-build-system)
102 `(#:tests? #f ; No target
105 "-DCMAKE_C_FLAGS=-fPIC"
106 "-DCMAKE_CXX_FLAGS=-fPIC")
108 (modify-phases %standard-phases
109 (add-after 'unpack 'copy-inputs
110 (lambda* (#:key inputs outputs #:allow-other-keys)
111 (let* ((libvpx-from (assoc-ref inputs "libvpx"))
112 (libyuv-from (assoc-ref inputs "libyuv"))
113 (libvpx-to (string-append (getcwd)
114 "/src/third_party/libvpx/source/libvpx"))
115 (libyuv-to (string-append (getcwd)
116 "/src/third_party/libyuv")))
117 (copy-recursively libvpx-from libvpx-to)
118 (copy-recursively libyuv-from libyuv-to))
121 `(("pkg-config" ,pkg-config)
122 ("python" ,python-wrapper)
127 ("libjpeg" ,libjpeg-turbo)
133 (url "https://chromium.googlesource.com/webm/libvpx")
134 (commit "5b63f0f821e94f8072eb483014cfc33b05978bb9")))
136 (git-file-name "libvpx-for-webrtc-for-telegram-desktop" version))
138 (base32 "1psvxaddihlw1k5n0anxif3qli6zyw2sa2ywn6mkb8six9myrp68"))))
144 (url "https://chromium.googlesource.com/libyuv/libyuv")
145 (commit "ad890067f661dc747a975bc55ba3767fe30d4452")))
147 (git-file-name "libyuv-for-webrtc-for-telegram-desktop" version))
149 (base32 "01knnk4h247rq536097n9n3s3brxlbby3nv3ppdgsqfda3k159ll"))))
152 ("protobuf" ,protobuf)
153 ("pulseaudio" ,pulseaudio)))
154 (synopsis "WebRTC support for Telegram Desktop")
155 (description "WebRTC-for-Telegram-Desktop is a custom WebRTC fork by
156 Telegram project, for its use in telegram desktop client.")
157 (home-page "https://github.com/desktop-app/tg_owt")
163 (license:non-copyleft "file:///src/third_party/libyuv/LICENSE")
167 (license:non-copyleft "file:///src/third_party/pffft/LICENSE")
170 ;; LibSRTP, LibVPx, UsrSCTP and Others
173 (define-public rlottie-for-telegram-desktop
174 (let ((commit "cbd43984ebdf783e94c8303c41385bf82aa36d5b")
180 (git-version "0.0.1" revision commit))
186 (url "https://github.com/desktop-app/rlottie.git")
189 (git-file-name "rlottie-for-telegram-desktop" version))
191 (base32 "1lxpbgbhps9rmck036mgmiknqrzpjxpas8n7qxykv6pwzn0c8n0c"))))
199 (modify-phases %standard-phases
200 (add-after 'unpack 'patch-cxx-flags
202 (substitute* "meson.build"
207 (define-public libtgvoip-for-telegram-desktop
208 (let ((commit "37d98e984fd6fa389262307db826d52ab86c8241")
214 (git-version "2.4.4" revision commit))
220 (url "https://github.com/telegramdesktop/libtgvoip.git")
223 (git-file-name "libtgvoip-for-telegram-desktop" version))
225 (base32 "13dzvyq8p20nlhjihv18aj6y97czk07qdl0k6v81vp6mbwcldg7h"))))
230 "--disable-dsp" ; FIXME
231 "--enable-audio-callback"
235 (modify-phases %standard-phases
236 (add-after 'unpack 'patch-linkers
238 (substitute* "Makefile.am"
239 (("\\$\\(CRYPTO_LIBS\\) \\$\\(OPUS_LIBS\\)")
240 "$(CRYPTO_LIBS) $(OPUS_LIBS) $(ALSA_LIBS) $(PULSE_LIBS)"))
241 (substitute* "tgvoip.pc.in"
243 "libcrypto opus alsa libpulse"))
246 `(("autoconf" ,autoconf)
247 ("automake" ,automake)
249 ("pkg-config" ,pkg-config)))))))
251 (define-public telegram-desktop
253 (name "telegram-desktop")
260 (url "https://github.com/telegramdesktop/tdesktop.git")
262 (string-append "v" version))))
264 (git-file-name name version))
266 (base32 "0drirhkr9gnm1g03lcqmvap5ljlk859c29gbsm63hhsgv15dlw0y"))
267 (modules '((guix build utils)
273 '( ;; Not available in Guix.
274 "SPMediaKeyTap" "statusnotifieritem" "tgcalls")))
275 (with-directory-excursion "Telegram/ThirdParty"
276 (for-each delete-file-recursively
277 (lset-difference string=?
279 (cons* "." ".." keep))))
281 (build-system qt-build-system)
283 `(#:tests? #f ; No target
285 (,@%qt-build-system-modules
286 (guix build glib-or-gtk-build-system))
288 ((guix build qt-build-system)
289 ((guix build glib-or-gtk-build-system)
290 #:prefix glib-or-gtk:)
295 ;; Client applications must provide their own API-ID and API-HASH,
296 ;; see also <https://core.telegram.org/api/obtaining_api_id>.
297 ;; In case, that the credentials below fail to work, contact
298 ;; Raghav Gururajan <rg@raghavgururajan.name>
299 "-DTDESKTOP_API_ID=2791056"
300 "-DTDESKTOP_API_HASH=582d6d0b44f7a2de949e99271fd8b3f2"
301 ;; Use bundled fonts as fallback.
302 "-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF")
304 (modify-phases %standard-phases
305 (add-after 'unpack 'make-writable
307 (for-each make-file-writable (find-files "."))
309 (add-after 'make-writable 'copy-inputs
310 (lambda* (#:key inputs outputs #:allow-other-keys)
314 (copy-recursively src dst)
315 (for-each make-file-writable (find-files dst))))
316 `(("cmake" ,(assoc-ref inputs "cmake-helpers"))
317 ("Telegram/codegen" ,(assoc-ref inputs "codegen-source"))
318 ("Telegram/lib_base" ,(assoc-ref inputs "lib-base-source"))
319 ("Telegram/lib_crl" ,(assoc-ref inputs "lib-crl-source"))
320 ("Telegram/lib_lottie"
321 ,(assoc-ref inputs "lib-lottie-source"))
322 ("Telegram/lib_qr" ,(assoc-ref inputs "lib-qr-source"))
323 ("Telegram/lib_rlottie"
324 ,(assoc-ref inputs "lib-rlottie-source"))
325 ("Telegram/lib_rpl" ,(assoc-ref inputs "lib-rpl-source"))
326 ("Telegram/lib_spellcheck"
327 ,(assoc-ref inputs "lib-spellcheck-source"))
328 ("Telegram/lib_storage"
329 ,(assoc-ref inputs "lib-storage-source"))
330 ("Telegram/lib_tl" ,(assoc-ref inputs "lib-tl-source"))
331 ("Telegram/lib_ui" ,(assoc-ref inputs "lib-ui-source"))
332 ("Telegram/lib_webrtc" ,(assoc-ref inputs "lib-webrtc-source"))
333 ("Telegram/ThirdParty/tgcalls"
334 ,(assoc-ref inputs "tgcalls-source"))))
336 (add-before 'configure 'patch-cxx-flags
338 (substitute* "cmake/options_linux.cmake"
339 (("class-memaccess") "all"))
341 (add-after 'install 'glib-or-gtk-compile-schemas
342 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
343 (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
344 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
351 (url "https://github.com/desktop-app/cmake_helpers.git")
352 (commit "a81345a28d407fb5acd5267ec6afa1864f4e8d5b")))
354 (git-file-name "cmake-helpers-for-telegram-desktop" version))
356 (base32 "0s5hxip68dmkaspjq6j30wx1r5v4prnrjza79hdbznz6i57a2248"))))
357 ("cmake-shared" ,cmake-shared)
358 ("extra-cmake-modules" ,extra-cmake-modules)
360 ("glib:bin" ,glib "bin")
361 ("gobject-introspection" ,gobject-introspection)
362 ("gtk+:bin" ,gtk+ "bin")
363 ("pkg-config" ,pkg-config)
364 ("python" ,python-wrapper)
365 ("qttools" ,qttools)))
369 ("catch" ,catch-framework2)
375 (url "https://github.com/desktop-app/codegen.git")
376 (commit "127968de8129e8ccfa6ac50721c70415a5a087c3")))
378 (git-file-name "codegen" version))
380 (base32 "036hzjrsk134ky62192nra43rsln5kh5gz20q1920s922661zky2"))))
381 ("expected" ,libexpected)
382 ("fcitx-qt5" ,fcitx-qt5)
383 ("fcitx5-qt" ,fcitx5-qt)
388 ("hunspell" ,hunspell)
395 (url "https://github.com/desktop-app/lib_base.git")
396 (commit "81df0d0b7842be2b6c88f93dfa136b8efea4c9ad")))
398 (git-file-name "lib-base-for-telegram-desktop" version))
400 (base32 "0ikddprjnjvg0ic8jr2886xq0f18syp587q6z2kci9xmdnvjl217"))))
406 (url "https://github.com/desktop-app/lib_crl.git")
407 (commit "16150bf71d79382738114b913f137ec1a1a7630c")))
409 (git-file-name "lib-crl-for-telegram-desktop" version))
411 (base32 "0qhagdr26aqb9w7wnchcmk1j7ln28x3wbkkkm06b8h0mybksbj7q"))))
417 (url "https://github.com/desktop-app/lib_lottie.git")
418 (commit "fb40f379d82ffa1fc7506e9a8dddcf48847715ae")))
420 (git-file-name "lib-lottie-for-telegram-desktop" version))
422 (base32 "1vq0mqxcrrv7akcqk9cl4mm61zw6dcfmy8adl0pcp49kynm64saw"))))
428 (url "https://github.com/desktop-app/lib_qr.git")
429 (commit "92ce41a690a463eb462089a4eb1e51e019308018")))
431 (git-file-name "lib-qr-for-telegram-desktop" version))
433 (base32 "182939nv7xs9b3bgah3gl5y9hx5r59mabd2jw3z6717vc96qi2pj"))))
434 ("lib-rlottie-source"
439 (url "https://github.com/desktop-app/lib_rlottie.git")
440 (commit "0671bf70547381effcf442ec9618e04502a8adbc")))
442 (git-file-name "lib-rlottie-for-telegram-desktop" version))
444 (base32 "05qnza7j15356s8jq16pkbyp4zr586lssmd86lz5jq23lcb3raxv"))))
450 (url "https://github.com/desktop-app/lib_rpl.git")
451 (commit "e1b96399d9031c4ef0354631e6bb375029d29d9f")))
453 (git-file-name "lib-rpl-for-telegram-desktop" version))
455 (base32 "1wvqazljd2kq1fxlj250jhjrig529499bym9p81dx33kh1l9dgss"))))
456 ("lib-spellcheck-source"
461 (url "https://github.com/desktop-app/lib_spellcheck.git")
462 (commit "1b540b38ed78e9a3cba93e9ba4ce4525ab692277")))
464 (git-file-name "lib-spellcheck-for-telegram-desktop" version))
466 (base32 "0a7042h5zrdvgs7v153ral2dh1zj84di5yjcmgcry5k4s1im9di7"))))
467 ("lib-storage-source"
472 (url "https://github.com/desktop-app/lib_storage.git")
473 (commit "cbe51722b73cfa9ff27bd59294b08aa5ee33c936")))
475 (git-file-name "lib-storage-for-telegram-desktop" version))
477 (base32 "045l5xsyagyz17gbhmmvl2miss4nb92p0dmza7yfs9pkg9gs0f87"))))
483 (url "https://github.com/desktop-app/lib_tl.git")
484 (commit "404c83d77e5edb8a39f8e9f56a6340960fe5070e")))
486 (git-file-name "lib-tl-for-telegram-desktop" version))
488 (base32 "1k34nkvvcjqw5q81n1qmklid60cvzjk4lmn9qjimk437m6wbii7f"))))
494 (url "https://github.com/desktop-app/lib_ui.git")
495 (commit "1e2799245cf2720a329ecb5cf5644fded669cce6")))
497 (git-file-name "lib-ui-for-telegram-desktop" version))
499 (base32 "0kd4njcvic2700f00qn25vn3b80vsd2flsm3pi2synnldkiy8lcw"))))
505 (url "https://github.com/desktop-app/lib_webrtc.git")
506 (commit "4bc51d6f6d5740159fdb51cb1593e80ce149ed4e")))
508 (git-file-name "lib-webrtc-for-telegram-desktop" version))
510 (base32 "06hpyq4qglrj3cb1xg8ghlmzm9ra8f5n6vm7hcy67n2wk8sy4cal"))))
511 ("libdbusmenu-qt" ,libdbusmenu-qt)
512 ("libjpeg" ,libjpeg-turbo)
513 ("libtgvoip" ,libtgvoip-for-telegram-desktop)
515 ("materialdecoration" ,materialdecoration)
521 ("pulseaudio" ,pulseaudio)
522 ("qrcodegen" ,qrcodegen-cpp)
525 ("qtimageformats" ,qtimageformats)
526 ("qtwayland" ,qtwayland)
527 ("range-v3" ,range-v3)
528 ("rlottie" ,rlottie-for-telegram-desktop)
534 (url "https://github.com/TelegramMessenger/tgcalls.git")
535 (commit "178983f72312ca8bd422bc73810fd63f1a89bd9d")))
537 (git-file-name "tgcalls-for-telegram-desktop" version))
539 (base32 "1xad65c9m6mj6zdj08flafvh8xjkd7xi9r1agcyc64y69lr427d0"))))
540 ("webrtc" ,webrtc-for-telegram-desktop)
543 ("xcb-keysyms" ,xcb-util-keysyms)
548 (synopsis "Telegram Desktop")
549 (description "Telegram desktop is the official desktop version of the
550 Telegram instant messager.")
551 (home-page "https://desktop.telegram.org/")