projects/guix·blob python-team · refs

961 lines · 34.7 KiB

1;;; GNU Guix --- Functional package management for GNU
2;;; Copyright © 2019, 2020 Brett Gilio <[email protected]>
3;;; Copyright © 2021 Raghav Gururajan <[email protected]>
4;;; Copyright © 2022, 2023 Hilton Chain <[email protected]>
5;;; Copyright © 2023 Saku Laesvuori <[email protected]>
6;;; Copyright © 2023 Lu Hui <[email protected]>
7;;; Copyright © 2023 Camilo Q.S. (Distopico) <[email protected]>
8;;; Copyright © 2024 Ricardo Wurmus <[email protected]>
9;;; Copyright © 2024, 2025 dan <[email protected]>
10;;; Copyright © 2025 Sharlatan Hellseher <[email protected]>
11;;; Copyright © 2025 Zheng Junjie <[email protected]>
12;;;
13;;; This file is part of GNU Guix.
14;;;
15;;; GNU Guix is free software; you can redistribute it and/or modify it
16;;; under the terms of the GNU General Public License as published by
17;;; the Free Software Foundation; either version 3 of the License, or (at
18;;; your option) any later version.
19;;;
20;;; GNU Guix is distributed in the hope that it will be useful, but
21;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23;;; GNU General Public License for more details.
24;;;
25;;; You should have received a copy of the GNU General Public License
26;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
27
28(define-module (gnu packages telegram)
29 #:use-module (gnu packages)
30 #:use-module (gnu packages aidc)
31 #:use-module (gnu packages animation)
32 #:use-module (gnu packages assembly)
33 #:use-module (gnu packages audio)
34 #:use-module (gnu packages autotools)
35 #:use-module (gnu packages boost)
36 #:use-module (gnu packages check)
37 #:use-module (gnu packages cmake)
38 #:use-module (gnu packages compression)
39 #:use-module (gnu packages c)
40 #:use-module (gnu packages cpp)
41 #:use-module (gnu packages crypto)
42 #:use-module (gnu packages digest)
43 #:use-module (gnu packages documentation)
44 #:use-module (gnu packages fcitx5)
45 #:use-module (gnu packages freedesktop)
46 #:use-module (gnu packages gl)
47 #:use-module (gnu packages glib)
48 #:use-module (gnu packages gnome)
49 #:use-module (gnu packages gnupg)
50 #:use-module (gnu packages gperf)
51 #:use-module (gnu packages gtk)
52 #:use-module (gnu packages hunspell)
53 #:use-module (gnu packages image)
54 #:use-module (gnu packages kde-frameworks)
55 #:use-module (gnu packages language)
56 #:use-module (gnu packages libevent)
57 #:use-module (gnu packages linux)
58 #:use-module (gnu packages llvm)
59 #:use-module (gnu packages lxqt)
60 #:use-module (gnu packages lua)
61 #:use-module (gnu packages messaging)
62 #:use-module (gnu packages perl)
63 #:use-module (gnu packages php)
64 #:use-module (gnu packages pkg-config)
65 #:use-module (gnu packages protobuf)
66 #:use-module (gnu packages pulseaudio)
67 #:use-module (gnu packages python)
68 #:use-module (gnu packages python-check)
69 #:use-module (gnu packages python-web)
70 #:use-module (gnu packages python-xyz)
71 #:use-module (gnu packages qt)
72 #:use-module (gnu packages readline)
73 #:use-module (gnu packages textutils)
74 #:use-module (gnu packages telephony)
75 #:use-module (gnu packages tls)
76 #:use-module (gnu packages video)
77 #:use-module (gnu packages web)
78 #:use-module (gnu packages webkit)
79 #:use-module (gnu packages xdisorg)
80 #:use-module (gnu packages xiph)
81 #:use-module (gnu packages xorg)
82 #:use-module ((guix licenses) #:prefix license:)
83 #:use-module (guix packages)
84 #:use-module (guix gexp)
85 #:use-module (guix git-download)
86 #:use-module (guix build-system cmake)
87 #:use-module (guix build-system copy)
88 #:use-module (guix build-system glib-or-gtk)
89 #:use-module (guix build-system gnu)
90 #:use-module (guix build-system meson)
91 #:use-module (guix build-system qt)
92 #:use-module (guix utils))
93
94(define %telegram-version "6.9.3")
95
96(define libyuv-for-telegram-desktop
97 (let ((commit "04821d1e7d60845525e8db55c7bcd41ef5be9406")
98 (revision "2440"))
99 (origin
100 (method git-fetch)
101 (uri (git-reference
102 (url "https://chromium.googlesource.com/libyuv/libyuv")
103 (commit commit)))
104 (file-name (git-file-name
105 "libyuv-for-telegram-desktop"
106 (git-version "0" revision commit)))
107 (sha256
108 (base32
109 "1fsvc0f8mckrdzys8lnlnbw6676mjamm6p3ghr2h9liqfa83s6wg")))))
110
111(define cmake-helpers-for-telegram-desktop
112 (origin
113 (method git-fetch)
114 (uri (git-reference
115 (url "https://github.com/desktop-app/cmake_helpers.git")
116 (commit "268e9a0330d65ea53c2cfd6aafe9b94f70793cbf")))
117 (file-name
118 (git-file-name "cmake-helpers-for-telegram-desktop" %telegram-version))
119 (patches
120 ;; https://github.com/desktop-app/cmake_helpers/pull/305
121 (search-patches "telegram-desktop-unbundle-cppgir.patch"))
122 (sha256
123 (base32
124 "1da57fbv1lvll6c4hxh1w07bq0vm3p4sm5fzl1rm7lcraqvxmhj0"))))
125
126(define codegen-for-telegram-desktop
127 (origin
128 (method git-fetch)
129 (uri (git-reference
130 (url "https://github.com/desktop-app/codegen.git")
131 (commit "63ec3de7273566aee8c8b11a40c91f3880c217a7")))
132 (file-name
133 (git-file-name "codegen-for-telegram-desktop" %telegram-version))
134 (sha256
135 (base32
136 "0iaa83kxh8hc2np3bd7sp9i3v5ssffxprfwgjmwa7wk24c6b06mw"))))
137
138(define lib-base-for-telegram-desktop
139 (origin
140 (method git-fetch)
141 (uri (git-reference
142 (url "https://github.com/desktop-app/lib_base.git")
143 (commit "4ad72ddc4bee752b996e66170c562a43c546b014")))
144 (file-name
145 (git-file-name "lib-base-for-telegram-desktop" %telegram-version))
146 (sha256
147 (base32
148 "1q220rks87lvpqjsb3vxabgkxir54n473myvif6aj1k8dwa637sr"))))
149
150(define lib-crl-for-telegram-desktop
151 (origin
152 (method git-fetch)
153 (uri (git-reference
154 (url "https://github.com/desktop-app/lib_crl.git")
155 (commit "5b34c118543c6d4c0a1d7fdc7133f9d26fd529e2")))
156 (file-name
157 (git-file-name "lib-crl-for-telegram-desktop" %telegram-version))
158 (sha256
159 (base32
160 "1ahmnkgxhr4s0gqd9h6m63nw2d4cya7109wm40nm35jd8v8nnfqz"))))
161
162(define lib-lottie-for-telegram-desktop
163 (origin
164 (method git-fetch)
165 (uri (git-reference
166 (url "https://github.com/desktop-app/lib_lottie.git")
167 (commit "49d67cf66d3573cd71a3228af47a4ac59b64fc90")))
168 (file-name
169 (git-file-name "lib-lottie-for-telegram-desktop" %telegram-version))
170 (sha256
171 (base32
172 "1b7f9pf745s1c2s5rlvb600ndmmyarzfnrzs23arz99ywid64b7d"))))
173
174(define lib-qr-for-telegram-desktop
175 (origin
176 (method git-fetch)
177 (uri (git-reference
178 (url "https://github.com/desktop-app/lib_qr.git")
179 (commit "6fdf60461444ba150e13ac36009c0ffce72c4c83")))
180 (file-name
181 (git-file-name "lib-qr-for-telegram-desktop" %telegram-version))
182 (sha256
183 (base32
184 "1i5n3qvjkf4nv8k75cc0a71xyvpklc4nzg4k2zsfr2pxk0cy7hkw"))))
185
186(define lib-rpl-for-telegram-desktop
187 (origin
188 (method git-fetch)
189 (uri (git-reference
190 (url "https://github.com/desktop-app/lib_rpl.git")
191 (commit "c57cccffb01d85570decd7fccb88419c9a682e63")))
192 (file-name
193 (git-file-name "lib-rpl-for-telegram-desktop" %telegram-version))
194 (sha256
195 (base32
196 "0s9sza56fsrcd366ii6isc3w27ii2n9k48drn2q4vrq4jy1hy9ln"))))
197
198(define lib-spellcheck-for-telegram-desktop
199 (origin
200 (method git-fetch)
201 (uri (git-reference
202 (url "https://github.com/desktop-app/lib_spellcheck.git")
203 (commit "0ebd04ece297494394be409e73ce276b24565175")))
204 (file-name
205 (git-file-name "lib-spellcheck-for-telegram-desktop" %telegram-version))
206 (sha256
207 (base32
208 "16aj9hgg6r840alcy4plx71wcradpd2xh1y5jn5aj692al1q1vzc"))))
209
210(define lib-storage-for-telegram-desktop
211 (origin
212 (method git-fetch)
213 (uri (git-reference
214 (url "https://github.com/desktop-app/lib_storage.git")
215 (commit "ccdc72548a5065b5991b4e06e610d76bc4f6023e")))
216 (file-name
217 (git-file-name "lib-storage-for-telegram-desktop" %telegram-version))
218 (sha256
219 (base32
220 "0b11ix95dzpkz335q0a6b5yg8qhj33s4fgj9ppl37pszcqq1j3wi"))))
221
222(define lib-tl-for-telegram-desktop
223 (origin
224 (method git-fetch)
225 (uri (git-reference
226 (url "https://github.com/desktop-app/lib_tl.git")
227 (commit "665160f91565bab00ecab65df3a17438e91e44ec")))
228 (file-name
229 (git-file-name "lib-tl-for-telegram-desktop" %telegram-version))
230 (patches
231 (search-patches "lib-tl-for-telegram-memcpy.patch"))
232 (sha256
233 (base32
234 "07dgy93vx0b5q7a879fs30farvdibyllj5hygpzqnqij5hbsc7dn"))))
235
236(define lib-translate-for-telegram-desktop
237 (origin
238 (method git-fetch)
239 (uri (git-reference
240 (url "https://github.com/desktop-app/lib_translate")
241 (commit "09c10726220e6862ca91d39b5dec5119aa0177bc")))
242 (file-name
243 (git-file-name "lib-translate-for-telegram-desktop" %telegram-version))
244 (sha256
245 (base32
246 "05z9bz2gcc952afr19q9z00hnrdx1j3ww7bddazpb2f4b86xi5yc"))))
247
248(define lib-ui-for-telegram-desktop
249 (origin
250 (method git-fetch)
251 (uri (git-reference
252 (url "https://github.com/desktop-app/lib_ui.git")
253 (commit "742640cb626f05350d6dd73b043bbf470daff5ec")))
254 (file-name
255 (git-file-name "lib-ui-for-telegram-desktop" %telegram-version))
256 (sha256
257 (base32
258 "1vi7fkjbil13mnbqfsschqiynfca7vl7whil258abpvm5bnb23px"))))
259
260(define lib-webrtc-for-telegram-desktop
261 (origin
262 (method git-fetch)
263 (uri (git-reference
264 (url "https://github.com/desktop-app/lib_webrtc.git")
265 (commit "52636e86eaa493de670daf71959d000b281bd153")))
266 (file-name
267 (git-file-name "lib-webrtc-for-telegram-desktop" %telegram-version))
268 (sha256
269 (base32
270 "1y50q6b33r506qn4pw0sn6cmxhwjcxdb79qrw7laz45l1iw1zhm0"))))
271
272(define lib-webview-for-telegram-desktop
273 (origin
274 (method git-fetch)
275 (uri (git-reference
276 (url "https://github.com/desktop-app/lib_webview.git")
277 (commit "b1011367be1c6effe15e0cd3ed53b5ffc33e84c3")))
278 (file-name
279 (git-file-name "lib-webview-for-telegram-desktop" %telegram-version))
280 (sha256
281 (base32
282 "027wsjd5vnlvbhl9ja2vg5jbzhvc0b631j8280iclf63xss1hiv0"))))
283
284(define tgcalls-for-telegram-desktop
285 (origin
286 (method git-fetch)
287 (uri (git-reference
288 (url "https://github.com/TelegramMessenger/tgcalls.git")
289 (commit "616810f1539e3f5ee917fff42557c5eeb8b4be40")))
290 (file-name
291 (git-file-name "tgcalls-for-telegram-desktop" %telegram-version))
292 (sha256
293 (base32
294 "0cn5v1b3m4zfvkym0ai5rfw9j9v2k0an0bg7dif8qf6ckvi8vns9"))))
295
296(define-public webrtc-for-telegram-desktop
297 (let ((commit "5c5c71258777d0196dbb3a09cc37d2f56ead28ab")
298 (revision "490"))
299 (hidden-package
300 (package
301 (name "webrtc-for-telegram-desktop")
302 (version
303 (git-version "0" revision commit))
304 (source
305 (origin
306 (method git-fetch)
307 (uri
308 (git-reference
309 (url "https://github.com/desktop-app/tg_owt.git")
310 (commit commit)))
311 (file-name
312 (git-file-name name version))
313 (sha256
314 (base32 "0ab0w5bhkxs3ainp88k4wlcfscycyfhkdsqisdqkf16czkk5sjyx"))
315 (modules '((guix build utils)
316 (ice-9 ftw)
317 (srfi srfi-1)))
318 (snippet
319 #~(begin
320 (let ((keep
321 '("rnnoise"
322 ;; Not available in Guix.
323 "pffft")))
324 (with-directory-excursion "src/third_party"
325 (for-each delete-file-recursively
326 (lset-difference string=?
327 (scandir ".")
328 (cons* "." ".." keep)))))
329 ;; Unbundle abseil-cpp, crc32c and openh264.
330 (substitute* "CMakeLists.txt"
331 (("\\include\\(cmake\\/libopenh264\\.cmake\\)")"")
332 (("\\include\\(cmake\\/libabsl\\.cmake\\)")"")
333 (("\\include\\(cmake\\/libcrc32c\\.cmake\\)")""))))))
334 (build-system cmake-build-system)
335 (arguments
336 (list
337 #:tests? #f ; No target
338 #:phases
339 #~(modify-phases %standard-phases
340 (add-after 'unpack 'unpack-additional-sources
341 (lambda _
342 (let* ((third-party (string-append (getcwd) "/src/third_party"))
343 (libyuv-to (string-append third-party "/libyuv")))
344 (copy-recursively #$libyuv-for-telegram-desktop
345 libyuv-to)))))))
346 (native-inputs (list pkg-config python-wrapper yasm))
347 (inputs
348 (list abseil-cpp-20250127
349 crc32c
350 ffmpeg
351 glib
352 glibmm
353 libdrm
354 libglvnd
355 libjpeg-turbo
356 libsrtp
357 libvpx
358 libxcomposite
359 libxdamage
360 libxext
361 libxfixes
362 libxrandr
363 libxrender
364 libxtst
365 mesa
366 openh264
367 openssl
368 opus
369 pipewire-minimal-1.4
370 protobuf))
371 (synopsis "WebRTC support for Telegram Desktop")
372 (description "WebRTC-for-Telegram-Desktop is a custom WebRTC fork by
373Telegram project, for its use in telegram desktop client.")
374 (home-page "https://github.com/desktop-app/tg_owt")
375 (license
376 (list
377 ;; Abseil-CPP
378 license:asl2.0
379 ;; LibYuv
380 (license:non-copyleft "file:///src/third_party/libyuv/LICENSE")
381 ;; PFFFT
382 (license:non-copyleft "file:///src/third_party/pffft/LICENSE")
383 ;; RnNoise
384 license:gpl3
385 ;; LibSRTP, Crc32c and Others
386 license:bsd-3))))))
387
388(define-public rlottie-for-telegram-desktop
389 (let ((commit "8c69fc20cf2e150db304311f1233a4b55a8892d7")
390 (revision "678"))
391 (hidden-package
392 (package
393 (name "rlottie-for-telegram-desktop")
394 (version (git-version "0.0.1" revision commit))
395 (source
396 (origin
397 (method git-fetch)
398 (uri (git-reference
399 (url "https://github.com/desktop-app/rlottie.git")
400 (commit commit)))
401 (file-name
402 (git-file-name name version))
403 (sha256
404 (base32 "14gwg3sn6xdx9ymnx5r0vfm4pk8dwk92s10a1wdvfbjpyrxll64i"))
405 (modules '((guix build utils)))
406 (snippet
407 #~(begin
408 (substitute* "meson.build"
409 (("werror=true") "werror=false"))))))
410 (build-system meson-build-system)
411 (arguments
412 (list #:configure-flags #~(list
413 "-Dlog=true"
414 "-Dtest=true"
415 "-Dcpp_std=gnu++17")))
416 (native-inputs
417 (list googletest
418 pkg-config))
419 (synopsis "Rlottie for Telegram desktop")
420 (home-page "https://github.com/desktop-app/rlottie")
421 (description
422 "This package is an alternative fork of
423https://github.com/Samsung/rlottie with changes adopted for Telegram desktop
424and not propagated to upstream.")
425 ;; All Licenses are listed in README and provided in licenses
426 ;; directory.
427 (license (list license:bsd-3
428 license:expat
429 license:freetype
430 license:lgpl2.1+))))))
431
432(define cld3-for-telegram-desktop
433 (origin
434 (method git-fetch)
435 (uri (git-reference
436 (url "https://github.com/google/cld3.git")
437 (commit "b48dc46512566f5a2d41118c8c1116c4f96dc661")))
438 (file-name
439 (git-file-name "cld3-for-telegram-desktop" %telegram-version))
440 (sha256
441 (base32
442 "0ayrrhfdwrf4260h9fsirkhhfrcvc3qqnh6h9wj3ixij2lq0wwqb"))))
443
444(define libprisma-for-telegram-desktop
445 (origin
446 (method git-fetch)
447 (uri (git-reference
448 (url "https://github.com/desktop-app/libprisma")
449 (commit "23b0d70f9709da9b38561d5706891a134d18df76")))
450 (file-name
451 (git-file-name "libprisma-for-telegram-desktop" %telegram-version))
452 (sha256
453 (base32
454 "0fg4x4ikj7f3706bmfvkwq4smxc98qr3cgpm25w48n4ys6wfgadg"))))
455
456(define cmark-gfm-for-telegram-desktop
457 (origin
458 (method git-fetch)
459 (uri (git-reference
460 (url "https://github.com/github/cmark-gfm.git")
461 (commit "587a12bb54d95ac37241377e6ddc93ea0e45439b")))
462 (file-name
463 (git-file-name "cmark-gfm-for-telegram-desktop" %telegram-version))
464 (sha256
465 (base32
466 "1apy9i76rgs0bmgdlpjszv0fpqhlap2s12m68wvnsv8j3fsqc90y"))))
467
468(define microtex-for-telegram-desktop
469 (origin
470 (method git-fetch)
471 (uri (git-reference
472 (url "https://github.com/desktop-app/MicroTeX.git")
473 (commit "cb5e9e1ec8f744ec2ad26f35e8f789a0ba25effd")))
474 (file-name
475 (git-file-name "microtex-for-telegram-desktop" %telegram-version))
476 (sha256
477 (base32
478 "19rzksbcbimrnkq78yxwdgd6v25hv2vakn5g82qq9vlgb7ppaan4"))))
479
480(define toomanycooks-for-telegram-desktop
481 (origin
482 (method git-fetch)
483 (uri (git-reference
484 (url "https://github.com/tzcnt/TooManyCooks.git")
485 (commit "8e2c40f925c0903302d13418f07ea147c9b12e8e")))
486 (file-name
487 (git-file-name "toomanycooks-for-telegram-desktop" %telegram-version))
488 (sha256
489 (base32
490 "1rl3zk7jpfcab4i25fibsfmxxic1p495lja0r2jpa7jccagzffba"))))
491
492(define-public tdlib
493 (let ((commit "c15d3f5a5de6e3ba5839822c451152e5e18bb700"))
494 (package
495 (name "tdlib")
496 (version "1.8.68")
497 (source
498 (origin
499 (method git-fetch)
500 (uri (git-reference
501 (url "https://github.com/tdlib/td")
502 (commit commit)))
503 (sha256
504 (base32 "1i5hkzzdihw965xbyyldd023hsgcf2g0asqpjygwx85lr1wi6wis"))
505 (file-name (git-file-name name version))))
506 (build-system cmake-build-system)
507 (arguments
508 (list
509 #:build-type "Release"
510 #:phases
511 #~(modify-phases %standard-phases
512 (add-after 'unpack 'remove-failing-tests
513 (lambda _
514 (substitute* "test/CMakeLists.txt"
515 ;; The test cases are compiled into a distinct binary
516 ;; which uses mtproto.cpp to attempt to connect to
517 ;; a remote server. Removing this file from the sources
518 ;; list disables those specific test cases.
519 (("\\$\\{CMAKE_CURRENT_SOURCE_DIR\\}/mtproto.cpp") "")))))))
520 (native-inputs
521 (list gperf openssl zlib php doxygen))
522 (synopsis "Cross-platform library for building Telegram clients")
523 (description "Tdlib is a cross-platform library for creating custom
524Telegram clients following the official Telegram API. It can be easily used
525from almost any programming language with a C-FFI and features first-class
526support for high performance Telegram Bot creation.")
527 (home-page "https://core.telegram.org/tdlib")
528 (license license:boost1.0))))
529
530(define tde2e
531 (let ((base tdlib))
532 (package
533 (inherit base)
534 (name "tde2e")
535 (arguments
536 (substitute-keyword-arguments arguments
537 ((#:tests? _ #f) #f)
538 ((#:configure-flags flags #~'())
539 #~(list "-DTD_E2E_ONLY=ON")))))))
540
541(define-public telegram-desktop
542 (package
543 (name "telegram-desktop")
544 (version %telegram-version)
545 (source
546 (origin
547 (method git-fetch)
548 (uri
549 (git-reference
550 (url "https://github.com/telegramdesktop/tdesktop.git")
551 (commit
552 (string-append "v" version))))
553 (file-name
554 (git-file-name name version))
555 (sha256
556 (base32 "1hypd3faz6lii8ba7ysg7a2hq77xb7mvwk89wg17z8a6jn1764q2"))
557 (patches
558 (search-patches
559 ;; Make it compatible with GCC 11.
560 "telegram-desktop-qguiapp.patch"
561 "telegram-desktop-hashmap-incomplete-value.patch"))
562 (modules '((guix build utils)
563 (ice-9 ftw)
564 (srfi srfi-1)))
565 (snippet
566 #~(begin
567 (let ((keep
568 '(;; Not available in Guix.
569 "tgcalls" "cld3")))
570 (with-directory-excursion "Telegram/ThirdParty"
571 (for-each delete-file-recursively
572 (lset-difference string=?
573 (scandir ".")
574 (cons* "." ".." keep)))))))))
575 (build-system qt-build-system)
576 (arguments
577 (list #:qtbase qtbase
578 #:tests? #f ; No target
579 #:imported-modules
580 `(,@%qt-build-system-modules
581 (guix build glib-or-gtk-build-system))
582 #:modules
583 '((guix build qt-build-system)
584 ((guix build glib-or-gtk-build-system)
585 #:prefix glib-or-gtk:)
586 (guix build utils)
587 (ice-9 match))
588 #:configure-flags
589 #~(list
590 ;; Do not generate the debug symbols to reduce link time memory
591 ;; requirements from 25 GiB to 1.3 GiB. This also nearly halves
592 ;; the build time.
593 "-DCMAKE_BUILD_TYPE=Release"
594 ;; Client applications must provide their own API-ID and API-HASH,
595 ;; see also <https://core.telegram.org/api/obtaining_api_id>.
596 ;; Here, we snarf the keys from the official Snaps, which are
597 ;; also stored in <#$source/snap/snapcraft.yaml>.
598 "-DTDESKTOP_API_ID=611335"
599 "-DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c"
600 "-DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON"
601 "-DDESKTOP_APP_DISABLE_AUTOUPDATE=ON"
602 "-DDESKTOP_APP_USE_PACKAGED_RLOTTIE=ON"
603 "-DDESKTOP_APP_DISABLE_QT_PLUGINS=ON")
604 #:phases
605 #~(modify-phases %standard-phases
606 (add-after 'unpack 'unpack-additional-sources
607 (lambda _
608 (for-each make-file-writable (find-files "."))
609 (for-each
610 (match-lambda
611 ((dst src)
612 (copy-recursively src dst)
613 (for-each make-file-writable (find-files dst))))
614 '(("cmake" #$cmake-helpers-for-telegram-desktop)
615 ("Telegram/codegen" #$codegen-for-telegram-desktop)
616 ("Telegram/lib_base" #$lib-base-for-telegram-desktop)
617 ("Telegram/lib_crl" #$lib-crl-for-telegram-desktop)
618 ("Telegram/lib_lottie" #$lib-lottie-for-telegram-desktop)
619 ("Telegram/lib_qr" #$lib-qr-for-telegram-desktop)
620 ("Telegram/lib_rpl" #$lib-rpl-for-telegram-desktop)
621 ("Telegram/lib_spellcheck" #$lib-spellcheck-for-telegram-desktop)
622 ("Telegram/lib_storage" #$lib-storage-for-telegram-desktop)
623 ("Telegram/lib_tl" #$lib-tl-for-telegram-desktop)
624 ("Telegram/lib_translate" #$lib-translate-for-telegram-desktop)
625 ("Telegram/lib_ui" #$lib-ui-for-telegram-desktop)
626 ("Telegram/lib_webrtc" #$lib-webrtc-for-telegram-desktop)
627 ("Telegram/lib_webview" #$lib-webview-for-telegram-desktop)
628 ("Telegram/ThirdParty/cld3" #$cld3-for-telegram-desktop)
629 ("Telegram/ThirdParty/cmark-gfm" #$cmark-gfm-for-telegram-desktop)
630 ("Telegram/ThirdParty/libprisma" #$libprisma-for-telegram-desktop)
631 ("Telegram/ThirdParty/MicroTeX" #$microtex-for-telegram-desktop)
632 ("Telegram/ThirdParty/tgcalls" #$tgcalls-for-telegram-desktop)
633 ("Telegram/ThirdParty/TooManyCooks" #$toomanycooks-for-telegram-desktop)))))
634 (add-after 'unpack-additional-sources 'patch-gir-ignore-paths
635 (lambda _
636 (substitute* "cmake/external/glib/generate_cppgir.cmake"
637 (("\\$\\{cmake_helpers_loc\\}/external/glib/cppgir/data")
638 (string-append #$(this-package-input "cppgir") "/share/cppgir")))))
639 (add-after 'unpack-additional-sources 'use-system-xdg-desktop-portal
640 (lambda _
641 (substitute* (list "Telegram/CMakeLists.txt"
642 "Telegram/lib_base/CMakeLists.txt")
643 (("\\$\\{third_party_loc\\}/xdg-desktop-portal/data")
644 (string-append #$(this-package-native-input "xdg-desktop-portal")
645 "/share/dbus-1/interfaces")))))
646 ;; Remove a problematic 'constexpr' keyword, otherwise
647 ;; compilation fails with GCC 11.
648 (add-after 'use-system-xdg-desktop-portal 'patch-libwebview
649 (lambda _
650 (substitute* "Telegram/lib_webview/webview/webview_interface.h"
651 (("constexpr ") ""))))
652 (add-after 'install 'glib-or-gtk-compile-schemas
653 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas))
654 (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap
655 (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap)))))
656 (native-inputs
657 (list cpp-ada-url-parser
658 `(,glib "bin")
659 gobject-introspection
660 `(,gtk+ "bin")
661 pkg-config
662 python-wrapper
663 qtshadertools
664 xdg-desktop-portal))
665 (inputs
666 (list abseil-cpp-20250127
667 alsa-lib
668 boost
669 c++-gsl
670 cppgir-for-telegram-desktop
671 crc32c
672 expected-lite
673 fcitx5-qt
674 ffmpeg
675 glib
676 glibmm-2.76
677 gtk+
678 hime
679 hunspell
680 kcoreaddons
681 kimageformats
682 libavif
683 libexpected
684 libjpeg-turbo
685 libjxl
686 libvpx
687 libxcb
688 lz4
689 minizip
690 nimf
691 openal
692 openh264
693 openssl
694 opus
695 plasma-wayland-protocols
696 pulseaudio
697 protobuf
698 qrcodegen-cpp
699 qtdeclarative
700 qtimageformats
701 qtsvg
702 qtwayland
703 range-v3
704 rlottie-for-telegram-desktop
705 rnnoise
706 tde2e
707 wayland
708 wayland-protocols
709 webkitgtk-for-gtk3
710 webrtc-for-telegram-desktop
711 xcb-util-keysyms
712 xxhash
713 zlib))
714 (synopsis "Telegram Desktop")
715 (description "Telegram desktop is the official desktop version of the
716Telegram instant messenger.")
717 (home-page "https://desktop.telegram.org/")
718 (license
719 (list
720 ;; ThirdParty
721 license:lgpl3
722 ;; Others
723 license:gpl3+))))
724
725(define-public tl-parser
726 (let ((commit "1933e76f8f4fb74311be723b432e4c56e3a5ec06")
727 (revision "21"))
728 (package
729 (name "tl-parser")
730 (version
731 (git-version "0" revision commit))
732 (source
733 (origin
734 (method git-fetch)
735 (uri
736 (git-reference
737 (url "https://github.com/vysheng/tl-parser.git")
738 (commit commit)))
739 (file-name
740 (git-file-name name version))
741 (sha256
742 (base32 "13cwi247kajzpkbl86hnwmn1sn2h6rqndz6khajbqj0mlw9mv4hq"))))
743 (build-system cmake-build-system)
744 (arguments
745 `(#:tests? #f ; No target
746 #:imported-modules
747 ((guix build copy-build-system)
748 ,@%cmake-build-system-modules)
749 #:modules
750 (((guix build copy-build-system)
751 #:prefix copy:)
752 (guix build cmake-build-system)
753 (guix build utils))
754 #:phases
755 (modify-phases %standard-phases
756 (replace 'install
757 (lambda args
758 (apply (assoc-ref copy:%standard-phases 'install)
759 #:install-plan
760 '(("." "bin"
761 #:include ("tl-parser"))
762 ("../source" "include/tl-parser"
763 #:include-regexp ("\\.h$")))
764 args))))))
765 (synopsis "Parse tl scheme to tlo")
766 (description "TL-Parser is a tl scheme to tlo file parser. It was
767formerly a part of telegram-cli, but now being maintained separately.")
768 (home-page "https://github.com/vysheng/tl-parser")
769 (license license:gpl2+))))
770
771(define-public tgl
772 (let ((commit "ffb04caca71de0cddf28cd33a4575922900a59ed")
773 (revision "181"))
774 (package
775 (name "tgl")
776 (version
777 (git-version "2.0.1" revision commit))
778 (source
779 (origin
780 (method git-fetch)
781 (uri
782 (git-reference
783 (url "https://github.com/vysheng/tgl.git")
784 (commit commit)))
785 (file-name
786 (git-file-name name version))
787 (sha256
788 (base32 "0cf5s7ygslb5klg1qv9qdc3hivhspmvh3zkacyyhd2yyikb5p0f9"))))
789 (build-system gnu-build-system)
790 (arguments
791 (list
792 #:tests? #f ; No target
793 #:imported-modules
794 `((guix build copy-build-system)
795 ,@%default-gnu-imported-modules)
796 #:modules
797 '(((guix build copy-build-system)
798 #:prefix copy:)
799 (guix build gnu-build-system)
800 (guix build utils))
801 #:configure-flags
802 '(list
803 ;; Use gcrypt instead of openssl.
804 "--disable-openssl"
805 ;; Enable extended queries system.
806 "--enable-extf"
807 ;; Include libevent-based net and timers.
808 "--enable-libevent")
809 #:phases
810 '(modify-phases %standard-phases
811 (add-after 'unpack 'trigger-bootstrap
812 (lambda _
813 (delete-file "configure")))
814 (add-after 'trigger-bootstrap 'patch-tl-parser
815 (lambda _
816 (delete-file "Makefile.tl-parser")
817 (substitute* "Makefile.in"
818 (("include \\$\\{srcdir\\}/Makefile\\.tl-parser")
819 "")
820 (("\\$\\{EXE\\}/tl-parser")
821 "tl-parser"))))
822 (add-after 'unpack 'remove-Werror
823 (lambda _
824 (substitute* "Makefile.in"
825 (("-Werror") ""))))
826 (replace 'install
827 (lambda args
828 (apply (assoc-ref copy:%standard-phases 'install)
829 #:install-plan
830 '(("bin" "bin")
831 ("." "include/tgl"
832 #:include-regexp ("\\.h$"))
833 ("libs" "lib/tgl"))
834 args))))))
835 (native-inputs
836 (list autoconf automake libtool pkg-config))
837 (inputs
838 (list libevent libgcrypt tl-parser zlib))
839 (synopsis "Telegram Library")
840 (description "TGL is the telegram library for telegram-cli.")
841 (home-page "https://github.com/vysheng/tgl")
842 (license license:lgpl2.1+))))
843
844(define-public telegram-cli
845 (let ((commit "6547c0b21b977b327b3c5e8142963f4bc246187a")
846 (revision "324"))
847 (package
848 (name "telegram-cli")
849 (version
850 (git-version "1.3.1" revision commit))
851 (source
852 (origin
853 (method git-fetch)
854 (uri
855 (git-reference
856 (url "https://github.com/vysheng/tg.git")
857 (commit commit)))
858 (file-name
859 (git-file-name name version))
860 (sha256
861 (base32 "0c1w7jgska71jjbvg1y09v52549pwa4zkdjly18yxywn7gayd2p6"))))
862 (build-system gnu-build-system)
863 (arguments
864 (list
865 #:tests? #f ; No target
866 #:imported-modules
867 `((guix build copy-build-system)
868 ,@%default-gnu-imported-modules)
869 #:modules
870 '(((guix build copy-build-system)
871 #:prefix copy:)
872 (guix build gnu-build-system)
873 (guix build utils))
874 #:configure-flags
875 '(list
876 ;; Use gcrypt instead of openssl.
877 "--disable-openssl")
878 #:phases
879 '(modify-phases %standard-phases
880 (add-after 'unpack 'remove-Werror
881 (lambda _
882 (substitute* "Makefile.in"
883 (("-Werror") "-fcommon"))))
884 (add-after 'unpack 'trigger-bootstrap
885 (lambda _
886 (delete-file "configure")))
887 (add-after 'trigger-bootstrap 'patch-tgl-and-tlparser
888 (lambda* (#:key inputs #:allow-other-keys)
889 (for-each delete-file
890 (list
891 "Makefile.tgl"
892 "Makefile.tl-parser"))
893 (substitute* "Makefile.in"
894 (("include \\$\\{srcdir\\}/Makefile\\.tl-parser")
895 "")
896 (("include \\$\\{srcdir\\}/Makefile\\.tgl")
897 "")
898 (("-I\\$\\{srcdir\\}/tgl")
899 (string-append "-I" (assoc-ref inputs "tgl")
900 "/include/tgl"))
901 (("AUTO=auto")
902 (string-append "AUTO=" (assoc-ref inputs "tgl")
903 "/include/tgl/auto"))
904 (("LIB=libs")
905 (string-append "LIB=" (assoc-ref inputs "tgl")
906 "/lib/tgl")))))
907 (replace 'install
908 (lambda args
909 (apply (assoc-ref copy:%standard-phases 'install)
910 #:install-plan
911 '(("bin" "bin")
912 ("." "etc/telegram-cli"
913 #:include-regexp ("\\.pub$")
914 #:exclude ("tg-server.pub")))
915 args))))))
916 (native-inputs
917 (list autoconf automake libtool pkg-config))
918 (inputs
919 (list jansson
920 libconfig
921 libevent
922 libgcrypt
923 lua
924 openssl
925 perl
926 python
927 readline
928 tgl
929 tl-parser
930 zlib))
931 (synopsis "Telegram Messenger CLI")
932 (description "TG is the command-line interface for Telegram Messenger.")
933 (home-page "https://github.com/vysheng/tg")
934 (license license:gpl2+))))
935
936(define-public tgs2png
937 (let ((commit "25c15b7c2ca3b1a580a383d9d3cb13bf8531d04a")
938 (revision "0"))
939 (package
940 (name "tgs2png")
941 (version (git-version "0" revision commit))
942 (source (origin
943 (method git-fetch)
944 (uri (git-reference
945 (url "https://github.com/zevlg/tgs2png")
946 (commit commit)))
947 (file-name (git-file-name name version))
948 (sha256
949 (base32
950 "0camvzapkfvr9v0nkk96n26rdmw0g8wbpv41i5l03j6bzdgm4myl"))))
951 (build-system cmake-build-system)
952 (native-inputs (list pkg-config))
953 (inputs (list libpng rlottie))
954 (arguments
955 `(#:tests? #f)) ;no tests
956 (home-page "https://github.com/zevlg/tgs2png")
957 (synopsis "Convert Telegram's TGS format into PNG images")
958 (description
959 "This program converts Telegram's animated stickers in TGS format into
960a series of PNG images.")
961 (license license:gpl3+))))