Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-libs/tg_owt/files/, media-libs/tg_owt/
Date: Mon, 03 May 2021 17:01:52
Message-Id: 1620061297.d7a76276b75d8de39cb710ce55772d4600074042.gyakovlev@gentoo
1 commit: d7a76276b75d8de39cb710ce55772d4600074042
2 Author: Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
3 AuthorDate: Tue Apr 27 23:22:51 2021 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Mon May 3 17:01:37 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7a76276
7
8 media-libs/tg_owt: bump to 0_pre20210422, unbundle libs
9
10 This allows us to clean up the ebuild a bit
11
12 Also removed now-defunct alsa/pulseaudio dependencies. Telegram uses
13 openal these days.
14
15 Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com>
16 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
17
18 media-libs/tg_owt/Manifest | 1 +
19 .../files/Allow-using-packaged-third_party.patch | 487 +++++++++++++++++++++
20 media-libs/tg_owt/tg_owt-0_pre20210422.ebuild | 83 ++++
21 3 files changed, 571 insertions(+)
22
23 diff --git a/media-libs/tg_owt/Manifest b/media-libs/tg_owt/Manifest
24 index 024105bd32d..cb642761504 100644
25 --- a/media-libs/tg_owt/Manifest
26 +++ b/media-libs/tg_owt/Manifest
27 @@ -1,3 +1,4 @@
28 DIST libvpx-5b63f0f821e94f8072eb483014cfc33b05978bb9.tar.gz 5337558 BLAKE2B 795f613cee5efc4f6382b09063978b772ebb283fb1f5f621f5fbac018a6aca4721319de89dba02cf66202fe92bf9df681c27b94657a67acea66293b9cf3e1b0c SHA512 ad151972dc6077ddc520d7b6aa14d64e3183e010ceddd5acc6e2d9407f3476006a92461f61662b826feab623a65e748df60d5478af56bd657fbacbdb71dddec6
29 DIST libyuv-ad890067f661dc747a975bc55ba3767fe30d4452.tar.gz 473845 BLAKE2B 664be51c166440e6b03fa98f65d907efc446800804058a5ea7fdf944e12cb1237a1487e83fbe9a2f1ce4c73521234e43632f921ad0333507737d81e1cb23ce8f SHA512 f97529b80a786e2e92443caabebd6d85a42641e10c3d2940b0f69bedf3b8a96c69c3247abddd059c4ddd6f78107ab7214222a4267a559fc2086c8edf5ea1afbc
30 DIST tg_owt-0_pre20210309.tar.gz 16159542 BLAKE2B 354992fca17f6217daa7294a8b60aa96f16b1198a07c79599ce676770cde068bf3ebf83c3935613ab181d4f7f23abbf2e4dd3ba41988b7505f27f537ada87fc2 SHA512 eca2c249d4837f8564218ea969390579b7f07c40879a80249310d978ba6d8865b85ec12e324fdba92af2d0b9bd501f2328fad5475028211013239dc35f508bb0
31 +DIST tg_owt-0_pre20210422.tar.gz 16156802 BLAKE2B 823248e31d7abc91402c32aa0f062f1a77a3d8c4ebf63b4e73a8f290a5691e002a6ec09a5b7ffed1087565b9a419646924030dfb3eb3d0d6aec8cfc51cf1bf73 SHA512 24b66840a54d102b96bc32636dc8b85d31f74b344244985be929db4e14b13ee60f1fbc43269526352064cee8066839c886fae1aff95276089ab60d0a14de9ec6
32
33 diff --git a/media-libs/tg_owt/files/Allow-using-packaged-third_party.patch b/media-libs/tg_owt/files/Allow-using-packaged-third_party.patch
34 new file mode 100644
35 index 00000000000..17025826a48
36 --- /dev/null
37 +++ b/media-libs/tg_owt/files/Allow-using-packaged-third_party.patch
38 @@ -0,0 +1,487 @@
39 +From dbfceeea4280412358202d511e02e95a040d0297 Mon Sep 17 00:00:00 2001
40 +From: mid-kid <esteve.varela@×××××.com>
41 +Date: Sun, 7 Mar 2021 17:12:34 +0100
42 +Subject: [PATCH] Allow using packaged third_party
43 +
44 +This patch adds support for building tg_owt using system libraries
45 +instead of bundled third_party modules.
46 +
47 +Some libraries haven't been converted for the following reasons:
48 +- pffft: No stable ABI, patched, and not available in major distributions.
49 +- rnnoise: All of the remaining files are custom.
50 +- libsrtp: This project uses private APIs.
51 +- libyuv: No stable ABI, frequent breaking updates, and not available in major distributions.
52 +
53 +Note that: This still installs the system headers for the third_party
54 +modules (albeit in a convenient sub-directory). I haven't figured out a
55 +method to avoid this.
56 +---
57 + CMakeLists.txt | 78 +++++++---------
58 + cmake/external.cmake | 91 +++++++++++++++++++
59 + cmake/libabsl.cmake | 2 +-
60 + cmake/libevent.cmake | 5 +-
61 + cmake/libopenh264.cmake | 17 +++-
62 + cmake/libpffft.cmake | 2 +-
63 + cmake/librnnoise.cmake | 2 +-
64 + cmake/libsrtp.cmake | 2 +-
65 + cmake/libusrsctp.cmake | 2 +-
66 + cmake/libvpx.cmake | 2 +-
67 + cmake/libwebrtcbuild.cmake | 4 +-
68 + cmake/libyuv.cmake | 2 +-
69 + cmake/tg_owtConfig.cmake | 5 +
70 + .../codecs/h264/h264_encoder_impl.cc | 8 +-
71 + .../codecs/h264/h264_encoder_impl.h | 2 +-
72 + src/rtc_base/task_queue_libevent.cc | 2 +-
73 + 16 files changed, 166 insertions(+), 60 deletions(-)
74 +
75 +diff --git a/CMakeLists.txt b/CMakeLists.txt
76 +index 7f8e3bd..3462351 100644
77 +--- a/CMakeLists.txt
78 ++++ b/CMakeLists.txt
79 +@@ -60,7 +60,6 @@ include(cmake/librnnoise.cmake)
80 + include(cmake/libsrtp.cmake)
81 + include(cmake/libusrsctp.cmake)
82 + include(cmake/libvpx.cmake)
83 +-include(cmake/libwebrtcbuild.cmake)
84 + include(cmake/libyuv.cmake)
85 + if (NOT WIN32 AND NOT APPLE)
86 + include(cmake/libevent.cmake)
87 +@@ -80,41 +79,19 @@ init_target(tg_owt)
88 +
89 + set_target_properties(tg_owt PROPERTIES SOVERSION 0 VERSION 0.0.0)
90 +
91 ++target_link_libraries(tg_owt
92 ++PRIVATE
93 ++ tg_owt::libpffft
94 ++ tg_owt::librnnoise
95 ++ tg_owt::libsrtp
96 ++ tg_owt::libyuv
97 ++)
98 ++
99 + if (is_x86 OR is_x64)
100 + target_link_libraries(tg_owt
101 +- PUBLIC
102 +- tg_owt::libwebrtcbuild
103 + PRIVATE
104 + tg_owt::tg_owt_avx2
105 + tg_owt::tg_owt_sse2
106 +- tg_owt::libabsl
107 +- tg_owt::libopenh264
108 +- tg_owt::libpffft
109 +- tg_owt::librnnoise
110 +- tg_owt::libsrtp
111 +- tg_owt::libusrsctp
112 +- tg_owt::libvpx
113 +- tg_owt::libvpx_mmx
114 +- tg_owt::libvpx_sse2
115 +- tg_owt::libvpx_ssse3
116 +- tg_owt::libvpx_sse4
117 +- tg_owt::libvpx_avx
118 +- tg_owt::libvpx_avx2
119 +- tg_owt::libyuv
120 +- )
121 +-else()
122 +- target_link_libraries(tg_owt
123 +- PUBLIC
124 +- tg_owt::libwebrtcbuild
125 +- PRIVATE
126 +- tg_owt::libabsl
127 +- tg_owt::libopenh264
128 +- tg_owt::libpffft
129 +- tg_owt::librnnoise
130 +- tg_owt::libsrtp
131 +- tg_owt::libusrsctp
132 +- tg_owt::libvpx
133 +- tg_owt::libyuv
134 + )
135 + endif()
136 +
137 +@@ -131,9 +108,6 @@ PRIVATE
138 + ${libopenh264_yasm_objects}
139 + )
140 +
141 +-if (NOT WIN32 AND NOT APPLE)
142 +- target_link_libraries(tg_owt PRIVATE tg_owt::libevent)
143 +-endif()
144 + if (APPLE)
145 + target_link_libraries(tg_owt PUBLIC tg_owt::libsdkmacos)
146 + endif()
147 +@@ -141,6 +115,17 @@ endif()
148 + link_openssl(tg_owt)
149 + link_ffmpeg(tg_owt)
150 + link_opus(tg_owt)
151 ++link_libabsl(tg_owt)
152 ++link_libopenh264(tg_owt)
153 ++link_libusrsctp(tg_owt)
154 ++link_libvpx(tg_owt)
155 ++
156 ++if (NOT WIN32 AND NOT APPLE)
157 ++ link_libevent(tg_owt)
158 ++endif()
159 ++
160 ++include(cmake/libwebrtcbuild.cmake)
161 ++target_link_libraries(tg_owt PUBLIC tg_owt::libwebrtcbuild)
162 +
163 + function(add_sublibrary postfix)
164 + add_library(tg_owt_${postfix} OBJECT)
165 +@@ -149,9 +134,8 @@ function(add_sublibrary postfix)
166 + target_link_libraries(tg_owt_${postfix}
167 + PUBLIC
168 + tg_owt::libwebrtcbuild
169 +- PRIVATE
170 +- tg_owt::libabsl
171 + )
172 ++ link_libabsl(tg_owt_${postfix})
173 + target_include_directories(tg_owt_${postfix}
174 + PUBLIC
175 + $<BUILD_INTERFACE:${webrtc_loc}>
176 +@@ -2165,7 +2149,7 @@ else()
177 + endif()
178 +
179 + set(platform_export)
180 +-if (NOT WIN32 AND NOT APPLE)
181 ++if (NOT WIN32 AND NOT APPLE AND NOT LIBEVENT_FOUND)
182 + set(platform_export
183 + libevent
184 + )
185 +@@ -2198,14 +2182,9 @@ endif()
186 +
187 + set(export_targets
188 + ${tg_owt_export}
189 +- libabsl
190 +- libopenh264
191 + libpffft
192 + librnnoise
193 + libsrtp
194 +- libusrsctp
195 +- libvpx
196 +- ${vpx_export}
197 + libwebrtcbuild
198 + libyuv
199 + ${platform_export}
200 +@@ -2214,6 +2193,19 @@ if (TG_OWT_USE_PROTOBUF)
201 + list(APPEND export_targets proto)
202 + endif()
203 +
204 ++if (NOT absl_FOUND)
205 ++ list(APPEND export_targets libabsl)
206 ++endif()
207 ++if (NOT LIBOPENH264_FOUND)
208 ++ list(APPEND export_targets libopenh264)
209 ++endif()
210 ++if (NOT LIBUSRSCTP_FOUND)
211 ++ list(APPEND export_targets libusrsctp)
212 ++endif()
213 ++if (NOT LIBVPX_FOUND)
214 ++ list(APPEND export_targets libvpx ${vpx_export})
215 ++endif()
216 ++
217 + export(
218 + TARGETS ${export_targets}
219 + NAMESPACE tg_owt::
220 +@@ -2223,7 +2215,7 @@ export(
221 + configure_file(
222 + "cmake/tg_owtConfig.cmake"
223 + "${CMAKE_CURRENT_BINARY_DIR}/tg_owtConfig.cmake"
224 +- COPYONLY
225 ++ @ONLY
226 + )
227 +
228 + target_include_directories(tg_owt
229 +diff --git a/cmake/external.cmake b/cmake/external.cmake
230 +index 2132546..e09af96 100644
231 +--- a/cmake/external.cmake
232 ++++ b/cmake/external.cmake
233 +@@ -105,3 +105,94 @@ function(link_libjpeg target_name)
234 + )
235 + endif()
236 + endfunction()
237 ++
238 ++# libabsl
239 ++# HINT: System abseil should be built with -DCMAKE_CXX_STANDARD=17
240 ++function(link_libabsl target_name)
241 ++ if (TG_OWT_PACKAGED_BUILD)
242 ++ find_package(absl)
243 ++ set(absl_FOUND ${absl_FOUND} PARENT_SCOPE)
244 ++ if (absl_FOUND)
245 ++ target_link_libraries(${target_name} INTERFACE absl::strings)
246 ++ endif()
247 ++ endif()
248 ++ if (NOT absl_FOUND)
249 ++ target_link_libraries(${target_name} PRIVATE tg_owt::libabsl)
250 ++ endif()
251 ++endfunction()
252 ++
253 ++# libopenh264
254 ++function(link_libopenh264 target_name)
255 ++ if (TG_OWT_PACKAGED_BUILD)
256 ++ find_package(PkgConfig REQUIRED)
257 ++ pkg_check_modules(LIBOPENH264 openh264)
258 ++ set(LIBOPENH264_FOUND ${LIBOPENH264_FOUND} PARENT_SCOPE)
259 ++ if (LIBOPENH264_FOUND)
260 ++ target_link_libraries(${target_name} PRIVATE ${LIBOPENH264_LIBRARIES})
261 ++ target_include_directories(${target_name} PRIVATE ${LIBOPENH264_INCLUDE_DIRS})
262 ++ endif()
263 ++ endif()
264 ++ if (NOT LIBOPENH264_FOUND)
265 ++ target_link_libraries(${target_name} PRIVATE tg_owt::libopenh264)
266 ++ target_include_directories(${target_name} PRIVATE ${libopenh264_loc}/include)
267 ++ endif()
268 ++endfunction()
269 ++
270 ++# libusrsctp
271 ++function(link_libusrsctp target_name)
272 ++ if (TG_OWT_PACKAGED_BUILD)
273 ++ find_package(PkgConfig REQUIRED)
274 ++ pkg_check_modules(LIBUSRSCTP usrsctp)
275 ++ set(LIBUSRSCTP_FOUND ${LIBUSRSCTP_FOUND} PARENT_SCOPE)
276 ++ if (LIBUSRSCTP_FOUND)
277 ++ target_link_libraries(${target_name} PRIVATE ${LIBUSRSCTP_LIBRARIES})
278 ++ target_include_directories(${target_name} PRIVATE ${LIBUSRSCTP_INCLUDE_DIRS})
279 ++ endif()
280 ++ endif()
281 ++ if (NOT LIBUSRSCTP_FOUND)
282 ++ target_link_libraries(${target_name} PRIVATE tg_owt::libusrsctp)
283 ++ endif()
284 ++endfunction()
285 ++
286 ++# libvpx
287 ++function(link_libvpx target_name)
288 ++ if (TG_OWT_PACKAGED_BUILD)
289 ++ find_package(PkgConfig REQUIRED)
290 ++ pkg_check_modules(LIBVPX vpx>=1.10.0)
291 ++ set(LIBVPX_FOUND ${LIBVPX_FOUND} PARENT_SCOPE)
292 ++ if (LIBVPX_FOUND)
293 ++ target_link_libraries(${target_name} PRIVATE ${LIBVPX_LIBRARIES})
294 ++ target_include_directories(${target_name} PRIVATE ${LIBVPX_INCLUDE_DIRS})
295 ++ endif()
296 ++ endif()
297 ++ if (NOT LIBVPX_FOUND)
298 ++ target_link_libraries(${target_name} PRIVATE tg_owt::libvpx)
299 ++ if (is_x86 OR is_x64)
300 ++ target_link_libraries(${target_name}
301 ++ PRIVATE
302 ++ tg_owt::libvpx_mmx
303 ++ tg_owt::libvpx_sse2
304 ++ tg_owt::libvpx_ssse3
305 ++ tg_owt::libvpx_sse4
306 ++ tg_owt::libvpx_avx
307 ++ tg_owt::libvpx_avx2
308 ++ )
309 ++ endif()
310 ++ endif()
311 ++endfunction()
312 ++
313 ++# libevent
314 ++function(link_libevent target_name)
315 ++ if (TG_OWT_PACKAGED_BUILD)
316 ++ find_package(PkgConfig REQUIRED)
317 ++ pkg_check_modules(LIBEVENT libevent)
318 ++ set(LIBEVENT_FOUND ${LIBEVENT_FOUND} PARENT_SCOPE)
319 ++ if (LIBEVENT_FOUND)
320 ++ target_link_libraries(${target_name} PRIVATE ${LIBEVENT_LIBRARIES})
321 ++ target_include_directories(${target_name} PRIVATE ${LIBEVENT_INCLUDE_DIRS})
322 ++ endif()
323 ++ endif()
324 ++ if (NOT LIBEVENT_FOUND)
325 ++ target_link_libraries(${target_name} PRIVATE tg_owt::libevent)
326 ++ endif()
327 ++endfunction()
328 +diff --git a/cmake/libabsl.cmake b/cmake/libabsl.cmake
329 +index 0cc8920..a82732a 100644
330 +--- a/cmake/libabsl.cmake
331 ++++ b/cmake/libabsl.cmake
332 +@@ -1,4 +1,4 @@
333 +-add_library(libabsl OBJECT)
334 ++add_library(libabsl OBJECT EXCLUDE_FROM_ALL)
335 + init_target(libabsl)
336 + add_library(tg_owt::libabsl ALIAS libabsl)
337 +
338 +diff --git a/cmake/libevent.cmake b/cmake/libevent.cmake
339 +index 0192896..31248fb 100644
340 +--- a/cmake/libevent.cmake
341 ++++ b/cmake/libevent.cmake
342 +@@ -1,4 +1,4 @@
343 +-add_library(libevent OBJECT)
344 ++add_library(libevent OBJECT EXCLUDE_FROM_ALL)
345 + init_target(libevent)
346 + add_library(tg_owt::libevent ALIAS libevent)
347 +
348 +@@ -40,7 +40,8 @@ PRIVATE
349 + )
350 +
351 + target_include_directories(libevent
352 ++PUBLIC
353 ++ $<BUILD_INTERFACE:${libevent_loc}>
354 + PRIVATE
355 + ${webrtc_loc}
356 +- ${libevent_loc}
357 + )
358 +diff --git a/cmake/libopenh264.cmake b/cmake/libopenh264.cmake
359 +index 45ce7c9..7d4742e 100644
360 +--- a/cmake/libopenh264.cmake
361 ++++ b/cmake/libopenh264.cmake
362 +@@ -1,4 +1,4 @@
363 +-add_library(libopenh264 OBJECT)
364 ++add_library(libopenh264 OBJECT EXCLUDE_FROM_ALL)
365 + init_target(libopenh264)
366 + add_library(tg_owt::libopenh264 ALIAS libopenh264)
367 +
368 +@@ -207,6 +207,21 @@ set(include_directories
369 +
370 + target_include_directories(libopenh264 PRIVATE ${include_directories})
371 +
372 ++# Create include-able wels/ directory for public use of the library
373 ++set(GEN_INC ${CMAKE_CURRENT_BINARY_DIR}/openh264_include)
374 ++add_custom_command(OUTPUT ${GEN_INC}/wels
375 ++COMMAND ${CMAKE_COMMAND} -E make_directory ${GEN_INC}/wels
376 ++COMMAND ${CMAKE_COMMAND} -E copy
377 ++ ${libopenh264_loc}/codec/api/svc/codec_api.h
378 ++ ${libopenh264_loc}/codec/api/svc/codec_app_def.h
379 ++ ${libopenh264_loc}/codec/api/svc/codec_def.h
380 ++ ${libopenh264_loc}/codec/api/svc/codec_ver.h
381 ++ ${GEN_INC}/wels
382 ++VERBATIM
383 ++)
384 ++target_sources(libopenh264 PRIVATE ${GEN_INC}/wels)
385 ++target_include_directories(libopenh264 PUBLIC $<BUILD_INTERFACE:${GEN_INC}>)
386 ++
387 + if (is_x86)
388 + set(yasm_defines X86_32)
389 + else()
390 +diff --git a/cmake/libpffft.cmake b/cmake/libpffft.cmake
391 +index fa2e66f..02c3db4 100644
392 +--- a/cmake/libpffft.cmake
393 ++++ b/cmake/libpffft.cmake
394 +@@ -1,4 +1,4 @@
395 +-add_library(libpffft OBJECT)
396 ++add_library(libpffft OBJECT EXCLUDE_FROM_ALL)
397 + init_target(libpffft)
398 + add_library(tg_owt::libpffft ALIAS libpffft)
399 +
400 +diff --git a/cmake/librnnoise.cmake b/cmake/librnnoise.cmake
401 +index 04f72ae..a3e682e 100644
402 +--- a/cmake/librnnoise.cmake
403 ++++ b/cmake/librnnoise.cmake
404 +@@ -1,4 +1,4 @@
405 +-add_library(librnnoise OBJECT)
406 ++add_library(librnnoise OBJECT EXCLUDE_FROM_ALL)
407 + init_target(librnnoise)
408 + add_library(tg_owt::librnnoise ALIAS librnnoise)
409 +
410 +diff --git a/cmake/libsrtp.cmake b/cmake/libsrtp.cmake
411 +index ce4ff64..4754f13 100644
412 +--- a/cmake/libsrtp.cmake
413 ++++ b/cmake/libsrtp.cmake
414 +@@ -1,4 +1,4 @@
415 +-add_library(libsrtp OBJECT)
416 ++add_library(libsrtp OBJECT EXCLUDE_FROM_ALL)
417 + init_target(libsrtp)
418 + add_library(tg_owt::libsrtp ALIAS libsrtp)
419 +
420 +diff --git a/cmake/libusrsctp.cmake b/cmake/libusrsctp.cmake
421 +index ad41d12..1dc5e5e 100644
422 +--- a/cmake/libusrsctp.cmake
423 ++++ b/cmake/libusrsctp.cmake
424 +@@ -1,4 +1,4 @@
425 +-add_library(libusrsctp OBJECT)
426 ++add_library(libusrsctp OBJECT EXCLUDE_FROM_ALL)
427 + init_target(libusrsctp)
428 + add_library(tg_owt::libusrsctp ALIAS libusrsctp)
429 +
430 +diff --git a/cmake/libvpx.cmake b/cmake/libvpx.cmake
431 +index e6775c4..0fdfbac 100644
432 +--- a/cmake/libvpx.cmake
433 ++++ b/cmake/libvpx.cmake
434 +@@ -1,4 +1,4 @@
435 +-add_library(libvpx OBJECT)
436 ++add_library(libvpx OBJECT EXCLUDE_FROM_ALL)
437 + init_target(libvpx)
438 + add_library(tg_owt::libvpx ALIAS libvpx)
439 +
440 +diff --git a/cmake/libwebrtcbuild.cmake b/cmake/libwebrtcbuild.cmake
441 +index 15f854e..8efd18d 100644
442 +--- a/cmake/libwebrtcbuild.cmake
443 ++++ b/cmake/libwebrtcbuild.cmake
444 +@@ -3,9 +3,11 @@ add_library(tg_owt::libwebrtcbuild ALIAS libwebrtcbuild)
445 +
446 + target_link_libraries(libwebrtcbuild
447 + INTERFACE
448 +- tg_owt::libabsl
449 + tg_owt::libyuv
450 + )
451 ++if (NOT absl_FOUND)
452 ++ target_link_libraries(libwebrtcbuild INTERFACE tg_owt::libabsl)
453 ++endif()
454 +
455 + target_compile_definitions(libwebrtcbuild
456 + INTERFACE
457 +diff --git a/cmake/libyuv.cmake b/cmake/libyuv.cmake
458 +index 881f9db..143e239 100644
459 +--- a/cmake/libyuv.cmake
460 ++++ b/cmake/libyuv.cmake
461 +@@ -1,4 +1,4 @@
462 +-add_library(libyuv OBJECT)
463 ++add_library(libyuv OBJECT EXCLUDE_FROM_ALL)
464 + init_target(libyuv)
465 + add_library(tg_owt::libyuv ALIAS libyuv)
466 +
467 +diff --git a/cmake/tg_owtConfig.cmake b/cmake/tg_owtConfig.cmake
468 +index d0001ac..e9f4388 100644
469 +--- a/cmake/tg_owtConfig.cmake
470 ++++ b/cmake/tg_owtConfig.cmake
471 +@@ -1 +1,6 @@
472 ++if (@absl_FOUND@)
473 ++ include(CMakeFindDependencyMacro)
474 ++ find_dependency(absl REQUIRED)
475 ++endif()
476 ++
477 + include("${CMAKE_CURRENT_LIST_DIR}/tg_owtTargets.cmake")
478 +diff --git a/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
479 +index ccf0bc5..85ddc90 100644
480 +--- a/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
481 ++++ b/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
482 +@@ -29,10 +29,10 @@
483 + #include "system_wrappers/include/metrics.h"
484 + #include "third_party/libyuv/include/libyuv/convert.h"
485 + #include "third_party/libyuv/include/libyuv/scale.h"
486 +-#include "third_party/openh264/src/codec/api/svc/codec_api.h"
487 +-#include "third_party/openh264/src/codec/api/svc/codec_app_def.h"
488 +-#include "third_party/openh264/src/codec/api/svc/codec_def.h"
489 +-#include "third_party/openh264/src/codec/api/svc/codec_ver.h"
490 ++#include <wels/codec_api.h>
491 ++#include <wels/codec_app_def.h>
492 ++#include <wels/codec_def.h>
493 ++#include <wels/codec_ver.h>
494 +
495 + namespace webrtc {
496 +
497 +diff --git a/src/modules/video_coding/codecs/h264/h264_encoder_impl.h b/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
498 +index 4eb4ad3..98e4c2f 100644
499 +--- a/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
500 ++++ b/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
501 +@@ -25,7 +25,7 @@
502 + #include "common_video/h264/h264_bitstream_parser.h"
503 + #include "modules/video_coding/codecs/h264/include/h264.h"
504 + #include "modules/video_coding/utility/quality_scaler.h"
505 +-#include "third_party/openh264/src/codec/api/svc/codec_app_def.h"
506 ++#include <wels/codec_app_def.h>
507 +
508 + class ISVCEncoder;
509 +
510 +diff --git a/src/rtc_base/task_queue_libevent.cc b/src/rtc_base/task_queue_libevent.cc
511 +index 38660cd..04bc278 100644
512 +--- a/src/rtc_base/task_queue_libevent.cc
513 ++++ b/src/rtc_base/task_queue_libevent.cc
514 +@@ -27,7 +27,7 @@
515 + #include "absl/strings/string_view.h"
516 + #include "api/task_queue/queued_task.h"
517 + #include "api/task_queue/task_queue_base.h"
518 +-#include "base/third_party/libevent/event.h"
519 ++#include <event.h>
520 + #include "rtc_base/checks.h"
521 + #include "rtc_base/logging.h"
522 + #include "rtc_base/numerics/safe_conversions.h"
523 +--
524 +2.26.3
525 +
526
527 diff --git a/media-libs/tg_owt/tg_owt-0_pre20210422.ebuild b/media-libs/tg_owt/tg_owt-0_pre20210422.ebuild
528 new file mode 100644
529 index 00000000000..9861bd95232
530 --- /dev/null
531 +++ b/media-libs/tg_owt/tg_owt-0_pre20210422.ebuild
532 @@ -0,0 +1,83 @@
533 +# Copyright 2020-2021 Gentoo Authors
534 +# Distributed under the terms of the GNU General Public License v2
535 +
536 +EAPI=7
537 +
538 +inherit cmake
539 +
540 +TG_OWT_COMMIT="18cb4cd9bb4c2f5f5f5e760ec808f74c302bc1bf"
541 +LIBYUV_COMMIT="ad890067f661dc747a975bc55ba3767fe30d4452"
542 +
543 +DESCRIPTION="WebRTC build for Telegram"
544 +HOMEPAGE="https://github.com/desktop-app/tg_owt"
545 +SRC_URI="https://github.com/desktop-app/tg_owt/archive/${TG_OWT_COMMIT}.tar.gz -> ${P}.tar.gz
546 + https://archive.org/download/libyuv-${LIBYUV_COMMIT}.tar/libyuv-${LIBYUV_COMMIT}.tar.gz"
547 +# Fetch libyuv archive from: https://chromium.googlesource.com/libyuv/libyuv/+archive/${LIBYUV_COMMIT}.tar.gz
548 +
549 +LICENSE="BSD"
550 +SLOT="0"
551 +KEYWORDS="~amd64 ~ppc64"
552 +
553 +# Bundled libs:
554 +# - libyuv (no stable versioning, www-client/chromium and media-libs/libvpx bundle it)
555 +# - libsrtp (project uses private APIs)
556 +# - pffft (no stable versioning, patched)
557 +# media-libs/libjpeg-turbo is required for libyuv
558 +DEPEND="
559 + dev-cpp/abseil-cpp:=[cxx17(+)]
560 + dev-libs/libevent:=
561 + dev-libs/openssl:=
562 + dev-libs/protobuf:=
563 + media-libs/libjpeg-turbo:=
564 + >=media-libs/libvpx-1.10.0:=
565 + media-libs/openh264:=
566 + media-libs/opus
567 + media-video/ffmpeg:=
568 + net-libs/usrsctp
569 +"
570 +RDEPEND="${DEPEND}"
571 +BDEPEND="virtual/pkgconfig"
572 +
573 +S="${WORKDIR}/${PN}-${TG_OWT_COMMIT}"
574 +
575 +src_unpack() {
576 + unpack "${P}.tar.gz"
577 + cd "$S/src/third_party/libyuv" || die
578 + unpack "libyuv-${LIBYUV_COMMIT}.tar.gz"
579 +}
580 +
581 +src_prepare() {
582 + eapply "${FILESDIR}/Allow-using-packaged-third_party.patch"
583 +
584 + # We aren't installing any third_party headers
585 + sed -i '/third_party\/libyuv/d' cmake/libyuv.cmake || die
586 +
587 + # libvpx source files aren't included in the repository
588 + sed -i '/include(cmake\/libvpx.cmake)/d' CMakeLists.txt || die
589 +
590 + # Remove screen_drawer files that cause linking errors
591 + # (not used right now I don't think, maybe in a future version)
592 + sed -i -e '/desktop_capture\/screen_drawer\.cc/d' \
593 + -e '/desktop_capture\/screen_drawer_lock_posix\.cc/d' CMakeLists.txt || die
594 +
595 + # Causes forced inclusion of SSE2, so we strip it out on x86* arches
596 + if ! use amd64 && ! use x86; then
597 + sed -i '/modules\/desktop_capture/d' CMakeLists.txt || die
598 + fi
599 +
600 + cmake_src_prepare
601 +}
602 +
603 +src_configure() {
604 + # Defined by -DCMAKE_BUILD_TYPE=Release, avoids crashes
605 + # see https://bugs.gentoo.org/754012
606 + append-cppflags '-DNDEBUG'
607 + cmake_src_configure
608 +}
609 +
610 +src_install() {
611 + cmake_src_install
612 +
613 + # Save about 15MB of useless headers
614 + rm -r "${ED}/usr/include/tg_owt/third_party" || die
615 +}