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