| 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 check) |
| 27 | #:use-module (gnu packages cmake) |
| 28 | #:use-module (gnu packages compression) |
| 29 | #:use-module (gnu packages cpp) |
| 30 | #:use-module (gnu packages digest) |
| 31 | #:use-module (gnu packages fcitx) |
| 32 | #:use-module (gnu packages fcitx5) |
| 33 | #:use-module (gnu packages freedesktop) |
| 34 | #:use-module (gnu packages gl) |
| 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 jemalloc) |
| 41 | #:use-module (gnu packages kde-frameworks) |
| 42 | #:use-module (gnu packages language) |
| 43 | #:use-module (gnu packages libevent) |
| 44 | #:use-module (gnu packages libreoffice) |
| 45 | #:use-module (gnu packages linux) |
| 46 | #:use-module (gnu packages lxqt) |
| 47 | #:use-module (gnu packages lua) |
| 48 | #:use-module (gnu packages perl) |
| 49 | #:use-module (gnu packages pkg-config) |
| 50 | #:use-module (gnu packages protobuf) |
| 51 | #:use-module (gnu packages pulseaudio) |
| 52 | #:use-module (gnu packages python) |
| 53 | #:use-module (gnu packages python-check) |
| 54 | #:use-module (gnu packages python-web) |
| 55 | #:use-module (gnu packages python-xyz) |
| 56 | #:use-module (gnu packages qt) |
| 57 | #:use-module (gnu packages readline) |
| 58 | #:use-module (gnu packages textutils) |
| 59 | #:use-module (gnu packages telephony) |
| 60 | #:use-module (gnu packages tls) |
| 61 | #:use-module (gnu packages video) |
| 62 | #:use-module (gnu packages web) |
| 63 | #:use-module (gnu packages xdisorg) |
| 64 | #:use-module (gnu packages xiph) |
| 65 | #:use-module (gnu packages xorg) |
| 66 | #:use-module ((guix licenses) #:prefix license:) |
| 67 | #:use-module (guix packages) |
| 68 | #:use-module (guix gexp) |
| 69 | #:use-module (guix git-download) |
| 70 | #:use-module (guix build-system cmake) |
| 71 | #:use-module (guix build-system copy) |
| 72 | #:use-module (guix build-system glib-or-gtk) |
| 73 | #:use-module (guix build-system gnu) |
| 74 | #:use-module (guix build-system meson) |
| 75 | #:use-module (guix build-system python) |
| 76 | #:use-module (guix build-system qt)) |
| 77 | |
| 78 | (define %telegram-version "2.9.3") |
| 79 | |
| 80 | (define libvpx-for-telegram-desktop |
| 81 | (let ((commit "5b63f0f821e94f8072eb483014cfc33b05978bb9") |
| 82 | (revision "112")) |
| 83 | (origin |
| 84 | (method git-fetch) |
| 85 | (uri (git-reference |
| 86 | (url "https://chromium.googlesource.com/webm/libvpx") |
| 87 | (commit commit))) |
| 88 | (file-name (git-file-name |
| 89 | "libvpx-for-telegram-desktop" |
| 90 | (git-version "1.9.0" revision commit))) |
| 91 | (sha256 |
| 92 | (base32 |
| 93 | "1psvxaddihlw1k5n0anxif3qli6zyw2sa2ywn6mkb8six9myrp68"))))) |
| 94 | |
| 95 | (define libyuv-for-telegram-desktop |
| 96 | (let ((commit "ad890067f661dc747a975bc55ba3767fe30d4452") |
| 97 | (revision "2211")) |
| 98 | (origin |
| 99 | (method git-fetch) |
| 100 | (uri (git-reference |
| 101 | (url "https://chromium.googlesource.com/libyuv/libyuv") |
| 102 | (commit commit))) |
| 103 | (file-name (git-file-name |
| 104 | "libyuv-for-telegram-desktop" |
| 105 | (git-version "0" revision commit))) |
| 106 | (sha256 |
| 107 | (base32 |
| 108 | "01knnk4h247rq536097n9n3s3brxlbby3nv3ppdgsqfda3k159ll"))))) |
| 109 | |
| 110 | (define cmake-helpers-for-telegram-desktop |
| 111 | (origin |
| 112 | (method git-fetch) |
| 113 | (uri (git-reference |
| 114 | (url "https://github.com/desktop-app/cmake_helpers.git") |
| 115 | (commit "4d44d822e01b3b5fbec3ce824e01f56aa35d7f72"))) |
| 116 | (file-name |
| 117 | (git-file-name "cmake-helpers-for-telegram-desktop" %telegram-version)) |
| 118 | (sha256 |
| 119 | (base32 |
| 120 | "0h6cjiqy014h2mz90h1z5a7plb3ihbnds4bja8994ybr1dy3m7m5")))) |
| 121 | |
| 122 | (define codegen-for-telegram-desktop |
| 123 | (origin |
| 124 | (method git-fetch) |
| 125 | (uri (git-reference |
| 126 | (url "https://github.com/desktop-app/codegen.git") |
| 127 | (commit "248614b49cd7d5aff69d75a737f2e35b79fbb119"))) |
| 128 | (file-name |
| 129 | (git-file-name "codegen-for-telegram-desktop" %telegram-version)) |
| 130 | (sha256 |
| 131 | (base32 |
| 132 | "00f7g2z6xmkbkrmi3q27hscjl44mg66wf9q0mz3rhy3jaa6cfdrk")))) |
| 133 | |
| 134 | (define lib-base-for-telegram-desktop |
| 135 | (origin |
| 136 | (method git-fetch) |
| 137 | (uri (git-reference |
| 138 | (url "https://github.com/desktop-app/lib_base.git") |
| 139 | (commit "a23c05c44e4f01dc4428f4d75d4db98c59d313a6"))) |
| 140 | (file-name |
| 141 | (git-file-name "lib-base-for-telegram-desktop" %telegram-version)) |
| 142 | (sha256 |
| 143 | (base32 |
| 144 | "0vh5zgxwalmbnvz8lzlnba87ch8vnpmcz6nvf56w09f3nlxvvq78")))) |
| 145 | |
| 146 | (define lib-crl-for-telegram-desktop |
| 147 | (origin |
| 148 | (method git-fetch) |
| 149 | (uri (git-reference |
| 150 | (url "https://github.com/desktop-app/lib_crl.git") |
| 151 | (commit "3ccf2ed5095442e5874bba8852cb7dc4efeae29f"))) |
| 152 | (file-name |
| 153 | (git-file-name "lib-crl-for-telegram-desktop" %telegram-version)) |
| 154 | (sha256 |
| 155 | (base32 |
| 156 | "11my7q54m4lvvlgma6pbdyjxi1cv1adk1gph2j50mh18sqlm8myz")))) |
| 157 | |
| 158 | (define lib-lottie-for-telegram-desktop |
| 159 | (origin |
| 160 | (method git-fetch) |
| 161 | (uri (git-reference |
| 162 | (url "https://github.com/desktop-app/lib_lottie.git") |
| 163 | (commit "0770df009db7928df1d0cad0900dc5110106d229"))) |
| 164 | (file-name |
| 165 | (git-file-name "lib-lottie-for-telegram-desktop" %telegram-version)) |
| 166 | (sha256 |
| 167 | (base32 |
| 168 | "1gj56ymlbk5dnk82jw674808m511lv9dky8891a5wm4gp3pph5jb")))) |
| 169 | |
| 170 | (define lib-qr-for-telegram-desktop |
| 171 | (origin |
| 172 | (method git-fetch) |
| 173 | (uri (git-reference |
| 174 | (url "https://github.com/desktop-app/lib_qr.git") |
| 175 | (commit "2b08c71c6edcfc3e31f7d7f518cc963493b6e189"))) |
| 176 | (file-name |
| 177 | (git-file-name "lib-qr-for-telegram-desktop" %telegram-version)) |
| 178 | (sha256 |
| 179 | (base32 |
| 180 | "05hrkmwgrczyjv87r507i2r7m1zr6k2i43mq3my0s6j4szr1rjq0")))) |
| 181 | |
| 182 | (define lib-rlottie-for-telegram-desktop |
| 183 | (origin |
| 184 | (method git-fetch) |
| 185 | (uri (git-reference |
| 186 | (url "https://github.com/desktop-app/lib_rlottie.git") |
| 187 | (commit "0671bf70547381effcf442ec9618e04502a8adbc"))) |
| 188 | (file-name |
| 189 | (git-file-name "lib-rlottie-for-telegram-desktop" %telegram-version)) |
| 190 | (sha256 |
| 191 | (base32 |
| 192 | "05qnza7j15356s8jq16pkbyp4zr586lssmd86lz5jq23lcb3raxv")))) |
| 193 | |
| 194 | (define lib-rpl-for-telegram-desktop |
| 195 | (origin |
| 196 | (method git-fetch) |
| 197 | (uri (git-reference |
| 198 | (url "https://github.com/desktop-app/lib_rpl.git") |
| 199 | (commit "df721be3fa14a27dfc230d2e3c42bb1a7c9d0617"))) |
| 200 | (file-name |
| 201 | (git-file-name "lib-rpl-for-telegram-desktop" %telegram-version)) |
| 202 | (sha256 |
| 203 | (base32 |
| 204 | "15fnv3ssn7rn5d0j52gggdvyqc2wm464678dj7v2x9h8lka2jjxn")))) |
| 205 | |
| 206 | (define lib-spellcheck-for-telegram-desktop |
| 207 | (origin |
| 208 | (method git-fetch) |
| 209 | (uri (git-reference |
| 210 | (url "https://github.com/desktop-app/lib_spellcheck.git") |
| 211 | (commit "68c9b788958904aea7de79f986a0f82ec8c5b094"))) |
| 212 | (file-name |
| 213 | (git-file-name "lib-spellcheck-for-telegram-desktop" %telegram-version)) |
| 214 | (sha256 |
| 215 | (base32 |
| 216 | "0d8s4wwk6fxf536mhzq2vb9qw3j0m8nqia7ylvvpsbc4kh09dadn")))) |
| 217 | |
| 218 | (define lib-storage-for-telegram-desktop |
| 219 | (origin |
| 220 | (method git-fetch) |
| 221 | (uri (git-reference |
| 222 | (url "https://github.com/desktop-app/lib_storage.git") |
| 223 | (commit "403df6c4a29562bd417c92d410e49819f5a48cc1"))) |
| 224 | (file-name |
| 225 | (git-file-name "lib-storage-for-telegram-desktop" %telegram-version)) |
| 226 | (sha256 |
| 227 | (base32 |
| 228 | "1zxvzfrxbj4d395fzyb5pm9wn3n8jyimxx88cyqjcdd46sx4h7r5")))) |
| 229 | |
| 230 | (define lib-tl-for-telegram-desktop |
| 231 | (origin |
| 232 | (method git-fetch) |
| 233 | (uri (git-reference |
| 234 | (url "https://github.com/desktop-app/lib_tl.git") |
| 235 | (commit "45faed44e7f4d11fec79b7a70e4a35dc91ef3fdb"))) |
| 236 | (file-name |
| 237 | (git-file-name "lib-tl-for-telegram-desktop" %telegram-version)) |
| 238 | (sha256 |
| 239 | (base32 |
| 240 | "0h43xvzklda02494d466jp52hl8c1kmav9f12dyld10dpf1w6c7m")))) |
| 241 | |
| 242 | (define lib-ui-for-telegram-desktop |
| 243 | (origin |
| 244 | (method git-fetch) |
| 245 | (uri (git-reference |
| 246 | (url "https://github.com/desktop-app/lib_ui.git") |
| 247 | (commit "1b590f9e16eb9571a039f072d6fea66c607e419f"))) |
| 248 | (file-name |
| 249 | (git-file-name "lib-ui-for-telegram-desktop" %telegram-version)) |
| 250 | (sha256 |
| 251 | (base32 |
| 252 | "0ighyhfp29h9h8c7vr70pnhcv2xnsr9ln084pssn8hb5z4pmb62f")))) |
| 253 | |
| 254 | (define lib-waylandshells-for-telegram-desktop |
| 255 | (origin |
| 256 | (method git-fetch) |
| 257 | (uri (git-reference |
| 258 | (url "https://github.com/desktop-app/lib_waylandshells.git") |
| 259 | (commit "59b0ee55a68976d27f1bf7cec0e11d5939e185e7"))) |
| 260 | (file-name |
| 261 | (git-file-name "lib-waylandshells-for-telegram-desktop" %telegram-version)) |
| 262 | (sha256 |
| 263 | (base32 |
| 264 | "0l2xrpc5mvvdlsj333pmkgfvn9wi1ijfdaaz8skfnw9icw52faaf")))) |
| 265 | |
| 266 | (define lib-webrtc-for-telegram-desktop |
| 267 | (origin |
| 268 | (method git-fetch) |
| 269 | (uri (git-reference |
| 270 | (url "https://github.com/desktop-app/lib_webrtc.git") |
| 271 | (commit "ef49f953f12b112008a094a719f40939aaf39db4"))) |
| 272 | (file-name |
| 273 | (git-file-name "lib-webrtc-for-telegram-desktop" %telegram-version)) |
| 274 | (sha256 |
| 275 | (base32 |
| 276 | "15k4xs3462p3ddp5cn9im3nvdiaijmxir8wxsf5yrj70ghy26ibw")))) |
| 277 | |
| 278 | (define lib-webview-for-telegram-desktop |
| 279 | (origin |
| 280 | (method git-fetch) |
| 281 | (uri (git-reference |
| 282 | (url "https://github.com/desktop-app/lib_webview.git") |
| 283 | (commit "e06427c624515485774e2e2181d4afeb05ad5a67"))) |
| 284 | (file-name |
| 285 | (git-file-name "lib-webview-for-telegram-desktop" %telegram-version)) |
| 286 | (sha256 |
| 287 | (base32 |
| 288 | "148z7xzfscynwwwqssdsd97npax6yn8zrd64xw8qzbwff2g2r7k4")))) |
| 289 | |
| 290 | (define tgcalls-for-telegram-desktop |
| 291 | (origin |
| 292 | (method git-fetch) |
| 293 | (uri (git-reference |
| 294 | (url "https://github.com/TelegramMessenger/tgcalls.git") |
| 295 | (commit "81e97fa52e25b7775b62ce07bb653533d81e91b3"))) |
| 296 | (file-name |
| 297 | (git-file-name "tgcalls-for-telegram-desktop" %telegram-version)) |
| 298 | (sha256 |
| 299 | (base32 |
| 300 | "0fvad87hyxli83xn19mgf8jjrrh6y6iaig14pckpbkg33vf4wqkj")))) |
| 301 | |
| 302 | (define-public webrtc-for-telegram-desktop |
| 303 | (let ((commit "621f3da55331733bf0d1b223786b96b68c03dca1") |
| 304 | (revision "327")) |
| 305 | (hidden-package |
| 306 | (package |
| 307 | (name "webrtc-for-telegram-desktop") |
| 308 | (version |
| 309 | (git-version "0" revision commit)) |
| 310 | (source |
| 311 | (origin |
| 312 | (method git-fetch) |
| 313 | (uri |
| 314 | (git-reference |
| 315 | (url "https://github.com/desktop-app/tg_owt.git") |
| 316 | (commit commit))) |
| 317 | (file-name |
| 318 | (git-file-name name version)) |
| 319 | (sha256 |
| 320 | (base32 "1ks1572k1jj7pmzwm79p2gdgi31dd4bs761bphnx32zyq4c6skxk")) |
| 321 | (patches |
| 322 | (search-patches |
| 323 | ;; https://github.com/desktop-app/tg_owt/pull/101 |
| 324 | "webrtc-for-telegram-desktop-fix-gcc12-cstdint.patch")) |
| 325 | (modules '((guix build utils) |
| 326 | (ice-9 ftw) |
| 327 | (srfi srfi-1))) |
| 328 | (snippet |
| 329 | #~(begin |
| 330 | (let ((keep |
| 331 | '("abseil-cpp" "libsrtp" "rnnoise" |
| 332 | ;; Not available in Guix. |
| 333 | "pffft"))) |
| 334 | (with-directory-excursion "src/third_party" |
| 335 | (for-each delete-file-recursively |
| 336 | (lset-difference string=? |
| 337 | (scandir ".") |
| 338 | (cons* "." ".." keep))))) |
| 339 | ;; Unbundle openh264. |
| 340 | (substitute* "CMakeLists.txt" |
| 341 | (("\\include\\(cmake\\/libopenh264\\.cmake\\)")"")))))) |
| 342 | (build-system cmake-build-system) |
| 343 | (arguments |
| 344 | (list |
| 345 | #:tests? #f ; No target |
| 346 | #:phases |
| 347 | #~(modify-phases %standard-phases |
| 348 | (add-after 'unpack 'unpack-additional-sources |
| 349 | (lambda _ |
| 350 | (let* ((third-party (string-append (getcwd) "/src/third_party")) |
| 351 | (crc32c-to (string-append third-party "/crc32c/src")) |
| 352 | (libyuv-to (string-append third-party "/libyuv"))) |
| 353 | (copy-recursively #$(package-source crc32c) crc32c-to) |
| 354 | (copy-recursively #$libyuv-for-telegram-desktop |
| 355 | libyuv-to))))))) |
| 356 | (native-inputs (list pkg-config python-wrapper yasm)) |
| 357 | (inputs |
| 358 | (list abseil-cpp-cxxstd17 |
| 359 | ffmpeg |
| 360 | libjpeg-turbo |
| 361 | glib |
| 362 | libdrm |
| 363 | libglvnd |
| 364 | libvpx |
| 365 | libxcomposite |
| 366 | libxdamage |
| 367 | libxrender |
| 368 | libxrandr |
| 369 | libxfixes |
| 370 | mesa |
| 371 | openh264 |
| 372 | openssl |
| 373 | opus |
| 374 | pipewire-0.3 |
| 375 | protobuf |
| 376 | libxext |
| 377 | libxtst)) |
| 378 | (synopsis "WebRTC support for Telegram Desktop") |
| 379 | (description "WebRTC-for-Telegram-Desktop is a custom WebRTC fork by |
| 380 | Telegram project, for its use in telegram desktop client.") |
| 381 | (home-page "https://github.com/desktop-app/tg_owt") |
| 382 | (license |
| 383 | (list |
| 384 | ;; Abseil-CPP |
| 385 | license:asl2.0 |
| 386 | ;; LibYuv |
| 387 | (license:non-copyleft "file:///src/third_party/libyuv/LICENSE") |
| 388 | ;; PFFFT |
| 389 | (license:non-copyleft "file:///src/third_party/pffft/LICENSE") |
| 390 | ;; RnNoise |
| 391 | license:gpl3 |
| 392 | ;; LibSRTP, Crc32c and Others |
| 393 | license:bsd-3)))))) |
| 394 | |
| 395 | (define-public rlottie-for-telegram-desktop |
| 396 | (let ((commit "cbd43984ebdf783e94c8303c41385bf82aa36d5b") |
| 397 | (revision "671")) |
| 398 | (hidden-package |
| 399 | (package |
| 400 | (inherit rlottie) |
| 401 | (version |
| 402 | (git-version "0.0.1" revision commit)) |
| 403 | (source |
| 404 | (origin |
| 405 | (method git-fetch) |
| 406 | (uri |
| 407 | (git-reference |
| 408 | (url "https://github.com/desktop-app/rlottie.git") |
| 409 | (commit commit))) |
| 410 | (file-name |
| 411 | (git-file-name "rlottie-for-telegram-desktop" version)) |
| 412 | (sha256 |
| 413 | (base32 "1lxpbgbhps9rmck036mgmiknqrzpjxpas8n7qxykv6pwzn0c8n0c")))) |
| 414 | (arguments |
| 415 | `(#:configure-flags |
| 416 | (list |
| 417 | "-Dlog=true" |
| 418 | "-Ddumptree=true" |
| 419 | "-Dtest=true") |
| 420 | #:phases |
| 421 | (modify-phases %standard-phases |
| 422 | (add-after 'unpack 'patch-cxx-flags |
| 423 | (lambda _ |
| 424 | (substitute* "meson.build" |
| 425 | (("werror=true") |
| 426 | "werror=false")) |
| 427 | #t))))))))) |
| 428 | |
| 429 | (define-public libtgvoip-for-telegram-desktop |
| 430 | (let ((commit "13a5fcb16b04472d808ce122abd695dbf5d206cd") |
| 431 | (revision "88")) |
| 432 | (hidden-package |
| 433 | (package |
| 434 | (inherit libtgvoip) |
| 435 | (version |
| 436 | (git-version "2.4.4" revision commit)) |
| 437 | (source |
| 438 | (origin |
| 439 | (method git-fetch) |
| 440 | (uri |
| 441 | (git-reference |
| 442 | (url "https://github.com/telegramdesktop/libtgvoip.git") |
| 443 | (commit commit))) |
| 444 | (file-name |
| 445 | (git-file-name "libtgvoip-for-telegram-desktop" version)) |
| 446 | (sha256 |
| 447 | (base32 "12p6s7vxkf1gh1spdckkdxrx7bjzw881ds9bky7l5fw751cwb3xd")))) |
| 448 | (arguments |
| 449 | `(#:configure-flags |
| 450 | (list |
| 451 | "--disable-static" |
| 452 | "--disable-dsp" ; FIXME |
| 453 | "--enable-audio-callback" |
| 454 | "--with-alsa" |
| 455 | "--with-pulse") |
| 456 | #:phases |
| 457 | (modify-phases %standard-phases |
| 458 | (add-after 'unpack 'patch-linkers |
| 459 | (lambda _ |
| 460 | (substitute* "Makefile.am" |
| 461 | (("\\$\\(CRYPTO_LIBS\\) \\$\\(OPUS_LIBS\\)") |
| 462 | "$(CRYPTO_LIBS) $(OPUS_LIBS) $(ALSA_LIBS) $(PULSE_LIBS)")) |
| 463 | (substitute* "tgvoip.pc.in" |
| 464 | (("libcrypto opus") |
| 465 | "libcrypto opus alsa libpulse")) |
| 466 | #t))))) |
| 467 | (native-inputs |
| 468 | (list autoconf automake libtool pkg-config)))))) |
| 469 | |
| 470 | (define-public telegram-desktop |
| 471 | (package |
| 472 | (name "telegram-desktop") |
| 473 | (version %telegram-version) |
| 474 | (source |
| 475 | (origin |
| 476 | (method git-fetch) |
| 477 | (uri |
| 478 | (git-reference |
| 479 | (url "https://github.com/telegramdesktop/tdesktop.git") |
| 480 | (commit |
| 481 | (string-append "v" version)))) |
| 482 | (file-name |
| 483 | (git-file-name name version)) |
| 484 | (sha256 |
| 485 | (base32 "0dzf1y3xhqvizg29bd1kya48cjbkq073d2x10ynwcmmx396l4nd8")) |
| 486 | (modules '((guix build utils) |
| 487 | (ice-9 ftw) |
| 488 | (srfi srfi-1))) |
| 489 | (snippet |
| 490 | #~(begin |
| 491 | (let ((keep |
| 492 | '( ;; Not available in Guix. |
| 493 | "SPMediaKeyTap" "statusnotifieritem" "tgcalls"))) |
| 494 | (with-directory-excursion "Telegram/ThirdParty" |
| 495 | (for-each delete-file-recursively |
| 496 | (lset-difference string=? |
| 497 | (scandir ".") |
| 498 | (cons* "." ".." keep))))))))) |
| 499 | (build-system qt-build-system) |
| 500 | (arguments |
| 501 | (list #:tests? #f ; No target |
| 502 | #:imported-modules |
| 503 | `(,@%qt-build-system-modules |
| 504 | (guix build glib-or-gtk-build-system)) |
| 505 | #:modules |
| 506 | '((guix build qt-build-system) |
| 507 | ((guix build glib-or-gtk-build-system) |
| 508 | #:prefix glib-or-gtk:) |
| 509 | (guix build utils) |
| 510 | (ice-9 match)) |
| 511 | #:configure-flags |
| 512 | #~(list |
| 513 | ;; Client applications must provide their own API-ID and API-HASH, |
| 514 | ;; see also <https://core.telegram.org/api/obtaining_api_id>. |
| 515 | ;; Here, we snarf the keys from the official Snaps, which are |
| 516 | ;; also stored in <#$source/snap/snapcraft.yaml>. |
| 517 | "-DTDESKTOP_API_ID=611335" |
| 518 | "-DTDESKTOP_API_HASH=d524b414d21f4d37f08684c1df41ac9c" |
| 519 | ;; Disable WebkitGTK support as it fails to link |
| 520 | "-DDESKTOP_APP_DISABLE_WEBKITGTK=ON" |
| 521 | ;; Use bundled fonts as fallback. |
| 522 | "-DDESKTOP_APP_USE_PACKAGED_FONTS=OFF") |
| 523 | #:phases |
| 524 | #~(modify-phases %standard-phases |
| 525 | (add-after 'unpack 'make-writable |
| 526 | (lambda _ |
| 527 | (for-each make-file-writable (find-files ".")))) |
| 528 | (add-after 'make-writable 'copy-inputs |
| 529 | (lambda _ |
| 530 | (for-each |
| 531 | (match-lambda |
| 532 | ((dst src) |
| 533 | (copy-recursively src dst) |
| 534 | (for-each make-file-writable (find-files dst)))) |
| 535 | '(("cmake" #$cmake-helpers-for-telegram-desktop) |
| 536 | ("Telegram/codegen" #$codegen-for-telegram-desktop) |
| 537 | ("Telegram/lib_base" #$lib-base-for-telegram-desktop) |
| 538 | ("Telegram/lib_crl" #$lib-crl-for-telegram-desktop) |
| 539 | ("Telegram/lib_lottie" #$lib-lottie-for-telegram-desktop) |
| 540 | ("Telegram/lib_qr" #$lib-qr-for-telegram-desktop) |
| 541 | ("Telegram/lib_rlottie" #$lib-rlottie-for-telegram-desktop) |
| 542 | ("Telegram/lib_rpl" #$lib-rpl-for-telegram-desktop) |
| 543 | ("Telegram/lib_spellcheck" #$lib-spellcheck-for-telegram-desktop) |
| 544 | ("Telegram/lib_storage" #$lib-storage-for-telegram-desktop) |
| 545 | ("Telegram/lib_tl" #$lib-tl-for-telegram-desktop) |
| 546 | ("Telegram/lib_ui" #$lib-ui-for-telegram-desktop) |
| 547 | ("Telegram/lib_waylandshells" #$lib-waylandshells-for-telegram-desktop) |
| 548 | ("Telegram/lib_webrtc" #$lib-webrtc-for-telegram-desktop) |
| 549 | ("Telegram/lib_webview" #$lib-webview-for-telegram-desktop) |
| 550 | ("Telegram/ThirdParty/tgcalls" #$tgcalls-for-telegram-desktop))))) |
| 551 | (add-before 'configure 'patch-cxx-flags |
| 552 | (lambda _ |
| 553 | (substitute* "cmake/options_linux.cmake" (("class-memaccess") "all")))) |
| 554 | (add-after 'install 'glib-or-gtk-compile-schemas |
| 555 | (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-compile-schemas)) |
| 556 | (add-after 'glib-or-gtk-compile-schemas 'glib-or-gtk-wrap |
| 557 | (assoc-ref glib-or-gtk:%standard-phases 'glib-or-gtk-wrap))))) |
| 558 | (native-inputs |
| 559 | (list cmake-shared |
| 560 | extra-cmake-modules |
| 561 | `(,glib "bin") |
| 562 | `(,gtk+ "bin") |
| 563 | pkg-config |
| 564 | python-wrapper |
| 565 | qttools-5)) |
| 566 | (inputs |
| 567 | (list alsa-lib |
| 568 | c++-gsl |
| 569 | catch2 |
| 570 | libexpected |
| 571 | fcitx-qt5 |
| 572 | fcitx5-qt |
| 573 | ffmpeg |
| 574 | glib |
| 575 | glibmm-2.64 |
| 576 | gtk+ |
| 577 | hime |
| 578 | hunspell |
| 579 | jemalloc |
| 580 | kwayland |
| 581 | libdbusmenu-qt |
| 582 | libjpeg-turbo |
| 583 | libtgvoip-for-telegram-desktop |
| 584 | lz4 |
| 585 | materialdecoration |
| 586 | minizip |
| 587 | nimf |
| 588 | openal |
| 589 | openssl |
| 590 | opus |
| 591 | pulseaudio |
| 592 | qrcodegen-cpp |
| 593 | qtbase-5 |
| 594 | qtsvg-5 |
| 595 | qt5ct |
| 596 | qtimageformats |
| 597 | qtwayland |
| 598 | range-v3 |
| 599 | rlottie-for-telegram-desktop |
| 600 | rnnoise |
| 601 | webrtc-for-telegram-desktop |
| 602 | libx11 |
| 603 | libxcb |
| 604 | xcb-util-keysyms |
| 605 | xxhash |
| 606 | zlib)) |
| 607 | (propagated-inputs (list dconf)) |
| 608 | (synopsis "Telegram Desktop") |
| 609 | (description "Telegram desktop is the official desktop version of the |
| 610 | Telegram instant messenger.") |
| 611 | (home-page "https://desktop.telegram.org/") |
| 612 | (license |
| 613 | (list |
| 614 | ;; ThirdParty |
| 615 | license:lgpl2.1+ |
| 616 | ;; Others |
| 617 | license:gpl3+)))) |
| 618 | |
| 619 | (define-public tl-parser |
| 620 | (let ((commit "1933e76f8f4fb74311be723b432e4c56e3a5ec06") |
| 621 | (revision "21")) |
| 622 | (package |
| 623 | (name "tl-parser") |
| 624 | (version |
| 625 | (git-version "0" revision commit)) |
| 626 | (source |
| 627 | (origin |
| 628 | (method git-fetch) |
| 629 | (uri |
| 630 | (git-reference |
| 631 | (url "https://github.com/vysheng/tl-parser.git") |
| 632 | (commit commit))) |
| 633 | (file-name |
| 634 | (git-file-name name version)) |
| 635 | (sha256 |
| 636 | (base32 "13cwi247kajzpkbl86hnwmn1sn2h6rqndz6khajbqj0mlw9mv4hq")))) |
| 637 | (build-system cmake-build-system) |
| 638 | (arguments |
| 639 | `(#:tests? #f ; No target |
| 640 | #:imported-modules |
| 641 | ((guix build copy-build-system) |
| 642 | ,@%cmake-build-system-modules) |
| 643 | #:modules |
| 644 | (((guix build copy-build-system) |
| 645 | #:prefix copy:) |
| 646 | (guix build cmake-build-system) |
| 647 | (guix build utils)) |
| 648 | #:phases |
| 649 | (modify-phases %standard-phases |
| 650 | (replace 'install |
| 651 | (lambda args |
| 652 | (apply (assoc-ref copy:%standard-phases 'install) |
| 653 | #:install-plan |
| 654 | '(("." "bin" |
| 655 | #:include ("tl-parser")) |
| 656 | ("../source" "include/tl-parser" |
| 657 | #:include-regexp ("\\.h$"))) |
| 658 | args)))))) |
| 659 | (synopsis "Parse tl scheme to tlo") |
| 660 | (description "TL-Parser is a tl scheme to tlo file parser. It was |
| 661 | formerly a part of telegram-cli, but now being maintained separately.") |
| 662 | (home-page "https://github.com/vysheng/tl-parser") |
| 663 | (license license:gpl2+)))) |
| 664 | |
| 665 | (define-public tgl |
| 666 | (let ((commit "ffb04caca71de0cddf28cd33a4575922900a59ed") |
| 667 | (revision "181")) |
| 668 | (package |
| 669 | (name "tgl") |
| 670 | (version |
| 671 | (git-version "2.0.1" revision commit)) |
| 672 | (source |
| 673 | (origin |
| 674 | (method git-fetch) |
| 675 | (uri |
| 676 | (git-reference |
| 677 | (url "https://github.com/vysheng/tgl.git") |
| 678 | (commit commit))) |
| 679 | (file-name |
| 680 | (git-file-name name version)) |
| 681 | (sha256 |
| 682 | (base32 "0cf5s7ygslb5klg1qv9qdc3hivhspmvh3zkacyyhd2yyikb5p0f9")))) |
| 683 | (build-system gnu-build-system) |
| 684 | (arguments |
| 685 | `(#:tests? #f ; No target |
| 686 | #:imported-modules |
| 687 | ((guix build copy-build-system) |
| 688 | ,@%gnu-build-system-modules) |
| 689 | #:modules |
| 690 | (((guix build copy-build-system) |
| 691 | #:prefix copy:) |
| 692 | (guix build gnu-build-system) |
| 693 | (guix build utils)) |
| 694 | #:configure-flags |
| 695 | (list |
| 696 | ;; Use gcrypt instead of openssl. |
| 697 | "--disable-openssl" |
| 698 | ;; Enable extended queries system. |
| 699 | "--enable-extf" |
| 700 | ;; Include libevent-based net and timers. |
| 701 | "--enable-libevent") |
| 702 | #:phases |
| 703 | (modify-phases %standard-phases |
| 704 | (add-after 'unpack 'trigger-bootstrap |
| 705 | (lambda _ |
| 706 | (delete-file "configure") |
| 707 | #t)) |
| 708 | (add-after 'trigger-bootstrap 'patch-tl-parser |
| 709 | (lambda _ |
| 710 | (delete-file "Makefile.tl-parser") |
| 711 | (substitute* "Makefile.in" |
| 712 | (("include \\$\\{srcdir\\}/Makefile\\.tl-parser") |
| 713 | "") |
| 714 | (("\\$\\{EXE\\}/tl-parser") |
| 715 | "tl-parser")) |
| 716 | #t)) |
| 717 | (replace 'install |
| 718 | (lambda args |
| 719 | (apply (assoc-ref copy:%standard-phases 'install) |
| 720 | #:install-plan |
| 721 | '(("bin" "bin") |
| 722 | ("." "include/tgl" |
| 723 | #:include-regexp ("\\.h$")) |
| 724 | ("libs" "lib/tgl")) |
| 725 | args)))))) |
| 726 | (native-inputs |
| 727 | (list autoconf automake libtool pkg-config)) |
| 728 | (inputs |
| 729 | (list libevent libgcrypt tl-parser zlib)) |
| 730 | (synopsis "Telegram Library") |
| 731 | (description "TGL is the telegram library for telegram-cli.") |
| 732 | (home-page "https://github.com/vysheng/tgl") |
| 733 | (license license:lgpl2.1+)))) |
| 734 | |
| 735 | (define-public telegram-cli |
| 736 | (let ((commit "6547c0b21b977b327b3c5e8142963f4bc246187a") |
| 737 | (revision "324")) |
| 738 | (package |
| 739 | (name "telegram-cli") |
| 740 | (version |
| 741 | (git-version "1.3.1" revision commit)) |
| 742 | (source |
| 743 | (origin |
| 744 | (method git-fetch) |
| 745 | (uri |
| 746 | (git-reference |
| 747 | (url "https://github.com/vysheng/tg.git") |
| 748 | (commit commit))) |
| 749 | (file-name |
| 750 | (git-file-name name version)) |
| 751 | (sha256 |
| 752 | (base32 "0c1w7jgska71jjbvg1y09v52549pwa4zkdjly18yxywn7gayd2p6")))) |
| 753 | (build-system gnu-build-system) |
| 754 | (arguments |
| 755 | `(#:tests? #f ; No target |
| 756 | #:imported-modules |
| 757 | ((guix build copy-build-system) |
| 758 | ,@%gnu-build-system-modules) |
| 759 | #:modules |
| 760 | (((guix build copy-build-system) |
| 761 | #:prefix copy:) |
| 762 | (guix build gnu-build-system) |
| 763 | (guix build utils)) |
| 764 | #:configure-flags |
| 765 | (list |
| 766 | ;; Use gcrypt instead of openssl. |
| 767 | "--disable-openssl") |
| 768 | #:phases |
| 769 | (modify-phases %standard-phases |
| 770 | (add-after 'unpack 'trigger-bootstrap |
| 771 | (lambda _ |
| 772 | (delete-file "configure") |
| 773 | #t)) |
| 774 | (add-after 'trigger-bootstrap 'patch-tgl-and-tlparser |
| 775 | (lambda* (#:key inputs #:allow-other-keys) |
| 776 | (for-each delete-file |
| 777 | (list |
| 778 | "Makefile.tgl" |
| 779 | "Makefile.tl-parser")) |
| 780 | (substitute* "Makefile.in" |
| 781 | (("include \\$\\{srcdir\\}/Makefile\\.tl-parser") |
| 782 | "") |
| 783 | (("include \\$\\{srcdir\\}/Makefile\\.tgl") |
| 784 | "") |
| 785 | (("-I\\$\\{srcdir\\}/tgl") |
| 786 | (string-append "-I" (assoc-ref inputs "tgl") |
| 787 | "/include/tgl")) |
| 788 | (("AUTO=auto") |
| 789 | (string-append "AUTO=" (assoc-ref inputs "tgl") |
| 790 | "/include/tgl/auto")) |
| 791 | (("LIB=libs") |
| 792 | (string-append "LIB=" (assoc-ref inputs "tgl") |
| 793 | "/lib/tgl"))) |
| 794 | #t)) |
| 795 | (replace 'install |
| 796 | (lambda args |
| 797 | (apply (assoc-ref copy:%standard-phases 'install) |
| 798 | #:install-plan |
| 799 | '(("bin" "bin") |
| 800 | ("." "etc/telegram-cli" |
| 801 | #:include-regexp ("\\.pub$") |
| 802 | #:exclude ("tg-server.pub"))) |
| 803 | args)))))) |
| 804 | (native-inputs |
| 805 | (list autoconf automake libtool pkg-config)) |
| 806 | (inputs |
| 807 | (list jansson |
| 808 | libconfig |
| 809 | libevent |
| 810 | libgcrypt |
| 811 | lua |
| 812 | openssl |
| 813 | perl |
| 814 | python |
| 815 | readline |
| 816 | tgl |
| 817 | tl-parser |
| 818 | zlib)) |
| 819 | (synopsis "Telegram Messenger CLI") |
| 820 | (description "TG is the command-line interface for Telegram Messenger.") |
| 821 | (home-page "https://github.com/vysheng/tg") |
| 822 | (license license:gpl2+)))) |
| 823 | |
| 824 | (define-public tgcli |
| 825 | (package |
| 826 | (name "tgcli") |
| 827 | (version "0.3.1") |
| 828 | (source |
| 829 | (origin |
| 830 | (method git-fetch) |
| 831 | (uri |
| 832 | (git-reference |
| 833 | (url "https://github.com/erayerdin/tgcli") |
| 834 | (commit (string-append "v" version)))) |
| 835 | (file-name |
| 836 | (git-file-name name version)) |
| 837 | (sha256 |
| 838 | (base32 "082zim7rh4r8qyscqimjh2sz7998vv9j1i2y2wwz2rgrlhkhly5r")))) |
| 839 | (build-system python-build-system) |
| 840 | (arguments |
| 841 | `(#:phases |
| 842 | (modify-phases %standard-phases |
| 843 | ;; Test requirements referes to specific versions of packages, |
| 844 | ;; which are too old. So we patch them to refer to any later versions. |
| 845 | (add-after 'unpack 'patch-test-requirements |
| 846 | (lambda _ |
| 847 | (substitute* "dev.requirements.txt" |
| 848 | (("==") ">=")))) |
| 849 | (replace 'check |
| 850 | (lambda* (#:key inputs outputs tests? #:allow-other-keys) |
| 851 | (when tests? |
| 852 | (add-installed-pythonpath inputs outputs) |
| 853 | (invoke "pytest" "tests"))))))) |
| 854 | (native-inputs |
| 855 | `(("coveralls" ,python-coveralls) |
| 856 | ("pytest" ,python-pytest) |
| 857 | ("pytest-click" ,python-pytest-click) |
| 858 | ("pytest-cov" ,python-pytest-cov) |
| 859 | ("mkdocs" ,python-mkdocs) |
| 860 | ("mkdocs-material" ,python-mkdocs-material) |
| 861 | ("requests-mock" ,python-requests-mock))) |
| 862 | (propagated-inputs |
| 863 | `(("click" ,python-click) |
| 864 | ("colorful" ,python-colorful) |
| 865 | ("requests" ,python-requests) |
| 866 | ("yaspin" ,python-yaspin))) |
| 867 | (home-page "https://tgcli.readthedocs.io") |
| 868 | (synopsis "Telegram Terminal Application") |
| 869 | (description "TgCli is a telegram client to automate repetitive tasks.") |
| 870 | (license license:asl2.0))) |