gnu: Add webrtc-for-telegram-desktop.
[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)
21 #:use-module (gnu packages assembly)
22 #:use-module (gnu packages image)
23 #:use-module (gnu packages linux)
24 #:use-module (gnu packages pkg-config)
25 #:use-module (gnu packages protobuf)
26 #:use-module (gnu packages pulseaudio)
27 #:use-module (gnu packages python)
28 #:use-module (gnu packages tls)
29 #:use-module (gnu packages video)
30 #:use-module (gnu packages xiph)
31 #:use-module ((guix licenses) #:prefix license:)
32 #:use-module (guix packages)
33 #:use-module (guix git-download)
34 #:use-module (guix build-system cmake))
35
36(define-public webrtc-for-telegram-desktop
37 (let ((commit "fa86fcc00c218813d61a272a56feab55c76a1ab9")
38 (revision "52"))
39 (hidden-package
40 (package
41 (name "webrtc-for-telegram-desktop")
42 (version
43 (git-version "0" revision commit))
44 (source
45 (origin
46 (method git-fetch)
47 (uri
48 (git-reference
49 (url "https://github.com/desktop-app/tg_owt.git")
50 (commit commit)))
51 (file-name
52 (git-file-name name version))
53 (sha256
54 (base32 "06gcrlym6vqqw7zlds9lpwyg37d5m81d87h16aps19v0v9gzan0l"))
55 (modules '((guix build utils)
56 (ice-9 ftw)
57 (srfi srfi-1)))
58 (snippet
59 `(begin
60 (let ((keep
61 '( ;; Custom forks which are incompatible with the ones in Guix.
62 "abseil-cpp" "libsrtp" "openh264" "rnnoise"
63 ;; Not available in Guix.
64 "pffft" "usrsctp"
65 ;; Has cmake support files for libvpx input.
66 "libvpx")))
67 (with-directory-excursion "src/third_party"
68 (for-each delete-file-recursively
69 (lset-difference string=?
70 (scandir ".")
71 (cons* "." ".." keep))))
72 #t)))))
73 (build-system cmake-build-system)
74 (arguments
75 `(#:tests? #f ; No target
76 #:configure-flags
77 (list
78 "-DCMAKE_C_FLAGS=-fPIC"
79 "-DCMAKE_CXX_FLAGS=-fPIC")
80 #:phases
81 (modify-phases %standard-phases
82 (add-after 'unpack 'copy-inputs
83 (lambda* (#:key inputs outputs #:allow-other-keys)
84 (let* ((libvpx-from (assoc-ref inputs "libvpx"))
85 (libyuv-from (assoc-ref inputs "libyuv"))
86 (libvpx-to (string-append (getcwd)
87 "/src/third_party/libvpx/source/libvpx"))
88 (libyuv-to (string-append (getcwd)
89 "/src/third_party/libyuv")))
90 (copy-recursively libvpx-from libvpx-to)
91 (copy-recursively libyuv-from libyuv-to))
92 #t)))))
93 (native-inputs
94 `(("pkg-config" ,pkg-config)
95 ("python" ,python-wrapper)
96 ("yasm" ,yasm)))
97 (inputs
98 `(("alsa" ,alsa-lib)
99 ("ffmpeg" ,ffmpeg)
100 ("libjpeg" ,libjpeg-turbo)
101 ("libvpx"
102 ,(origin
103 (method git-fetch)
104 (uri
105 (git-reference
106 (url "https://chromium.googlesource.com/webm/libvpx")
107 (commit "5b63f0f821e94f8072eb483014cfc33b05978bb9")))
108 (file-name
109 (git-file-name "libvpx-for-webrtc-for-telegram-desktop" version))
110 (sha256
111 (base32 "1psvxaddihlw1k5n0anxif3qli6zyw2sa2ywn6mkb8six9myrp68"))))
112 ("libyuv"
113 ,(origin
114 (method git-fetch)
115 (uri
116 (git-reference
117 (url "https://chromium.googlesource.com/libyuv/libyuv")
118 (commit "ad890067f661dc747a975bc55ba3767fe30d4452")))
119 (file-name
120 (git-file-name "libyuv-for-webrtc-for-telegram-desktop" version))
121 (sha256
122 (base32 "01knnk4h247rq536097n9n3s3brxlbby3nv3ppdgsqfda3k159ll"))))
123 ("openssl" ,openssl)
124 ("opus" ,opus)
125 ("protobuf" ,protobuf)
126 ("pulseaudio" ,pulseaudio)))
127 (synopsis "WebRTC support for Telegram Desktop")
128 (description "WebRTC-for-Telegram-Desktop is a custom WebRTC fork by
129Telegram project, for its use in telegram desktop client.")
130 (home-page "https://github.com/desktop-app/tg_owt")
131 (license
132 (list
133 ;; Abseil-CPP
134 license:asl2.0
135 ;; LibYuv
136 (license:non-copyleft "file:///src/third_party/libyuv/LICENSE")
137 ;; OpenH264
138 license:bsd-2
139 ;; PFFFT
140 (license:non-copyleft "file:///src/third_party/pffft/LICENSE")
141 ;; RnNoise
142 license:gpl3
143 ;; LibSRTP, LibVPx, UsrSCTP and Others
144 license:bsd-3))))))