1 |
commit: 052e291b89bd1ccba37c8ba8cca4c4df8e5266c5 |
2 |
Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Oct 31 21:06:29 2020 +0000 |
4 |
Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Oct 31 21:14:36 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=052e291b |
7 |
|
8 |
net-im/telegram-desktop: add webrtc flag back to 2.4.5 |
9 |
|
10 |
Closes: https://bugs.gentoo.org/751481 |
11 |
Thanks-to: Joe Kappus |
12 |
Package-Manager: Portage-3.0.8, Repoman-3.0.2 |
13 |
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org> |
14 |
|
15 |
.../telegram-desktop/files/no-webrtc-build.patch | 96 ++++++++++++++++++++++ |
16 |
net-im/telegram-desktop/metadata.xml | 1 + |
17 |
.../telegram-desktop/telegram-desktop-2.4.5.ebuild | 16 +++- |
18 |
3 files changed, 110 insertions(+), 3 deletions(-) |
19 |
|
20 |
diff --git a/net-im/telegram-desktop/files/no-webrtc-build.patch b/net-im/telegram-desktop/files/no-webrtc-build.patch |
21 |
new file mode 100644 |
22 |
index 00000000000..8ae4113f440 |
23 |
--- /dev/null |
24 |
+++ b/net-im/telegram-desktop/files/no-webrtc-build.patch |
25 |
@@ -0,0 +1,96 @@ |
26 |
+diff --git a/Telegram/SourceFiles/calls/calls_instance.cpp b/Telegram/SourceFiles/calls/calls_instance.cpp |
27 |
+index e99958109..bb7678d3c 100644 |
28 |
+--- a/Telegram/SourceFiles/calls/calls_instance.cpp |
29 |
++++ b/Telegram/SourceFiles/calls/calls_instance.cpp |
30 |
+@@ -350,8 +350,11 @@ std::shared_ptr<tgcalls::VideoCaptureInterface> Instance::getVideoCapture() { |
31 |
+ return result; |
32 |
+ } |
33 |
+ auto result = std::shared_ptr<tgcalls::VideoCaptureInterface>( |
34 |
++ #ifndef DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION |
35 |
+ tgcalls::VideoCaptureInterface::Create( |
36 |
+- Core::App().settings().callVideoInputDeviceId().toStdString())); |
37 |
++ Core::App().settings().callVideoInputDeviceId().toStdString()) |
38 |
++ #endif |
39 |
++ ); |
40 |
+ _videoCapture = result; |
41 |
+ return result; |
42 |
+ } |
43 |
+diff --git Telegram/lib_webrtc/CMakeLists.txt b/CMakeLists.txt |
44 |
+index 47796f1..1f54c21 100644 |
45 |
+--- a/Telegram/lib_webrtc/CMakeLists.txt |
46 |
++++ b/Telegram/lib_webrtc/CMakeLists.txt |
47 |
+@@ -14,8 +14,10 @@ target_precompile_headers(lib_webrtc PRIVATE ${src_loc}/webrtc/webrtc_pch.h) |
48 |
+ nice_target_sources(lib_webrtc ${src_loc} |
49 |
+ PRIVATE |
50 |
+ webrtc/webrtc_audio_input_tester.cpp |
51 |
++ webrtc/webrtc_audio_input_tester_dummy.cpp |
52 |
+ webrtc/webrtc_audio_input_tester.h |
53 |
+ webrtc/webrtc_media_devices.cpp |
54 |
++ webrtc/webrtc_media_devices_dummy.cpp |
55 |
+ webrtc/webrtc_media_devices.h |
56 |
+ webrtc/webrtc_video_track.cpp |
57 |
+ webrtc/webrtc_video_track.h |
58 |
+@@ -40,10 +42,14 @@ PUBLIC |
59 |
+ if (DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION) |
60 |
+ remove_target_sources(lib_webrtc ${src_loc} |
61 |
+ webrtc/webrtc_video_track.cpp |
62 |
++ webrtc/webrtc_media_devices.cpp |
63 |
++ webrtc/webrtc_audio_input_tester.cpp |
64 |
+ ) |
65 |
+ else() |
66 |
+ remove_target_sources(lib_webrtc ${src_loc} |
67 |
+ webrtc/webrtc_video_track_dummy.cpp |
68 |
++ webrtc/webrtc_media_devices_dummy.cpp |
69 |
++ webrtc/webrtc_audio_input_tester_dummy.cpp |
70 |
+ ) |
71 |
+ target_link_libraries(lib_webrtc |
72 |
+ PRIVATE |
73 |
+diff --git Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.h b/webrtc/webrtc_audio_input_tester.h |
74 |
+index 1ae8d30..008df7e 100644 |
75 |
+--- a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.h |
76 |
++++ b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.h |
77 |
+@@ -20,11 +20,13 @@ public: |
78 |
+ [[nodiscard]] float getAndResetLevel(); |
79 |
+ |
80 |
+ private: |
81 |
++#ifndef DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION |
82 |
+ class Impl; |
83 |
+- |
84 |
++#endif |
85 |
+ std::shared_ptr<std::atomic<int>> _maxSample; |
86 |
++#ifndef DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION |
87 |
+ crl::object_on_thread<Impl> _impl; |
88 |
+- |
89 |
++#endif |
90 |
+ }; |
91 |
+ |
92 |
+ } // namespace Webrtc |
93 |
+diff --git Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester_dummy.cpp b/webrtc/webrtc_audio_input_tester_dummy.cpp |
94 |
+new file mode 100644 |
95 |
+index 0000000..4e47eaa |
96 |
+--- a//dev/null |
97 |
++++ b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester_dummy.cpp |
98 |
+@@ -0,0 +1,11 @@ |
99 |
++#include "webrtc/webrtc_audio_input_tester.h" |
100 |
++ |
101 |
++namespace Webrtc { |
102 |
++AudioInputTester::AudioInputTester(const QString &deviceId) |
103 |
++: _maxSample(std::make_shared<std::atomic<int>>(0)) {} |
104 |
++AudioInputTester::~AudioInputTester() {} |
105 |
++void AudioInputTester::setDeviceId(const QString &deviceId) {}; |
106 |
++float AudioInputTester::getAndResetLevel() { |
107 |
++ return _maxSample->exchange(0) / float(INT16_MAX);\ |
108 |
++} |
109 |
++} |
110 |
+diff --git Telegram/lib_webrtc/webrtc/webrtc_media_devices_dummy.cpp b/webrtc/webrtc_media_devices_dummy.cpp |
111 |
+new file mode 100644 |
112 |
+index 0000000..8d5d245 |
113 |
+--- a/dev/null |
114 |
++++ b/Telegram/lib_webrtc/webrtc/webrtc_media_devices_dummy.cpp |
115 |
+@@ -0,0 +1,6 @@ |
116 |
++#include "webrtc/webrtc_media_devices.h" |
117 |
++namespace Webrtc { |
118 |
++std::vector<VideoInput> GetVideoInputList() { return std::vector<VideoInput>(); }; |
119 |
++std::vector<AudioInput> GetAudioInputList() { return std::vector<AudioInput>(); }; |
120 |
++std::vector<AudioOutput> GetAudioOutputList() { return std::vector<AudioOutput>(); }; |
121 |
++} |
122 |
|
123 |
diff --git a/net-im/telegram-desktop/metadata.xml b/net-im/telegram-desktop/metadata.xml |
124 |
index f7ab5b26ef9..4e1022a426d 100644 |
125 |
--- a/net-im/telegram-desktop/metadata.xml |
126 |
+++ b/net-im/telegram-desktop/metadata.xml |
127 |
@@ -9,5 +9,6 @@ |
128 |
<flag name="enchant">Enable the app-text/aspell spell-checking backend</flag> |
129 |
<flag name="hunspell">Enable the app-text/hunspell spell-checking backend</flag> |
130 |
<flag name="lto">Enable Link Time Optimization (LTO / IPO)</flag> |
131 |
+ <flag name="webrtc">WebRTC based video call support</flag> |
132 |
</use> |
133 |
</pkgmetadata> |
134 |
|
135 |
diff --git a/net-im/telegram-desktop/telegram-desktop-2.4.5.ebuild b/net-im/telegram-desktop/telegram-desktop-2.4.5.ebuild |
136 |
index 953d5820864..ca2ff2db3af 100644 |
137 |
--- a/net-im/telegram-desktop/telegram-desktop-2.4.5.ebuild |
138 |
+++ b/net-im/telegram-desktop/telegram-desktop-2.4.5.ebuild |
139 |
@@ -17,7 +17,7 @@ SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${ |
140 |
LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+" |
141 |
SLOT="0" |
142 |
KEYWORDS="~amd64 ~ppc64" |
143 |
-IUSE="+dbus enchant +gtk +hunspell libressl lto pulseaudio +spell +X" |
144 |
+IUSE="+dbus enchant +gtk +hunspell libressl lto pulseaudio +spell +webrtc +X" |
145 |
|
146 |
RDEPEND=" |
147 |
!net-im/telegram-desktop-bin |
148 |
@@ -35,11 +35,9 @@ RDEPEND=" |
149 |
media-fonts/open-sans |
150 |
media-libs/alsa-lib |
151 |
media-libs/fontconfig:= |
152 |
- media-libs/libjpeg-turbo:= |
153 |
~media-libs/libtgvoip-2.4.4_p20201030[pulseaudio=] |
154 |
media-libs/openal[alsa] |
155 |
media-libs/opus:= |
156 |
- ~media-libs/tg_owt-0_pre20201030[pulseaudio=] |
157 |
media-video/ffmpeg:=[alsa,opus] |
158 |
sys-libs/zlib[minizip] |
159 |
virtual/libiconv |
160 |
@@ -58,6 +56,10 @@ RDEPEND=" |
161 |
hunspell? ( >=app-text/hunspell-1.7:= ) |
162 |
!pulseaudio? ( media-sound/apulse[sdk] ) |
163 |
pulseaudio? ( media-sound/pulseaudio ) |
164 |
+ webrtc? ( |
165 |
+ media-libs/libjpeg-turbo:= |
166 |
+ ~media-libs/tg_owt-0_pre20201030[pulseaudio=] |
167 |
+ ) |
168 |
" |
169 |
|
170 |
DEPEND=" |
171 |
@@ -77,6 +79,7 @@ REQUIRED_USE=" |
172 |
spell? ( |
173 |
^^ ( enchant hunspell ) |
174 |
) |
175 |
+ webrtc? ( !libressl ) |
176 |
" |
177 |
|
178 |
S="${WORKDIR}/${MY_P}" |
179 |
@@ -91,6 +94,12 @@ pkg_pretend() { |
180 |
fi |
181 |
} |
182 |
|
183 |
+src_prepare() { |
184 |
+ # conditional patching is bad, but we want vanilla telegram with webrtc. |
185 |
+ use webrtc || local PATCHES=( "${FILESDIR}/no-webrtc-build.patch" ) |
186 |
+ cmake_src_prepare |
187 |
+} |
188 |
+ |
189 |
src_configure() { |
190 |
local mycxxflags=( |
191 |
-Wno-deprecated-declarations |
192 |
@@ -116,6 +125,7 @@ src_configure() { |
193 |
-DTDESKTOP_LAUNCHER_BASENAME="${PN}" |
194 |
-DDESKTOP_APP_DISABLE_DBUS_INTEGRATION="$(usex dbus OFF ON)" |
195 |
-DDESKTOP_APP_DISABLE_SPELLCHECK="$(usex spell OFF ON)" # enables hunspell (recommended) |
196 |
+ -DDESKTOP_APP_DISABLE_WEBRTC_INTEGRATION="$(usex webrtc OFF ON)" |
197 |
-DDESKTOP_APP_USE_ENCHANT="$(usex enchant ON OFF)" # enables enchant and disables hunspell |
198 |
$(usex lto "-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON" '') |
199 |
) |