gnu: telegram-desktop: Use modern package style.
[jackhill/guix/guix.git] / gnu / packages / telegram.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
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.
10 ;;;
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.
15 ;;;
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/>.
18
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 check)
27 #:use-module (gnu packages cmake)
28 #:use-module (gnu packages compression)
29 #:use-module (gnu packages cpp)
30 #:use-module (gnu packages digest)
31 #:use-module (gnu packages fcitx)
32 #:use-module (gnu packages fcitx5)
33 #:use-module (gnu packages glib)
34 #:use-module (gnu packages gnome)
35 #:use-module (gnu packages gnupg)
36 #:use-module (gnu packages gtk)
37 #:use-module (gnu packages image)
38 #:use-module (gnu packages jemalloc)
39 #:use-module (gnu packages kde-frameworks)
40 #:use-module (gnu packages language)
41 #:use-module (gnu packages libevent)
42 #:use-module (gnu packages libreoffice)
43 #:use-module (gnu packages linux)
44 #:use-module (gnu packages lxqt)
45 #:use-module (gnu packages lua)
46 #:use-module (gnu packages perl)
47 #:use-module (gnu packages pkg-config)
48 #:use-module (gnu packages protobuf)
49 #:use-module (gnu packages pulseaudio)
50 #:use-module (gnu packages python)
51 #:use-module (gnu packages python-check)
52 #:use-module (gnu packages python-web)
53 #:use-module (gnu packages python-xyz)
54 #:use-module (gnu packages qt)
55 #:use-module (gnu packages readline)
56 #:use-module (gnu packages textutils)
57 #:use-module (gnu packages telephony)
58 #:use-module (gnu packages tls)
59 #:use-module (gnu packages video)
60 #:use-module (gnu packages web)
61 #:use-module (gnu packages xiph)
62 #:use-module (gnu packages xorg)
63 #:use-module ((guix licenses) #:prefix license:)
64 #:use-module (guix packages)
65 #:use-module (guix gexp)
66 #:use-module (guix git-download)
67 #:use-module (guix build-system cmake)
68 #:use-module (guix build-system copy)
69 #:use-module (guix build-system glib-or-gtk)
70 #:use-module (guix build-system gnu)
71 #:use-module (guix build-system meson)
72 #:use-module (guix build-system python)
73 #:use-module (guix build-system qt))
74
75 (define %telegram-version "2.9.3")
76
77 (define libvpx-for-telegram-desktop
78 (let ((commit "5b63f0f821e94f8072eb483014cfc33b05978bb9")
79 (revision "112"))
80 (origin
81 (method git-fetch)
82 (uri (git-reference
83 (url "https://chromium.googlesource.com/webm/libvpx")
84 (commit commit)))
85 (file-name (git-file-name
86 "libvpx-for-telegram-desktop"
87 (git-version "1.9.0" revision commit)))
88 (sha256
89 (base32
90 "1psvxaddihlw1k5n0anxif3qli6zyw2sa2ywn6mkb8six9myrp68")))))
91
92 (define libyuv-for-telegram-desktop
93 (let ((commit "ad890067f661dc747a975bc55ba3767fe30d4452")
94 (revision "2211"))
95 (origin
96 (method git-fetch)
97 (uri (git-reference
98 (url "https://chromium.googlesource.com/libyuv/libyuv")
99 (commit commit)))
100 (file-name (git-file-name
101 "libyuv-for-telegram-desktop"
102 (git-version "0" revision commit)))
103 (sha256
104 (base32
105 "01knnk4h247rq536097n9n3s3brxlbby3nv3ppdgsqfda3k159ll")))))
106
107 (define cmake-helpers-for-telegram-desktop
108 (origin
109 (method git-fetch)
110 (uri (git-reference
111 (url "https://github.com/desktop-app/cmake_helpers.git")
112 (commit "4d44d822e01b3b5fbec3ce824e01f56aa35d7f72")))
113 (file-name
114 (git-file-name "cmake-helpers-for-telegram-desktop" %telegram-version))
115 (sha256
116 (base32
117 "0h6cjiqy014h2mz90h1z5a7plb3ihbnds4bja8994ybr1dy3m7m5"))))
118
119 (define codegen-for-telegram-desktop
120 (origin
121 (method git-fetch)
122 (uri (git-reference
123 (url "https://github.com/desktop-app/codegen.git")
124 (commit "248614b49cd7d5aff69d75a737f2e35b79fbb119")))
125 (file-name
126 (git-file-name "codegen-for-telegram-desktop" %telegram-version))
127 (sha256
128 (base32
129 "00f7g2z6xmkbkrmi3q27hscjl44mg66wf9q0mz3rhy3jaa6cfdrk"))))
130
131 (define lib-base-for-telegram-desktop
132 (origin
133 (method git-fetch)
134 (uri (git-reference
135 (url "https://github.com/desktop-app/lib_base.git")
136 (commit "a23c05c44e4f01dc4428f4d75d4db98c59d313a6")))
137 (file-name
138 (git-file-name "lib-base-for-telegram-desktop" %telegram-version))
139 (sha256
140 (base32
141 "0vh5zgxwalmbnvz8lzlnba87ch8vnpmcz6nvf56w09f3nlxvvq78"))))
142
143 (define lib-crl-for-telegram-desktop
144 (origin
145 (method git-fetch)
146 (uri (git-reference
147 (url "https://github.com/desktop-app/lib_crl.git")
148 (commit "3ccf2ed5095442e5874bba8852cb7dc4efeae29f")))
149 (file-name
150 (git-file-name "lib-crl-for-telegram-desktop" %telegram-version))
151 (sha256
152 (base32
153 "11my7q54m4lvvlgma6pbdyjxi1cv1adk1gph2j50mh18sqlm8myz"))))
154
155 (define lib-lottie-for-telegram-desktop
156 (origin
157 (method git-fetch)
158 (uri (git-reference
159 (url "https://github.com/desktop-app/lib_lottie.git")
160 (commit "0770df009db7928df1d0cad0900dc5110106d229")))
161 (file-name
162 (git-file-name "lib-lottie-for-telegram-desktop" %telegram-version))
163 (sha256
164 (base32
165 "1gj56ymlbk5dnk82jw674808m511lv9dky8891a5wm4gp3pph5jb"))))
166
167 (define lib-qr-for-telegram-desktop
168 (origin
169 (method git-fetch)
170 (uri (git-reference
171 (url "https://github.com/desktop-app/lib_qr.git")
172 (commit "2b08c71c6edcfc3e31f7d7f518cc963493b6e189")))
173 (file-name
174 (git-file-name "lib-qr-for-telegram-desktop" %telegram-version))
175 (sha256
176 (base32
177 "05hrkmwgrczyjv87r507i2r7m1zr6k2i43mq3my0s6j4szr1rjq0"))))
178
179 (define lib-rlottie-for-telegram-desktop
180 (origin
181 (method git-fetch)
182 (uri (git-reference
183 (url "https://github.com/desktop-app/lib_rlottie.git")
184 (commit "0671bf70547381effcf442ec9618e04502a8adbc")))
185 (file-name
186 (git-file-name "lib-rlottie-for-telegram-desktop" %telegram-version))
187 (sha256
188 (base32
189 "05qnza7j15356s8jq16pkbyp4zr586lssmd86lz5jq23lcb3raxv"))))
190
191 (define lib-rpl-for-telegram-desktop
192 (origin
193 (method git-fetch)
194 (uri (git-reference
195 (url "https://github.com/desktop-app/lib_rpl.git")
196 (commit "df721be3fa14a27dfc230d2e3c42bb1a7c9d0617")))
197 (file-name
198 (git-file-name "lib-rpl-for-telegram-desktop" %telegram-version))
199 (sha256
200 (base32
201 "15fnv3ssn7rn5d0j52gggdvyqc2wm464678dj7v2x9h8lka2jjxn"))))
202
203 (define lib-spellcheck-for-telegram-desktop
204 (origin
205 (method git-fetch)
206 (uri (git-reference
207 (url "https://github.com/desktop-app/lib_spellcheck.git")
208 (commit "68c9b788958904aea7de79f986a0f82ec8c5b094")))
209 (file-name
210 (git-file-name "lib-spellcheck-for-telegram-desktop" %telegram-version))
211 (sha256
212 (base32
213 "0d8s4wwk6fxf536mhzq2vb9qw3j0m8nqia7ylvvpsbc4kh09dadn"))))
214
215 (define lib-storage-for-telegram-desktop
216 (origin
217 (method git-fetch)
218 (uri (git-reference
219 (url "https://github.com/desktop-app/lib_storage.git")
220 (commit "403df6c4a29562bd417c92d410e49819f5a48cc1")))
221 (file-name
222 (git-file-name "lib-storage-for-telegram-desktop" %telegram-version))
223 (sha256
224 (base32
225 "1zxvzfrxbj4d395fzyb5pm9wn3n8jyimxx88cyqjcdd46sx4h7r5"))))
226
227 (define lib-tl-for-telegram-desktop
228 (origin
229 (method git-fetch)
230 (uri (git-reference
231 (url "https://github.com/desktop-app/lib_tl.git")
232 (commit "45faed44e7f4d11fec79b7a70e4a35dc91ef3fdb")))
233 (file-name
234 (git-file-name "lib-tl-for-telegram-desktop" %telegram-version))
235 (sha256
236 (base32
237 "0h43xvzklda02494d466jp52hl8c1kmav9f12dyld10dpf1w6c7m"))))
238
239 (define lib-ui-for-telegram-desktop
240 (origin
241 (method git-fetch)
242 (uri (git-reference
243 (url "https://github.com/desktop-app/lib_ui.git")
244 (commit "1b590f9e16eb9571a039f072d6fea66c607e419f")))
245 (file-name
246 (git-file-name "lib-ui-for-telegram-desktop" %telegram-version))
247 (sha256
248 (base32
249 "0ighyhfp29h9h8c7vr70pnhcv2xnsr9ln084pssn8hb5z4pmb62f"))))
250
251 (define lib-waylandshells-for-telegram-desktop
252 (origin
253 (method git-fetch)
254 (uri (git-reference
255 (url "https://github.com/desktop-app/lib_waylandshells.git")
256 (commit "59b0ee55a68976d27f1bf7cec0e11d5939e185e7")))
257 (file-name
258 (git-file-name "lib-waylandshells-for-telegram-desktop" %telegram-version))
259 (sha256
260 (base32
261 "0l2xrpc5mvvdlsj333pmkgfvn9wi1ijfdaaz8skfnw9icw52faaf"))))
262
263 (define lib-webrtc-for-telegram-desktop
264 (origin
265 (method git-fetch)
266 (uri (git-reference
267 (url "https://github.com/desktop-app/lib_webrtc.git")
268 (commit "ef49f953f12b112008a094a719f40939aaf39db4")))
269 (file-name
270 (git-file-name "lib-webrtc-for-telegram-desktop" %telegram-version))
271 (sha256
272 (base32
273 "15k4xs3462p3ddp5cn9im3nvdiaijmxir8wxsf5yrj70ghy26ibw"))))
274
275 (define lib-webview-for-telegram-desktop
276 (origin
277 (method git-fetch)
278 (uri (git-reference
279 (url "https://github.com/desktop-app/lib_webview.git")
280 (commit "e06427c624515485774e2e2181d4afeb05ad5a67")))
281 (file-name
282 (git-file-name "lib-webview-for-telegram-desktop" %telegram-version))
283 (sha256
284 (base32
285 "148z7xzfscynwwwqssdsd97npax6yn8zrd64xw8qzbwff2g2r7k4"))))
286
287 (define tgcalls-for-telegram-desktop
288 (origin
289 (method git-fetch)
290 (uri (git-reference
291 (url "https://github.com/TelegramMessenger/tgcalls.git")
292 (commit "81e97fa52e25b7775b62ce07bb653533d81e91b3")))
293 (file-name
294 (git-file-name "tgcalls-for-telegram-desktop" %telegram-version))
295 (sha256
296 (base32
297 "0fvad87hyxli83xn19mgf8jjrrh6y6iaig14pckpbkg33vf4wqkj"))))
298
299 (define-public webrtc-for-telegram-desktop
300 (let ((commit "91d836dc84a16584c6ac52b36c04c0de504d9c34")
301 (revision "166"))
302 (hidden-package
303 (package
304 (name "webrtc-for-telegram-desktop")
305 (version
306 (git-version "0" revision commit))
307 (source
308 (origin
309 (method git-fetch)
310 (uri
311 (git-reference
312 (url "https://github.com/desktop-app/tg_owt.git")
313 (commit commit)))
314 (file-name
315 (git-file-name name version))
316 (sha256
317 (base32 "0plwdp6xgxi27hif5j7kpq425cidxyxbbga3z2f64dsninwy5p1x"))
318 (modules '((guix build utils)
319 (ice-9 ftw)
320 (srfi srfi-1)))
321 (snippet
322 #~(begin
323 (let ((keep
324 '( ;; Custom forks which are incompatible with the ones in Guix.
325 "abseil-cpp" "libsrtp" "openh264" "rnnoise"
326 ;; Not available in Guix.
327 "pffft" "usrsctp"
328 ;; Has cmake support files for libvpx input.
329 "libvpx")))
330 (with-directory-excursion "src/third_party"
331 (for-each delete-file-recursively
332 (lset-difference string=?
333 (scandir ".")
334 (cons* "." ".." keep)))))))))
335 (build-system cmake-build-system)
336 (arguments
337 (list
338 #:tests? #f ; No target
339 #:configure-flags #~(list "-DCMAKE_C_FLAGS=-fPIC"
340 "-DCMAKE_CXX_FLAGS=-fPIC")
341 #:phases
342 #~(modify-phases %standard-phases
343 (add-after 'unpack 'copy-inputs
344 (lambda _
345 (let* ((third-party (string-append (getcwd) "/src/third_party"))
346 (libvpx-to (string-append third-party
347 "/libvpx/source/libvpx"))
348 (libyuv-to (string-append third-party "/libyuv")))
349 (copy-recursively #$libvpx-for-telegram-desktop libvpx-to)
350 (copy-recursively #$libyuv-for-telegram-desktop
351 libyuv-to)))))))
352 (native-inputs (list perl pkg-config python-wrapper yasm))
353 (inputs
354 (list alsa-lib
355 ffmpeg
356 libjpeg-turbo
357 glib
358 libxcomposite
359 libxdamage
360 libxrender
361 libxrandr
362 openssl
363 opus
364 pipewire
365 protobuf
366 pulseaudio
367 libx11
368 libxext
369 libxtst))
370 (synopsis "WebRTC support for Telegram Desktop")
371 (description "WebRTC-for-Telegram-Desktop is a custom WebRTC fork by
372 Telegram project, for its use in telegram desktop client.")
373 (home-page "https://github.com/desktop-app/tg_owt")
374 (license
375 (list
376 ;; Abseil-CPP
377 license:asl2.0
378 ;; LibYuv
379 (license:non-copyleft "file:///src/third_party/libyuv/LICENSE")
380 ;; OpenH264
381 license:bsd-2
382 ;; PFFFT
383 (license:non-copyleft "file:///src/third_party/pffft/LICENSE")
384 ;; RnNoise
385 license:gpl3
386 ;; LibSRTP, LibVPx, UsrSCTP and Others
387 license:bsd-3))))))
388
389 (define-public rlottie-for-telegram-desktop
390 (let ((commit "cbd43984ebdf783e94c8303c41385bf82aa36d5b")
391 (revision "671"))
392 (hidden-package
393 (package
394 (inherit rlottie)
395 (version
396 (git-version "0.0.1" revision commit))
397 (source
398 (origin
399 (method git-fetch)
400 (uri
401 (git-reference
402 (url "https://github.com/desktop-app/rlottie.git")
403 (commit commit)))
404 (file-name
405 (git-file-name "rlottie-for-telegram-desktop" version))
406 (sha256
407 (base32 "1lxpbgbhps9rmck036mgmiknqrzpjxpas8n7qxykv6pwzn0c8n0c"))))
408 (arguments
409 `(#:configure-flags
410 (list
411 "-Dlog=true"
412 "-Ddumptree=true"
413 "-Dtest=true")
414 #:phases
415 (modify-phases %standard-phases
416 (add-after 'unpack 'patch-cxx-flags
417 (lambda _
418 (substitute* "meson.build"
419 (("werror=true")
420 "werror=false"))
421 #t)))))))))
422
423 (define-public libtgvoip-for-telegram-desktop
424 (let ((commit "13a5fcb16b04472d808ce122abd695dbf5d206cd")
425 (revision "88"))
426 (hidden-package
427 (package
428 (inherit libtgvoip)
429 (version
430 (git-version "2.4.4" revision commit))
431 (source
432 (origin
433 (method git-fetch)
434 (uri
435 (git-reference
436 (url "https://github.com/telegramdesktop/libtgvoip.git")
437 (commit commit)))
438 (file-name
439 (git-file-name "libtgvoip-for-telegram-desktop" version))
440 (sha256
441 (base32 "12p6s7vxkf1gh1spdckkdxrx7bjzw881ds9bky7l5fw751cwb3xd"))))
442 (arguments
443 `(#:configure-flags
444 (list
445 "--disable-static"
446 "--disable-dsp" ; FIXME
447 "--enable-audio-callback"
448 "--with-alsa"
449 "--with-pulse")
450 #:phases
451 (modify-phases %standard-phases
452 (add-after 'unpack 'patch-linkers
453 (lambda _
454 (substitute* "Makefile.am"
455 (("\\$\\(CRYPTO_LIBS\\) \\$\\(OPUS_LIBS\\)")
456 "$(CRYPTO_LIBS) $(OPUS_LIBS) $(ALSA_LIBS) $(PULSE_LIBS)"))
457 (substitute* "tgvoip.pc.in"
458 (("libcrypto opus")
459 "libcrypto opus alsa libpulse"))
460 #t)))))
461 (native-inputs
462 (list autoconf automake libtool pkg-config))))))
463
464 (define-public telegram-desktop
465 (package
466 (name "telegram-desktop")
467 (version %telegram-version)
468 (source
469 (origin
470 (method git-fetch)
471 (uri
472 (git-reference
473 (url "https://github.com/telegramdesktop/tdesktop.git")
474 (commit
475 (string-append "v" version))))
476 (file-name
477 (git-file-name name version))
478 (sha256
479 (base32 "0dzf1y3xhqvizg29bd1kya48cjbkq073d2x10ynwcmmx396l4nd8"))
480 (modules '((guix build utils)
481 (ice-9 ftw)
482 (srfi srfi-1)))
483 (snippet
484 #~(begin
485 (let ((keep
486 '( ;; Not available in Guix.
487 "SPMediaKeyTap" "statusnotifieritem" "tgcalls")))
488 (with-directory-excursion "Telegram/ThirdParty"
489 (for-each delete-file-recursively
490 (lset-difference string=?
491 (scandir ".")
492 (cons* "." ".." keep)))))))))
493 (build-system qt-build-system)
494 (arguments
495 (list #:tests? #f ; No target
496 #:imported-modules
497 `(,@%qt-build-system-modules
498 (guix build glib-or-gtk-build-system))
499 #:modules
500 '((guix build qt-build-system)
501 ((guix build glib-or-gtk-build-system)
502 #:prefix glib-or-gtk:)
503 (guix build utils)
504 (ice-9 match))
505 #:configure-flags
506 #~(list
507 ;; Client applications must provide their own API-ID and API-HASH,
508 ;; see also <https://core.telegram.org/api/obtaining_api_id>.
509 ;; In case, that the credentials below fail to work, contact
510 ;; Raghav Gururajan <rg@raghavgururajan.name>
511 "-DTDESKTOP_API_ID=2791056"
512 "-DTDESKTOP_API_HASH=582d6d0b44f7a2de949e99271fd8b3f2"
513 ;; Disable WebkitGTK support as it fails to link
514 "-DDESKTOP_APP_DISABLE_WEBKITGTK=ON"
515 ;; Use bundled fonts as fallback.
516 "-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF")
517 #:phases
518 #~(modify-phases %standard-phases
519 (add-after 'unpack 'make-writable
520 (lambda _
521 (for-each make-file-writable (find-files "."))))
522 (add-after 'make-writable 'copy-inputs
523 (lambda _
524 (for-each
525 (match-lambda
526 ((dst src)
527 (copy-recursively src dst)
528 (for-each make-file-writable (find-files dst))))
529 '(("cmake" #$cmake-helpers-for-telegram-desktop)
530 ("Telegram/codegen" #$codegen-for-telegram-desktop)
531 ("Telegram/lib_base" #$lib-base-for-telegram-desktop)
532 ("Telegram/lib_crl" #$lib-crl-for-telegram-desktop)
533 ("Telegram/lib_lottie" #$lib-lottie-for-telegram-desktop)
534 ("Telegram/lib_qr" #$lib-qr-for-telegram-desktop)
535 ("Telegram/lib_rlottie" #$lib-rlottie-for-telegram-desktop)
536 ("Telegram/lib_rpl" #$lib-rpl-for-telegram-desktop)
537 ("Telegram/lib_spellcheck" #$lib-spellcheck-for-telegram-desktop)
538 ("Telegram/lib_storage" #$lib-storage-for-telegram-desktop)
539 ("Telegram/lib_tl" #$lib-tl-for-telegram-desktop)
540 ("Telegram/lib_ui" #$lib-ui-for-telegram-desktop)
541 ("Telegram/lib_waylandshells" #$lib-waylandshells-for-telegram-desktop)
542 ("Telegram/lib_webrtc" #$lib-webrtc-for-telegram-desktop)
543 ("Telegram/lib_webview" #$lib-webview-for-telegram-desktop)
544 ("Telegram/ThirdParty/tgcalls" #$tgcalls-for-telegram-desktop)))))
545 (add-before 'configure 'patch-cxx-flags
546 (lambda _
547 (substitute* "cmake/options_linux.cmake" (("class-memaccess") "all"))))
548 (add-after 'install 'glib-or-gtk-compile-schemas
549 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
550 (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
551 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
552 (native-inputs
553 (list cmake-shared
554 extra-cmake-modules
555 `(,glib "bin")
556 `(,gtk+ "bin")
557 pkg-config
558 python-wrapper
559 qttools-5))
560 (inputs
561 (list alsa-lib
562 c++-gsl
563 catch2
564 libexpected
565 fcitx-qt5
566 fcitx5-qt
567 ffmpeg
568 glib
569 glibmm-2.64
570 gtk+
571 hime
572 hunspell
573 jemalloc
574 kwayland
575 libdbusmenu-qt
576 libjpeg-turbo
577 libtgvoip-for-telegram-desktop
578 lz4
579 materialdecoration
580 minizip
581 nimf
582 openal
583 openssl
584 opus
585 pulseaudio
586 qrcodegen-cpp
587 qtbase-5
588 qtsvg-5
589 qt5ct
590 qtimageformats
591 qtwayland
592 range-v3
593 rlottie-for-telegram-desktop
594 rnnoise
595 webrtc-for-telegram-desktop
596 libx11
597 libxcb
598 xcb-util-keysyms
599 xxhash
600 zlib))
601 (propagated-inputs (list dconf))
602 (synopsis "Telegram Desktop")
603 (description "Telegram desktop is the official desktop version of the
604 Telegram instant messenger.")
605 (home-page "https://desktop.telegram.org/")
606 (license
607 (list
608 ;; ThirdParty
609 license:lgpl2.1+
610 ;; Others
611 license:gpl3+))))
612
613 (define-public tl-parser
614 (let ((commit "1933e76f8f4fb74311be723b432e4c56e3a5ec06")
615 (revision "21"))
616 (package
617 (name "tl-parser")
618 (version
619 (git-version "0" revision commit))
620 (source
621 (origin
622 (method git-fetch)
623 (uri
624 (git-reference
625 (url "https://github.com/vysheng/tl-parser.git")
626 (commit commit)))
627 (file-name
628 (git-file-name name version))
629 (sha256
630 (base32 "13cwi247kajzpkbl86hnwmn1sn2h6rqndz6khajbqj0mlw9mv4hq"))))
631 (build-system cmake-build-system)
632 (arguments
633 `(#:tests? #f ; No target
634 #:imported-modules
635 ((guix build copy-build-system)
636 ,@%cmake-build-system-modules)
637 #:modules
638 (((guix build copy-build-system)
639 #:prefix copy:)
640 (guix build cmake-build-system)
641 (guix build utils))
642 #:phases
643 (modify-phases %standard-phases
644 (replace 'install
645 (lambda args
646 (apply (assoc-ref copy:%standard-phases 'install)
647 #:install-plan
648 '(("." "bin"
649 #:include ("tl-parser"))
650 ("../source" "include/tl-parser"
651 #:include-regexp ("\\.h$")))
652 args))))))
653 (synopsis "Parse tl scheme to tlo")
654 (description "TL-Parser is a tl scheme to tlo file parser. It was
655 formerly a part of telegram-cli, but now being maintained separately.")
656 (home-page "https://github.com/vysheng/tl-parser")
657 (license license:gpl2+))))
658
659 (define-public tgl
660 (let ((commit "ffb04caca71de0cddf28cd33a4575922900a59ed")
661 (revision "181"))
662 (package
663 (name "tgl")
664 (version
665 (git-version "2.0.1" revision commit))
666 (source
667 (origin
668 (method git-fetch)
669 (uri
670 (git-reference
671 (url "https://github.com/vysheng/tgl.git")
672 (commit commit)))
673 (file-name
674 (git-file-name name version))
675 (sha256
676 (base32 "0cf5s7ygslb5klg1qv9qdc3hivhspmvh3zkacyyhd2yyikb5p0f9"))))
677 (build-system gnu-build-system)
678 (arguments
679 `(#:tests? #f ; No target
680 #:imported-modules
681 ((guix build copy-build-system)
682 ,@%gnu-build-system-modules)
683 #:modules
684 (((guix build copy-build-system)
685 #:prefix copy:)
686 (guix build gnu-build-system)
687 (guix build utils))
688 #:configure-flags
689 (list
690 ;; Use gcrypt instead of openssl.
691 "--disable-openssl"
692 ;; Enable extended queries system.
693 "--enable-extf"
694 ;; Include libevent-based net and timers.
695 "--enable-libevent")
696 #:phases
697 (modify-phases %standard-phases
698 (add-after 'unpack 'trigger-bootstrap
699 (lambda _
700 (delete-file "configure")
701 #t))
702 (add-after 'trigger-bootstrap 'patch-tl-parser
703 (lambda _
704 (delete-file "Makefile.tl-parser")
705 (substitute* "Makefile.in"
706 (("include \\$\\{srcdir\\}/Makefile\\.tl-parser")
707 "")
708 (("\\$\\{EXE\\}/tl-parser")
709 "tl-parser"))
710 #t))
711 (replace 'install
712 (lambda args
713 (apply (assoc-ref copy:%standard-phases 'install)
714 #:install-plan
715 '(("bin" "bin")
716 ("." "include/tgl"
717 #:include-regexp ("\\.h$"))
718 ("libs" "lib/tgl"))
719 args))))))
720 (native-inputs
721 (list autoconf automake libtool pkg-config))
722 (inputs
723 (list libevent libgcrypt tl-parser zlib))
724 (synopsis "Telegram Library")
725 (description "TGL is the telegram library for telegram-cli.")
726 (home-page "https://github.com/vysheng/tgl")
727 (license license:lgpl2.1+))))
728
729 (define-public telegram-cli
730 (let ((commit "6547c0b21b977b327b3c5e8142963f4bc246187a")
731 (revision "324"))
732 (package
733 (name "telegram-cli")
734 (version
735 (git-version "1.3.1" revision commit))
736 (source
737 (origin
738 (method git-fetch)
739 (uri
740 (git-reference
741 (url "https://github.com/vysheng/tg.git")
742 (commit commit)))
743 (file-name
744 (git-file-name name version))
745 (sha256
746 (base32 "0c1w7jgska71jjbvg1y09v52549pwa4zkdjly18yxywn7gayd2p6"))))
747 (build-system gnu-build-system)
748 (arguments
749 `(#:tests? #f ; No target
750 #:imported-modules
751 ((guix build copy-build-system)
752 ,@%gnu-build-system-modules)
753 #:modules
754 (((guix build copy-build-system)
755 #:prefix copy:)
756 (guix build gnu-build-system)
757 (guix build utils))
758 #:configure-flags
759 (list
760 ;; Use gcrypt instead of openssl.
761 "--disable-openssl")
762 #:phases
763 (modify-phases %standard-phases
764 (add-after 'unpack 'trigger-bootstrap
765 (lambda _
766 (delete-file "configure")
767 #t))
768 (add-after 'trigger-bootstrap 'patch-tgl-and-tlparser
769 (lambda* (#:key inputs #:allow-other-keys)
770 (for-each delete-file
771 (list
772 "Makefile.tgl"
773 "Makefile.tl-parser"))
774 (substitute* "Makefile.in"
775 (("include \\$\\{srcdir\\}/Makefile\\.tl-parser")
776 "")
777 (("include \\$\\{srcdir\\}/Makefile\\.tgl")
778 "")
779 (("-I\\$\\{srcdir\\}/tgl")
780 (string-append "-I" (assoc-ref inputs "tgl")
781 "/include/tgl"))
782 (("AUTO=auto")
783 (string-append "AUTO=" (assoc-ref inputs "tgl")
784 "/include/tgl/auto"))
785 (("LIB=libs")
786 (string-append "LIB=" (assoc-ref inputs "tgl")
787 "/lib/tgl")))
788 #t))
789 (replace 'install
790 (lambda args
791 (apply (assoc-ref copy:%standard-phases 'install)
792 #:install-plan
793 '(("bin" "bin")
794 ("." "etc/telegram-cli"
795 #:include-regexp ("\\.pub$")
796 #:exclude ("tg-server.pub")))
797 args))))))
798 (native-inputs
799 (list autoconf automake libtool pkg-config))
800 (inputs
801 (list jansson
802 libconfig
803 libevent
804 libgcrypt
805 lua
806 openssl
807 perl
808 python
809 readline
810 tgl
811 tl-parser
812 zlib))
813 (synopsis "Telegram Messenger CLI")
814 (description "TG is the command-line interface for Telegram Messenger.")
815 (home-page "https://github.com/vysheng/tg")
816 (license license:gpl2+))))
817
818 (define-public tgcli
819 (package
820 (name "tgcli")
821 (version "0.3.1")
822 (source
823 (origin
824 (method git-fetch)
825 (uri
826 (git-reference
827 (url "https://github.com/erayerdin/tgcli")
828 (commit (string-append "v" version))))
829 (file-name
830 (git-file-name name version))
831 (sha256
832 (base32 "082zim7rh4r8qyscqimjh2sz7998vv9j1i2y2wwz2rgrlhkhly5r"))))
833 (build-system python-build-system)
834 (arguments
835 `(#:phases
836 (modify-phases %standard-phases
837 ;; Test requirements referes to specific versions of packages,
838 ;; which are too old. So we patch them to refer to any later versions.
839 (add-after 'unpack 'patch-test-requirements
840 (lambda _
841 (substitute* "dev.requirements.txt"
842 (("==") ">="))))
843 (replace 'check
844 (lambda* (#:key inputs outputs tests? #:allow-other-keys)
845 (when tests?
846 (add-installed-pythonpath inputs outputs)
847 (invoke "pytest" "tests")))))))
848 (native-inputs
849 `(("coveralls" ,python-coveralls)
850 ("pytest" ,python-pytest)
851 ("pytest-click" ,python-pytest-click)
852 ("pytest-cov" ,python-pytest-cov)
853 ("mkdocs" ,python-mkdocs)
854 ("mkdocs-material" ,python-mkdocs-material)
855 ("requests-mock" ,python-requests-mock)))
856 (propagated-inputs
857 `(("click" ,python-click)
858 ("colorful" ,python-colorful)
859 ("requests" ,python-requests)
860 ("yaspin" ,python-yaspin)))
861 (home-page "https://tgcli.readthedocs.io")
862 (synopsis "Telegram Terminal Application")
863 (description "TgCli is a telegram client to automate repetitive tasks.")
864 (license license:asl2.0)))