gnu: python-deepmerge: Use pyproject-build-system.
[jackhill/guix/guix.git] / gnu / packages / telegram.scm
... / ...
CommitLineData
1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
3;;; Copyright © 2022 Hilton Chain <hako@ultrarare.space>
4;;;
5;;; This file is part of GNU Guix.
6;;;
7;;; GNU Guix is free software; you can redistribute it and/or modify it
8;;; under the terms of the GNU General Public License as published by
9;;; the Free Software Foundation; either version 3 of the License, or (at
10;;; your option) any later version.
11;;;
12;;; GNU Guix is distributed in the hope that it will be useful, but
13;;; WITHOUT ANY WARRANTY; without even the implied warranty of
14;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15;;; GNU General Public License for more details.
16;;;
17;;; You should have received a copy of the GNU General Public License
18;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
19
20(define-module (gnu packages telegram)
21 #:use-module (gnu packages)
22 #:use-module (gnu packages aidc)
23 #:use-module (gnu packages animation)
24 #:use-module (gnu packages assembly)
25 #:use-module (gnu packages audio)
26 #:use-module (gnu packages autotools)
27 #:use-module (gnu packages check)
28 #:use-module (gnu packages cmake)
29 #:use-module (gnu packages compression)
30 #:use-module (gnu packages c)
31 #:use-module (gnu packages cpp)
32 #:use-module (gnu packages digest)
33 #:use-module (gnu packages fcitx)
34 #:use-module (gnu packages fcitx5)
35 #:use-module (gnu packages freedesktop)
36 #:use-module (gnu packages gl)
37 #:use-module (gnu packages glib)
38 #:use-module (gnu packages gnome)
39 #:use-module (gnu packages gnupg)
40 #:use-module (gnu packages gtk)
41 #:use-module (gnu packages image)
42 #:use-module (gnu packages jemalloc)
43 #:use-module (gnu packages kde-frameworks)
44 #:use-module (gnu packages language)
45 #:use-module (gnu packages libevent)
46 #:use-module (gnu packages libreoffice)
47 #:use-module (gnu packages linux)
48 #:use-module (gnu packages llvm)
49 #:use-module (gnu packages lxqt)
50 #:use-module (gnu packages lua)
51 #:use-module (gnu packages perl)
52 #:use-module (gnu packages pkg-config)
53 #:use-module (gnu packages protobuf)
54 #:use-module (gnu packages pulseaudio)
55 #:use-module (gnu packages python)
56 #:use-module (gnu packages python-check)
57 #:use-module (gnu packages python-web)
58 #:use-module (gnu packages python-xyz)
59 #:use-module (gnu packages qt)
60 #:use-module (gnu packages readline)
61 #:use-module (gnu packages textutils)
62 #:use-module (gnu packages telephony)
63 #:use-module (gnu packages tls)
64 #:use-module (gnu packages video)
65 #:use-module (gnu packages web)
66 #:use-module (gnu packages webkit)
67 #:use-module (gnu packages xdisorg)
68 #:use-module (gnu packages xiph)
69 #:use-module (gnu packages xorg)
70 #:use-module ((guix licenses) #:prefix license:)
71 #:use-module (guix packages)
72 #:use-module (guix gexp)
73 #:use-module (guix git-download)
74 #:use-module (guix build-system cmake)
75 #:use-module (guix build-system copy)
76 #:use-module (guix build-system glib-or-gtk)
77 #:use-module (guix build-system gnu)
78 #:use-module (guix build-system meson)
79 #:use-module (guix build-system python)
80 #:use-module (guix build-system qt))
81
82(define %telegram-version "4.2.2")
83
84(define libyuv-for-telegram-desktop
85 (let ((commit "ad890067f661dc747a975bc55ba3767fe30d4452")
86 (revision "2211"))
87 (origin
88 (method git-fetch)
89 (uri (git-reference
90 (url "https://chromium.googlesource.com/libyuv/libyuv")
91 (commit commit)))
92 (file-name (git-file-name
93 "libyuv-for-telegram-desktop"
94 (git-version "0" revision commit)))
95 (sha256
96 (base32
97 "01knnk4h247rq536097n9n3s3brxlbby3nv3ppdgsqfda3k159ll")))))
98
99(define cmake-helpers-for-telegram-desktop
100 (origin
101 (method git-fetch)
102 (uri (git-reference
103 (url "https://github.com/desktop-app/cmake_helpers.git")
104 (commit "f49e254d8c5287752b5ed7b86bd84073f584768e")))
105 (file-name
106 (git-file-name "cmake-helpers-for-telegram-desktop" %telegram-version))
107 (sha256
108 (base32
109 "0yqib2ndhpaj69z603knpcfga0ni978janb5i8rvhslqddvbzfjv"))))
110
111(define codegen-for-telegram-desktop
112 (origin
113 (method git-fetch)
114 (uri (git-reference
115 (url "https://github.com/desktop-app/codegen.git")
116 (commit "8815d7aec9b901191d08445f29e2edd0aeba7b2c")))
117 (file-name
118 (git-file-name "codegen-for-telegram-desktop" %telegram-version))
119 (sha256
120 (base32
121 "1ly958mjk25kfcpa174kvg134p9r751ixi275afj5kr57by9mbq2"))))
122
123(define lib-base-for-telegram-desktop
124 (origin
125 (method git-fetch)
126 (uri (git-reference
127 (url "https://github.com/desktop-app/lib_base.git")
128 (commit "d932f5048317b05dd414116741d995c82a528542")))
129 (file-name
130 (git-file-name "lib-base-for-telegram-desktop" %telegram-version))
131 (sha256
132 (base32
133 "1fnirqxj4qq1gzx52rydrc5r6clw3316bh51dfg652jr8hj6wkp2"))))
134
135(define lib-crl-for-telegram-desktop
136 (origin
137 (method git-fetch)
138 (uri (git-reference
139 (url "https://github.com/desktop-app/lib_crl.git")
140 (commit "4e620bc383d032aadea8e6af02661f8c76695cec")))
141 (file-name
142 (git-file-name "lib-crl-for-telegram-desktop" %telegram-version))
143 (sha256
144 (base32
145 "17bngj247qwq0dg4h37xdi5v1mk22y4yp7sp6ph3irmnz4awah0x"))))
146
147(define lib-lottie-for-telegram-desktop
148 (origin
149 (method git-fetch)
150 (uri (git-reference
151 (url "https://github.com/desktop-app/lib_lottie.git")
152 (commit "6ed1c22ed60692d2f288c9222fafd7d5cd62f904")))
153 (file-name
154 (git-file-name "lib-lottie-for-telegram-desktop" %telegram-version))
155 (sha256
156 (base32
157 "0l57ibfij9xm4ww4s9cc63q1x8xzpc6ablwaji1krrn3xxksqdd4"))))
158
159(define lib-qr-for-telegram-desktop
160 (origin
161 (method git-fetch)
162 (uri (git-reference
163 (url "https://github.com/desktop-app/lib_qr.git")
164 (commit "501f4c3502fd872ab4d777df8911bdac32de7c48")))
165 (file-name
166 (git-file-name "lib-qr-for-telegram-desktop" %telegram-version))
167 (sha256
168 (base32
169 "0hmwqj7a9vcy8wq7pd1qprl68im3zl5f1wzcn2zzk2wvi0389k9f"))))
170
171(define lib-rpl-for-telegram-desktop
172 (origin
173 (method git-fetch)
174 (uri (git-reference
175 (url "https://github.com/desktop-app/lib_rpl.git")
176 (commit "fd31f5bf382d2679eccdb1abaf8240a56c6a7abe")))
177 (file-name
178 (git-file-name "lib-rpl-for-telegram-desktop" %telegram-version))
179 (sha256
180 (base32
181 "1fpq8nyh8wx6zkb3sjjrx9ydqzyhw4483bdk1i9blp0ijn9xxdxf"))))
182
183(define lib-spellcheck-for-telegram-desktop
184 (origin
185 (method git-fetch)
186 (uri (git-reference
187 (url "https://github.com/desktop-app/lib_spellcheck.git")
188 (commit "0e386e22cb6ba8a114b569840a635e096dcb645e")))
189 (file-name
190 (git-file-name "lib-spellcheck-for-telegram-desktop" %telegram-version))
191 (sha256
192 (base32
193 "06js7ccv6z3nbd4v2p4hp2prrlmz5ww46y3yb922pp7gm317dwyw"))))
194
195(define lib-storage-for-telegram-desktop
196 (origin
197 (method git-fetch)
198 (uri (git-reference
199 (url "https://github.com/desktop-app/lib_storage.git")
200 (commit "839609369d04615475cb1518636de3619106a917")))
201 (file-name
202 (git-file-name "lib-storage-for-telegram-desktop" %telegram-version))
203 (sha256
204 (base32
205 "1l26h2fmqp9dcpr6pfvdd5sjb68j7yh0ms2lnr8na7jf5xqmkwwm"))))
206
207(define lib-tl-for-telegram-desktop
208 (origin
209 (method git-fetch)
210 (uri (git-reference
211 (url "https://github.com/desktop-app/lib_tl.git")
212 (commit "36fb95c4de1339d2c8921ad6b2911858c3d0e0fa")))
213 (file-name
214 (git-file-name "lib-tl-for-telegram-desktop" %telegram-version))
215 (sha256
216 (base32
217 "03rngnssnqwr7ad05qn64mwgji5fb0r3fp5ybkf951p8phr1jvzk"))))
218
219(define lib-ui-for-telegram-desktop
220 (origin
221 (method git-fetch)
222 (uri (git-reference
223 (url "https://github.com/desktop-app/lib_ui.git")
224 (commit "1ceaa0bbcfccb83dbf7f51d7f80a733ff2aa8c22")))
225 (file-name
226 (git-file-name "lib-ui-for-telegram-desktop" %telegram-version))
227 (sha256
228 (base32
229 "0kyrgxi202xwy14mnx62h1kny0434f5fxqns1ydp24q2c2cr1cxn"))))
230
231(define lib-webrtc-for-telegram-desktop
232 (origin
233 (method git-fetch)
234 (uri (git-reference
235 (url "https://github.com/desktop-app/lib_webrtc.git")
236 (commit "9b11599c3c56047cfa4c68b69f1fcc93b602c33a")))
237 (file-name
238 (git-file-name "lib-webrtc-for-telegram-desktop" %telegram-version))
239 (sha256
240 (base32
241 "0158jx8hj4fv6qpw5pgcr2mdlihj0dxs060dg3iy61zz6q68z5dq"))))
242
243(define lib-webview-for-telegram-desktop
244 (origin
245 (method git-fetch)
246 (uri (git-reference
247 (url "https://github.com/desktop-app/lib_webview.git")
248 (commit "546df65eb2424550ed84ce14fc9c5d1bb3586f35")))
249 (file-name
250 (git-file-name "lib-webview-for-telegram-desktop" %telegram-version))
251 (sha256
252 (base32
253 "0zzjwyw82bggncmmsw969lnjl04pklmqjqm77jjzadinivl52z0l"))))
254
255(define tgcalls-for-telegram-desktop
256 (origin
257 (method git-fetch)
258 (uri (git-reference
259 (url "https://github.com/TelegramMessenger/tgcalls.git")
260 (commit "82c4921045c440b727c38e464f3a0539708423ff")))
261 (file-name
262 (git-file-name "tgcalls-for-telegram-desktop" %telegram-version))
263 (sha256
264 (base32
265 "1109r17abh66yz91b65fn2g4ryfybnsr5g6075sjhbah1gccv9mk"))))
266
267(define-public webrtc-for-telegram-desktop
268 (let ((commit "621f3da55331733bf0d1b223786b96b68c03dca1")
269 (revision "327"))
270 (hidden-package
271 (package
272 (name "webrtc-for-telegram-desktop")
273 (version
274 (git-version "0" revision commit))
275 (source
276 (origin
277 (method git-fetch)
278 (uri
279 (git-reference
280 (url "https://github.com/desktop-app/tg_owt.git")
281 (commit commit)))
282 (file-name
283 (git-file-name name version))
284 (sha256
285 (base32 "1ks1572k1jj7pmzwm79p2gdgi31dd4bs761bphnx32zyq4c6skxk"))
286 (patches
287 (search-patches
288 ;; https://github.com/desktop-app/tg_owt/pull/101
289 "webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch"))
290 (modules '((guix build utils)
291 (ice-9 ftw)
292 (srfi srfi-1)))
293 (snippet
294 #~(begin
295 (let ((keep
296 '("abseil-cpp" "libsrtp" "rnnoise"
297 ;; Not available in Guix.
298 "pffft")))
299 (with-directory-excursion "src/third_party"
300 (for-each delete-file-recursively
301 (lset-difference string=?
302 (scandir ".")
303 (cons* "." ".." keep)))))
304 ;; Unbundle openh264.
305 (substitute* "CMakeLists.txt"
306 (("\\include\\(cmake\\/libopenh264\\.cmake\\)")""))))))
307 (build-system cmake-build-system)
308 (arguments
309 (list
310 #:tests? #f ; No target
311 #:phases
312 #~(modify-phases %standard-phases
313 (add-after 'unpack 'unpack-additional-sources
314 (lambda _
315 (let* ((third-party (string-append (getcwd) "/src/third_party"))
316 (crc32c-to (string-append third-party "/crc32c/src"))
317 (libyuv-to (string-append third-party "/libyuv")))
318 (copy-recursively #$(package-source crc32c) crc32c-to)
319 (copy-recursively #$libyuv-for-telegram-desktop
320 libyuv-to)))))))
321 (native-inputs (list pkg-config python-wrapper yasm))
322 (inputs
323 (list abseil-cpp-cxxstd17
324 ffmpeg
325 glib
326 libdrm
327 libglvnd
328 libjpeg-turbo
329 libvpx
330 libxcomposite
331 libxdamage
332 libxext
333 libxfixes
334 libxrandr
335 libxrender
336 libxtst
337 mesa
338 openh264
339 openssl
340 opus
341 pipewire-0.3
342 protobuf))
343 (synopsis "WebRTC support for Telegram Desktop")
344 (description "WebRTC-for-Telegram-Desktop is a custom WebRTC fork by
345Telegram project, for its use in telegram desktop client.")
346 (home-page "https://github.com/desktop-app/tg_owt")
347 (license
348 (list
349 ;; Abseil-CPP
350 license:asl2.0
351 ;; LibYuv
352 (license:non-copyleft "file:///src/third_party/libyuv/LICENSE")
353 ;; PFFFT
354 (license:non-copyleft "file:///src/third_party/pffft/LICENSE")
355 ;; RnNoise
356 license:gpl3
357 ;; LibSRTP, Crc32c and Others
358 license:bsd-3))))))
359
360(define-public rlottie-for-telegram-desktop
361 (let ((commit "8c69fc20cf2e150db304311f1233a4b55a8892d7")
362 (revision "678"))
363 (hidden-package
364 (package
365 (inherit rlottie)
366 (version
367 (git-version "0.0.1" revision commit))
368 (source
369 (origin
370 (method git-fetch)
371 (uri
372 (git-reference
373 (url "https://github.com/desktop-app/rlottie.git")
374 (commit commit)))
375 (file-name
376 (git-file-name "rlottie-for-telegram-desktop" version))
377 (sha256
378 (base32 "14gwg3sn6xdx9ymnx5r0vfm4pk8dwk92s10a1wdvfbjpyrxll64i"))
379 (modules '((guix build utils)))
380 (snippet
381 #~(begin
382 (substitute* "meson.build"
383 (("werror=true") "werror=false"))))))))))
384
385(define-public telegram-desktop
386 (package
387 (name "telegram-desktop")
388 (version %telegram-version)
389 (source
390 (origin
391 (method git-fetch)
392 (uri
393 (git-reference
394 (url "https://github.com/telegramdesktop/tdesktop.git")
395 (commit
396 (string-append "v" version))))
397 (file-name
398 (git-file-name name version))
399 (sha256
400 (base32 "16mcx4gwkl8s70a8gppxczmjsww1a3vmdrz3snfh986nvid64mq7"))
401 (patches
402 (search-patches
403 ;; https://github.com/telegramdesktop/tdesktop/pull/24126
404 "telegram-desktop-allow-disable-libtgvoip.patch"))
405 (modules '((guix build utils)
406 (ice-9 ftw)
407 (srfi srfi-1)))
408 (snippet
409 #~(begin
410 (let ((keep
411 '(;; Not available in Guix.
412 "tgcalls")))
413 (with-directory-excursion "Telegram/ThirdParty"
414 (for-each delete-file-recursively
415 (lset-difference string=?
416 (scandir ".")
417 (cons* "." ".." keep)))))))))
418 (build-system qt-build-system)
419 (arguments
420 (list #:tests? #f ; No target
421 #:imported-modules
422 `(,@%qt-build-system-modules
423 (guix build glib-or-gtk-build-system))
424 #:modules
425 '((guix build qt-build-system)
426 ((guix build glib-or-gtk-build-system)
427 #:prefix glib-or-gtk:)
428 (guix build utils)
429 (ice-9 match))
430 #:configure-flags
431 #~(list
432 ;; Client applications must provide their own API-ID and API-HASH,
433 ;; see also <https://core.telegram.org/api/obtaining_api_id>.
434 ;; Here, we snarf the keys from the official Snaps, which are
435 ;; also stored in <#$source/snap/snapcraft.yaml>.
436 "-DTDESKTOP_API_ID=611335"
437 "-DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c"
438 "-DTDESKTOP_DISABLE_LEGACY_TGVOIP=ON"
439 "-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON"
440 "-DDESKTOP_APP_DISABLE_AUTOUPDATE=ON"
441 "-DDESKTOP_APP_USE_PACKAGED_RLOTTIE=ON")
442 #:phases
443 #~(modify-phases %standard-phases
444 (add-after 'unpack 'unpack-additional-sources
445 (lambda _
446 (for-each make-file-writable (find-files "."))
447 (for-each
448 (match-lambda
449 ((dst src)
450 (copy-recursively src dst)
451 (for-each make-file-writable (find-files dst))))
452 '(("cmake" #$cmake-helpers-for-telegram-desktop)
453 ("Telegram/codegen" #$codegen-for-telegram-desktop)
454 ("Telegram/lib_base" #$lib-base-for-telegram-desktop)
455 ("Telegram/lib_crl" #$lib-crl-for-telegram-desktop)
456 ("Telegram/lib_lottie" #$lib-lottie-for-telegram-desktop)
457 ("Telegram/lib_qr" #$lib-qr-for-telegram-desktop)
458 ("Telegram/lib_rpl" #$lib-rpl-for-telegram-desktop)
459 ("Telegram/lib_spellcheck" #$lib-spellcheck-for-telegram-desktop)
460 ("Telegram/lib_storage" #$lib-storage-for-telegram-desktop)
461 ("Telegram/lib_tl" #$lib-tl-for-telegram-desktop)
462 ("Telegram/lib_ui" #$lib-ui-for-telegram-desktop)
463 ("Telegram/lib_webrtc" #$lib-webrtc-for-telegram-desktop)
464 ("Telegram/lib_webview" #$lib-webview-for-telegram-desktop)
465 ("Telegram/ThirdParty/tgcalls" #$tgcalls-for-telegram-desktop)))))
466 (add-after 'install 'glib-or-gtk-compile-schemas
467 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
468 (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
469 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
470 (native-inputs
471 (list `(,glib "bin")
472 `(,gtk+ "bin")
473 pkg-config
474 python-wrapper))
475 (inputs
476 (list abseil-cpp-cxxstd17
477 alsa-lib
478 c++-gsl
479 fcitx-qt5
480 fcitx5-qt
481 ffmpeg
482 glib
483 glibmm-2.64
484 gtk+
485 hime
486 hunspell
487 jemalloc
488 kcoreaddons
489 libdispatch
490 libexpected
491 libjpeg-turbo
492 libvpx
493 libxcb
494 lz4
495 minizip
496 nimf
497 openal
498 openssl
499 opus
500 pulseaudio
501 qrcodegen-cpp
502 qtbase-5
503 qtimageformats
504 qtsvg-5
505 qtwayland-5
506 range-v3
507 rlottie-for-telegram-desktop
508 rnnoise
509 wayland
510 webkitgtk
511 webrtc-for-telegram-desktop
512 xcb-util-keysyms
513 xxhash
514 zlib))
515 (synopsis "Telegram Desktop")
516 (description "Telegram desktop is the official desktop version of the
517Telegram instant messenger.")
518 (home-page "https://desktop.telegram.org/")
519 (license
520 (list
521 ;; ThirdParty
522 license:lgpl3
523 ;; Others
524 license:gpl3+))))
525
526(define-public tl-parser
527 (let ((commit "1933e76f8f4fb74311be723b432e4c56e3a5ec06")
528 (revision "21"))
529 (package
530 (name "tl-parser")
531 (version
532 (git-version "0" revision commit))
533 (source
534 (origin
535 (method git-fetch)
536 (uri
537 (git-reference
538 (url "https://github.com/vysheng/tl-parser.git")
539 (commit commit)))
540 (file-name
541 (git-file-name name version))
542 (sha256
543 (base32 "13cwi247kajzpkbl86hnwmn1sn2h6rqndz6khajbqj0mlw9mv4hq"))))
544 (build-system cmake-build-system)
545 (arguments
546 `(#:tests? #f ; No target
547 #:imported-modules
548 ((guix build copy-build-system)
549 ,@%cmake-build-system-modules)
550 #:modules
551 (((guix build copy-build-system)
552 #:prefix copy:)
553 (guix build cmake-build-system)
554 (guix build utils))
555 #:phases
556 (modify-phases %standard-phases
557 (replace 'install
558 (lambda args
559 (apply (assoc-ref copy:%standard-phases 'install)
560 #:install-plan
561 '(("." "bin"
562 #:include ("tl-parser"))
563 ("../source" "include/tl-parser"
564 #:include-regexp ("\\.h$")))
565 args))))))
566 (synopsis "Parse tl scheme to tlo")
567 (description "TL-Parser is a tl scheme to tlo file parser. It was
568formerly a part of telegram-cli, but now being maintained separately.")
569 (home-page "https://github.com/vysheng/tl-parser")
570 (license license:gpl2+))))
571
572(define-public tgl
573 (let ((commit "ffb04caca71de0cddf28cd33a4575922900a59ed")
574 (revision "181"))
575 (package
576 (name "tgl")
577 (version
578 (git-version "2.0.1" revision commit))
579 (source
580 (origin
581 (method git-fetch)
582 (uri
583 (git-reference
584 (url "https://github.com/vysheng/tgl.git")
585 (commit commit)))
586 (file-name
587 (git-file-name name version))
588 (sha256
589 (base32 "0cf5s7ygslb5klg1qv9qdc3hivhspmvh3zkacyyhd2yyikb5p0f9"))))
590 (build-system gnu-build-system)
591 (arguments
592 `(#:tests? #f ; No target
593 #:imported-modules
594 ((guix build copy-build-system)
595 ,@%gnu-build-system-modules)
596 #:modules
597 (((guix build copy-build-system)
598 #:prefix copy:)
599 (guix build gnu-build-system)
600 (guix build utils))
601 #:configure-flags
602 (list
603 ;; Use gcrypt instead of openssl.
604 "--disable-openssl"
605 ;; Enable extended queries system.
606 "--enable-extf"
607 ;; Include libevent-based net and timers.
608 "--enable-libevent")
609 #:phases
610 (modify-phases %standard-phases
611 (add-after 'unpack 'trigger-bootstrap
612 (lambda _
613 (delete-file "configure")
614 #t))
615 (add-after 'trigger-bootstrap 'patch-tl-parser
616 (lambda _
617 (delete-file "Makefile.tl-parser")
618 (substitute* "Makefile.in"
619 (("include \\$\\{srcdir\\}/Makefile\\.tl-parser")
620 "")
621 (("\\$\\{EXE\\}/tl-parser")
622 "tl-parser"))
623 #t))
624 (replace 'install
625 (lambda args
626 (apply (assoc-ref copy:%standard-phases 'install)
627 #:install-plan
628 '(("bin" "bin")
629 ("." "include/tgl"
630 #:include-regexp ("\\.h$"))
631 ("libs" "lib/tgl"))
632 args))))))
633 (native-inputs
634 (list autoconf automake libtool pkg-config))
635 (inputs
636 (list libevent libgcrypt tl-parser zlib))
637 (synopsis "Telegram Library")
638 (description "TGL is the telegram library for telegram-cli.")
639 (home-page "https://github.com/vysheng/tgl")
640 (license license:lgpl2.1+))))
641
642(define-public telegram-cli
643 (let ((commit "6547c0b21b977b327b3c5e8142963f4bc246187a")
644 (revision "324"))
645 (package
646 (name "telegram-cli")
647 (version
648 (git-version "1.3.1" revision commit))
649 (source
650 (origin
651 (method git-fetch)
652 (uri
653 (git-reference
654 (url "https://github.com/vysheng/tg.git")
655 (commit commit)))
656 (file-name
657 (git-file-name name version))
658 (sha256
659 (base32 "0c1w7jgska71jjbvg1y09v52549pwa4zkdjly18yxywn7gayd2p6"))))
660 (build-system gnu-build-system)
661 (arguments
662 `(#:tests? #f ; No target
663 #:imported-modules
664 ((guix build copy-build-system)
665 ,@%gnu-build-system-modules)
666 #:modules
667 (((guix build copy-build-system)
668 #:prefix copy:)
669 (guix build gnu-build-system)
670 (guix build utils))
671 #:configure-flags
672 (list
673 ;; Use gcrypt instead of openssl.
674 "--disable-openssl")
675 #:phases
676 (modify-phases %standard-phases
677 (add-after 'unpack 'trigger-bootstrap
678 (lambda _
679 (delete-file "configure")
680 #t))
681 (add-after 'trigger-bootstrap 'patch-tgl-and-tlparser
682 (lambda* (#:key inputs #:allow-other-keys)
683 (for-each delete-file
684 (list
685 "Makefile.tgl"
686 "Makefile.tl-parser"))
687 (substitute* "Makefile.in"
688 (("include \\$\\{srcdir\\}/Makefile\\.tl-parser")
689 "")
690 (("include \\$\\{srcdir\\}/Makefile\\.tgl")
691 "")
692 (("-I\\$\\{srcdir\\}/tgl")
693 (string-append "-I" (assoc-ref inputs "tgl")
694 "/include/tgl"))
695 (("AUTO=auto")
696 (string-append "AUTO=" (assoc-ref inputs "tgl")
697 "/include/tgl/auto"))
698 (("LIB=libs")
699 (string-append "LIB=" (assoc-ref inputs "tgl")
700 "/lib/tgl")))
701 #t))
702 (replace 'install
703 (lambda args
704 (apply (assoc-ref copy:%standard-phases 'install)
705 #:install-plan
706 '(("bin" "bin")
707 ("." "etc/telegram-cli"
708 #:include-regexp ("\\.pub$")
709 #:exclude ("tg-server.pub")))
710 args))))))
711 (native-inputs
712 (list autoconf automake libtool pkg-config))
713 (inputs
714 (list jansson
715 libconfig
716 libevent
717 libgcrypt
718 lua
719 openssl
720 perl
721 python
722 readline
723 tgl
724 tl-parser
725 zlib))
726 (synopsis "Telegram Messenger CLI")
727 (description "TG is the command-line interface for Telegram Messenger.")
728 (home-page "https://github.com/vysheng/tg")
729 (license license:gpl2+))))
730
731(define-public tgcli
732 (package
733 (name "tgcli")
734 (version "0.3.1")
735 (source
736 (origin
737 (method git-fetch)
738 (uri
739 (git-reference
740 (url "https://github.com/erayerdin/tgcli")
741 (commit (string-append "v" version))))
742 (file-name
743 (git-file-name name version))
744 (sha256
745 (base32 "082zim7rh4r8qyscqimjh2sz7998vv9j1i2y2wwz2rgrlhkhly5r"))))
746 (build-system python-build-system)
747 (arguments
748 `(#:phases
749 (modify-phases %standard-phases
750 ;; Test requirements referes to specific versions of packages,
751 ;; which are too old. So we patch them to refer to any later versions.
752 (add-after 'unpack 'patch-test-requirements
753 (lambda _
754 (substitute* "dev.requirements.txt"
755 (("==") ">="))))
756 (replace 'check
757 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
758 (when tests?
759 (add-installed-pythonpath inputs outputs)
760 (invoke "pytest" "tests")))))))
761 (native-inputs
762 `(("coveralls" ,python-coveralls)
763 ("pytest" ,python-pytest)
764 ("pytest-click" ,python-pytest-click)
765 ("pytest-cov" ,python-pytest-cov)
766 ("mkdocs" ,python-mkdocs)
767 ("mkdocs-material" ,python-mkdocs-material)
768 ("requests-mock" ,python-requests-mock)))
769 (propagated-inputs
770 `(("click" ,python-click)
771 ("colorful" ,python-colorful)
772 ("requests" ,python-requests)
773 ("yaspin" ,python-yaspin)))
774 (home-page "https://tgcli.readthedocs.io")
775 (synopsis "Telegram Terminal Application")
776 (description "TgCli is a telegram client to automate repetitive tasks.")
777 (license license:asl2.0)))