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