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