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