summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-libs/tg_owt')
-rw-r--r--media-libs/tg_owt/Manifest1
-rw-r--r--media-libs/tg_owt/files/Allow-using-packaged-third_party.patch487
-rw-r--r--media-libs/tg_owt/tg_owt-0_pre20210422.ebuild83
3 files changed, 571 insertions, 0 deletions
diff --git a/media-libs/tg_owt/Manifest b/media-libs/tg_owt/Manifest
index 024105bd32de..cb642761504e 100644
--- a/media-libs/tg_owt/Manifest
+++ b/media-libs/tg_owt/Manifest
@@ -1,3 +1,4 @@
DIST libvpx-5b63f0f821e94f8072eb483014cfc33b05978bb9.tar.gz 5337558 BLAKE2B 795f613cee5efc4f6382b09063978b772ebb283fb1f5f621f5fbac018a6aca4721319de89dba02cf66202fe92bf9df681c27b94657a67acea66293b9cf3e1b0c SHA512 ad151972dc6077ddc520d7b6aa14d64e3183e010ceddd5acc6e2d9407f3476006a92461f61662b826feab623a65e748df60d5478af56bd657fbacbdb71dddec6
DIST libyuv-ad890067f661dc747a975bc55ba3767fe30d4452.tar.gz 473845 BLAKE2B 664be51c166440e6b03fa98f65d907efc446800804058a5ea7fdf944e12cb1237a1487e83fbe9a2f1ce4c73521234e43632f921ad0333507737d81e1cb23ce8f SHA512 f97529b80a786e2e92443caabebd6d85a42641e10c3d2940b0f69bedf3b8a96c69c3247abddd059c4ddd6f78107ab7214222a4267a559fc2086c8edf5ea1afbc
DIST tg_owt-0_pre20210309.tar.gz 16159542 BLAKE2B 354992fca17f6217daa7294a8b60aa96f16b1198a07c79599ce676770cde068bf3ebf83c3935613ab181d4f7f23abbf2e4dd3ba41988b7505f27f537ada87fc2 SHA512 eca2c249d4837f8564218ea969390579b7f07c40879a80249310d978ba6d8865b85ec12e324fdba92af2d0b9bd501f2328fad5475028211013239dc35f508bb0
+DIST tg_owt-0_pre20210422.tar.gz 16156802 BLAKE2B 823248e31d7abc91402c32aa0f062f1a77a3d8c4ebf63b4e73a8f290a5691e002a6ec09a5b7ffed1087565b9a419646924030dfb3eb3d0d6aec8cfc51cf1bf73 SHA512 24b66840a54d102b96bc32636dc8b85d31f74b344244985be929db4e14b13ee60f1fbc43269526352064cee8066839c886fae1aff95276089ab60d0a14de9ec6
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
new file mode 100644
index 000000000000..17025826a48a
--- /dev/null
+++ b/media-libs/tg_owt/files/Allow-using-packaged-third_party.patch
@@ -0,0 +1,487 @@
+From dbfceeea4280412358202d511e02e95a040d0297 Mon Sep 17 00:00:00 2001
+From: mid-kid <esteve.varela@gmail.com>
+Date: Sun, 7 Mar 2021 17:12:34 +0100
+Subject: [PATCH] Allow using packaged third_party
+
+This patch adds support for building tg_owt using system libraries
+instead of bundled third_party modules.
+
+Some libraries haven't been converted for the following reasons:
+- pffft: No stable ABI, patched, and not available in major distributions.
+- rnnoise: All of the remaining files are custom.
+- libsrtp: This project uses private APIs.
+- libyuv: No stable ABI, frequent breaking updates, and not available in major distributions.
+
+Note that: This still installs the system headers for the third_party
+modules (albeit in a convenient sub-directory). I haven't figured out a
+method to avoid this.
+---
+ CMakeLists.txt | 78 +++++++---------
+ cmake/external.cmake | 91 +++++++++++++++++++
+ cmake/libabsl.cmake | 2 +-
+ cmake/libevent.cmake | 5 +-
+ cmake/libopenh264.cmake | 17 +++-
+ cmake/libpffft.cmake | 2 +-
+ cmake/librnnoise.cmake | 2 +-
+ cmake/libsrtp.cmake | 2 +-
+ cmake/libusrsctp.cmake | 2 +-
+ cmake/libvpx.cmake | 2 +-
+ cmake/libwebrtcbuild.cmake | 4 +-
+ cmake/libyuv.cmake | 2 +-
+ cmake/tg_owtConfig.cmake | 5 +
+ .../codecs/h264/h264_encoder_impl.cc | 8 +-
+ .../codecs/h264/h264_encoder_impl.h | 2 +-
+ src/rtc_base/task_queue_libevent.cc | 2 +-
+ 16 files changed, 166 insertions(+), 60 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 7f8e3bd..3462351 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -60,7 +60,6 @@ include(cmake/librnnoise.cmake)
+ include(cmake/libsrtp.cmake)
+ include(cmake/libusrsctp.cmake)
+ include(cmake/libvpx.cmake)
+-include(cmake/libwebrtcbuild.cmake)
+ include(cmake/libyuv.cmake)
+ if (NOT WIN32 AND NOT APPLE)
+ include(cmake/libevent.cmake)
+@@ -80,41 +79,19 @@ init_target(tg_owt)
+
+ set_target_properties(tg_owt PROPERTIES SOVERSION 0 VERSION 0.0.0)
+
++target_link_libraries(tg_owt
++PRIVATE
++ tg_owt::libpffft
++ tg_owt::librnnoise
++ tg_owt::libsrtp
++ tg_owt::libyuv
++)
++
+ if (is_x86 OR is_x64)
+ target_link_libraries(tg_owt
+- PUBLIC
+- tg_owt::libwebrtcbuild
+ PRIVATE
+ tg_owt::tg_owt_avx2
+ tg_owt::tg_owt_sse2
+- tg_owt::libabsl
+- tg_owt::libopenh264
+- tg_owt::libpffft
+- tg_owt::librnnoise
+- tg_owt::libsrtp
+- tg_owt::libusrsctp
+- tg_owt::libvpx
+- tg_owt::libvpx_mmx
+- tg_owt::libvpx_sse2
+- tg_owt::libvpx_ssse3
+- tg_owt::libvpx_sse4
+- tg_owt::libvpx_avx
+- tg_owt::libvpx_avx2
+- tg_owt::libyuv
+- )
+-else()
+- target_link_libraries(tg_owt
+- PUBLIC
+- tg_owt::libwebrtcbuild
+- PRIVATE
+- tg_owt::libabsl
+- tg_owt::libopenh264
+- tg_owt::libpffft
+- tg_owt::librnnoise
+- tg_owt::libsrtp
+- tg_owt::libusrsctp
+- tg_owt::libvpx
+- tg_owt::libyuv
+ )
+ endif()
+
+@@ -131,9 +108,6 @@ PRIVATE
+ ${libopenh264_yasm_objects}
+ )
+
+-if (NOT WIN32 AND NOT APPLE)
+- target_link_libraries(tg_owt PRIVATE tg_owt::libevent)
+-endif()
+ if (APPLE)
+ target_link_libraries(tg_owt PUBLIC tg_owt::libsdkmacos)
+ endif()
+@@ -141,6 +115,17 @@ endif()
+ link_openssl(tg_owt)
+ link_ffmpeg(tg_owt)
+ link_opus(tg_owt)
++link_libabsl(tg_owt)
++link_libopenh264(tg_owt)
++link_libusrsctp(tg_owt)
++link_libvpx(tg_owt)
++
++if (NOT WIN32 AND NOT APPLE)
++ link_libevent(tg_owt)
++endif()
++
++include(cmake/libwebrtcbuild.cmake)
++target_link_libraries(tg_owt PUBLIC tg_owt::libwebrtcbuild)
+
+ function(add_sublibrary postfix)
+ add_library(tg_owt_${postfix} OBJECT)
+@@ -149,9 +134,8 @@ function(add_sublibrary postfix)
+ target_link_libraries(tg_owt_${postfix}
+ PUBLIC
+ tg_owt::libwebrtcbuild
+- PRIVATE
+- tg_owt::libabsl
+ )
++ link_libabsl(tg_owt_${postfix})
+ target_include_directories(tg_owt_${postfix}
+ PUBLIC
+ $<BUILD_INTERFACE:${webrtc_loc}>
+@@ -2165,7 +2149,7 @@ else()
+ endif()
+
+ set(platform_export)
+-if (NOT WIN32 AND NOT APPLE)
++if (NOT WIN32 AND NOT APPLE AND NOT LIBEVENT_FOUND)
+ set(platform_export
+ libevent
+ )
+@@ -2198,14 +2182,9 @@ endif()
+
+ set(export_targets
+ ${tg_owt_export}
+- libabsl
+- libopenh264
+ libpffft
+ librnnoise
+ libsrtp
+- libusrsctp
+- libvpx
+- ${vpx_export}
+ libwebrtcbuild
+ libyuv
+ ${platform_export}
+@@ -2214,6 +2193,19 @@ if (TG_OWT_USE_PROTOBUF)
+ list(APPEND export_targets proto)
+ endif()
+
++if (NOT absl_FOUND)
++ list(APPEND export_targets libabsl)
++endif()
++if (NOT LIBOPENH264_FOUND)
++ list(APPEND export_targets libopenh264)
++endif()
++if (NOT LIBUSRSCTP_FOUND)
++ list(APPEND export_targets libusrsctp)
++endif()
++if (NOT LIBVPX_FOUND)
++ list(APPEND export_targets libvpx ${vpx_export})
++endif()
++
+ export(
+ TARGETS ${export_targets}
+ NAMESPACE tg_owt::
+@@ -2223,7 +2215,7 @@ export(
+ configure_file(
+ "cmake/tg_owtConfig.cmake"
+ "${CMAKE_CURRENT_BINARY_DIR}/tg_owtConfig.cmake"
+- COPYONLY
++ @ONLY
+ )
+
+ target_include_directories(tg_owt
+diff --git a/cmake/external.cmake b/cmake/external.cmake
+index 2132546..e09af96 100644
+--- a/cmake/external.cmake
++++ b/cmake/external.cmake
+@@ -105,3 +105,94 @@ function(link_libjpeg target_name)
+ )
+ endif()
+ endfunction()
++
++# libabsl
++# HINT: System abseil should be built with -DCMAKE_CXX_STANDARD=17
++function(link_libabsl target_name)
++ if (TG_OWT_PACKAGED_BUILD)
++ find_package(absl)
++ set(absl_FOUND ${absl_FOUND} PARENT_SCOPE)
++ if (absl_FOUND)
++ target_link_libraries(${target_name} INTERFACE absl::strings)
++ endif()
++ endif()
++ if (NOT absl_FOUND)
++ target_link_libraries(${target_name} PRIVATE tg_owt::libabsl)
++ endif()
++endfunction()
++
++# libopenh264
++function(link_libopenh264 target_name)
++ if (TG_OWT_PACKAGED_BUILD)
++ find_package(PkgConfig REQUIRED)
++ pkg_check_modules(LIBOPENH264 openh264)
++ set(LIBOPENH264_FOUND ${LIBOPENH264_FOUND} PARENT_SCOPE)
++ if (LIBOPENH264_FOUND)
++ target_link_libraries(${target_name} PRIVATE ${LIBOPENH264_LIBRARIES})
++ target_include_directories(${target_name} PRIVATE ${LIBOPENH264_INCLUDE_DIRS})
++ endif()
++ endif()
++ if (NOT LIBOPENH264_FOUND)
++ target_link_libraries(${target_name} PRIVATE tg_owt::libopenh264)
++ target_include_directories(${target_name} PRIVATE ${libopenh264_loc}/include)
++ endif()
++endfunction()
++
++# libusrsctp
++function(link_libusrsctp target_name)
++ if (TG_OWT_PACKAGED_BUILD)
++ find_package(PkgConfig REQUIRED)
++ pkg_check_modules(LIBUSRSCTP usrsctp)
++ set(LIBUSRSCTP_FOUND ${LIBUSRSCTP_FOUND} PARENT_SCOPE)
++ if (LIBUSRSCTP_FOUND)
++ target_link_libraries(${target_name} PRIVATE ${LIBUSRSCTP_LIBRARIES})
++ target_include_directories(${target_name} PRIVATE ${LIBUSRSCTP_INCLUDE_DIRS})
++ endif()
++ endif()
++ if (NOT LIBUSRSCTP_FOUND)
++ target_link_libraries(${target_name} PRIVATE tg_owt::libusrsctp)
++ endif()
++endfunction()
++
++# libvpx
++function(link_libvpx target_name)
++ if (TG_OWT_PACKAGED_BUILD)
++ find_package(PkgConfig REQUIRED)
++ pkg_check_modules(LIBVPX vpx>=1.10.0)
++ set(LIBVPX_FOUND ${LIBVPX_FOUND} PARENT_SCOPE)
++ if (LIBVPX_FOUND)
++ target_link_libraries(${target_name} PRIVATE ${LIBVPX_LIBRARIES})
++ target_include_directories(${target_name} PRIVATE ${LIBVPX_INCLUDE_DIRS})
++ endif()
++ endif()
++ if (NOT LIBVPX_FOUND)
++ target_link_libraries(${target_name} PRIVATE tg_owt::libvpx)
++ if (is_x86 OR is_x64)
++ target_link_libraries(${target_name}
++ PRIVATE
++ tg_owt::libvpx_mmx
++ tg_owt::libvpx_sse2
++ tg_owt::libvpx_ssse3
++ tg_owt::libvpx_sse4
++ tg_owt::libvpx_avx
++ tg_owt::libvpx_avx2
++ )
++ endif()
++ endif()
++endfunction()
++
++# libevent
++function(link_libevent target_name)
++ if (TG_OWT_PACKAGED_BUILD)
++ find_package(PkgConfig REQUIRED)
++ pkg_check_modules(LIBEVENT libevent)
++ set(LIBEVENT_FOUND ${LIBEVENT_FOUND} PARENT_SCOPE)
++ if (LIBEVENT_FOUND)
++ target_link_libraries(${target_name} PRIVATE ${LIBEVENT_LIBRARIES})
++ target_include_directories(${target_name} PRIVATE ${LIBEVENT_INCLUDE_DIRS})
++ endif()
++ endif()
++ if (NOT LIBEVENT_FOUND)
++ target_link_libraries(${target_name} PRIVATE tg_owt::libevent)
++ endif()
++endfunction()
+diff --git a/cmake/libabsl.cmake b/cmake/libabsl.cmake
+index 0cc8920..a82732a 100644
+--- a/cmake/libabsl.cmake
++++ b/cmake/libabsl.cmake
+@@ -1,4 +1,4 @@
+-add_library(libabsl OBJECT)
++add_library(libabsl OBJECT EXCLUDE_FROM_ALL)
+ init_target(libabsl)
+ add_library(tg_owt::libabsl ALIAS libabsl)
+
+diff --git a/cmake/libevent.cmake b/cmake/libevent.cmake
+index 0192896..31248fb 100644
+--- a/cmake/libevent.cmake
++++ b/cmake/libevent.cmake
+@@ -1,4 +1,4 @@
+-add_library(libevent OBJECT)
++add_library(libevent OBJECT EXCLUDE_FROM_ALL)
+ init_target(libevent)
+ add_library(tg_owt::libevent ALIAS libevent)
+
+@@ -40,7 +40,8 @@ PRIVATE
+ )
+
+ target_include_directories(libevent
++PUBLIC
++ $<BUILD_INTERFACE:${libevent_loc}>
+ PRIVATE
+ ${webrtc_loc}
+- ${libevent_loc}
+ )
+diff --git a/cmake/libopenh264.cmake b/cmake/libopenh264.cmake
+index 45ce7c9..7d4742e 100644
+--- a/cmake/libopenh264.cmake
++++ b/cmake/libopenh264.cmake
+@@ -1,4 +1,4 @@
+-add_library(libopenh264 OBJECT)
++add_library(libopenh264 OBJECT EXCLUDE_FROM_ALL)
+ init_target(libopenh264)
+ add_library(tg_owt::libopenh264 ALIAS libopenh264)
+
+@@ -207,6 +207,21 @@ set(include_directories
+
+ target_include_directories(libopenh264 PRIVATE ${include_directories})
+
++# Create include-able wels/ directory for public use of the library
++set(GEN_INC ${CMAKE_CURRENT_BINARY_DIR}/openh264_include)
++add_custom_command(OUTPUT ${GEN_INC}/wels
++COMMAND ${CMAKE_COMMAND} -E make_directory ${GEN_INC}/wels
++COMMAND ${CMAKE_COMMAND} -E copy
++ ${libopenh264_loc}/codec/api/svc/codec_api.h
++ ${libopenh264_loc}/codec/api/svc/codec_app_def.h
++ ${libopenh264_loc}/codec/api/svc/codec_def.h
++ ${libopenh264_loc}/codec/api/svc/codec_ver.h
++ ${GEN_INC}/wels
++VERBATIM
++)
++target_sources(libopenh264 PRIVATE ${GEN_INC}/wels)
++target_include_directories(libopenh264 PUBLIC $<BUILD_INTERFACE:${GEN_INC}>)
++
+ if (is_x86)
+ set(yasm_defines X86_32)
+ else()
+diff --git a/cmake/libpffft.cmake b/cmake/libpffft.cmake
+index fa2e66f..02c3db4 100644
+--- a/cmake/libpffft.cmake
++++ b/cmake/libpffft.cmake
+@@ -1,4 +1,4 @@
+-add_library(libpffft OBJECT)
++add_library(libpffft OBJECT EXCLUDE_FROM_ALL)
+ init_target(libpffft)
+ add_library(tg_owt::libpffft ALIAS libpffft)
+
+diff --git a/cmake/librnnoise.cmake b/cmake/librnnoise.cmake
+index 04f72ae..a3e682e 100644
+--- a/cmake/librnnoise.cmake
++++ b/cmake/librnnoise.cmake
+@@ -1,4 +1,4 @@
+-add_library(librnnoise OBJECT)
++add_library(librnnoise OBJECT EXCLUDE_FROM_ALL)
+ init_target(librnnoise)
+ add_library(tg_owt::librnnoise ALIAS librnnoise)
+
+diff --git a/cmake/libsrtp.cmake b/cmake/libsrtp.cmake
+index ce4ff64..4754f13 100644
+--- a/cmake/libsrtp.cmake
++++ b/cmake/libsrtp.cmake
+@@ -1,4 +1,4 @@
+-add_library(libsrtp OBJECT)
++add_library(libsrtp OBJECT EXCLUDE_FROM_ALL)
+ init_target(libsrtp)
+ add_library(tg_owt::libsrtp ALIAS libsrtp)
+
+diff --git a/cmake/libusrsctp.cmake b/cmake/libusrsctp.cmake
+index ad41d12..1dc5e5e 100644
+--- a/cmake/libusrsctp.cmake
++++ b/cmake/libusrsctp.cmake
+@@ -1,4 +1,4 @@
+-add_library(libusrsctp OBJECT)
++add_library(libusrsctp OBJECT EXCLUDE_FROM_ALL)
+ init_target(libusrsctp)
+ add_library(tg_owt::libusrsctp ALIAS libusrsctp)
+
+diff --git a/cmake/libvpx.cmake b/cmake/libvpx.cmake
+index e6775c4..0fdfbac 100644
+--- a/cmake/libvpx.cmake
++++ b/cmake/libvpx.cmake
+@@ -1,4 +1,4 @@
+-add_library(libvpx OBJECT)
++add_library(libvpx OBJECT EXCLUDE_FROM_ALL)
+ init_target(libvpx)
+ add_library(tg_owt::libvpx ALIAS libvpx)
+
+diff --git a/cmake/libwebrtcbuild.cmake b/cmake/libwebrtcbuild.cmake
+index 15f854e..8efd18d 100644
+--- a/cmake/libwebrtcbuild.cmake
++++ b/cmake/libwebrtcbuild.cmake
+@@ -3,9 +3,11 @@ add_library(tg_owt::libwebrtcbuild ALIAS libwebrtcbuild)
+
+ target_link_libraries(libwebrtcbuild
+ INTERFACE
+- tg_owt::libabsl
+ tg_owt::libyuv
+ )
++if (NOT absl_FOUND)
++ target_link_libraries(libwebrtcbuild INTERFACE tg_owt::libabsl)
++endif()
+
+ target_compile_definitions(libwebrtcbuild
+ INTERFACE
+diff --git a/cmake/libyuv.cmake b/cmake/libyuv.cmake
+index 881f9db..143e239 100644
+--- a/cmake/libyuv.cmake
++++ b/cmake/libyuv.cmake
+@@ -1,4 +1,4 @@
+-add_library(libyuv OBJECT)
++add_library(libyuv OBJECT EXCLUDE_FROM_ALL)
+ init_target(libyuv)
+ add_library(tg_owt::libyuv ALIAS libyuv)
+
+diff --git a/cmake/tg_owtConfig.cmake b/cmake/tg_owtConfig.cmake
+index d0001ac..e9f4388 100644
+--- a/cmake/tg_owtConfig.cmake
++++ b/cmake/tg_owtConfig.cmake
+@@ -1 +1,6 @@
++if (@absl_FOUND@)
++ include(CMakeFindDependencyMacro)
++ find_dependency(absl REQUIRED)
++endif()
++
+ include("${CMAKE_CURRENT_LIST_DIR}/tg_owtTargets.cmake")
+diff --git a/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc b/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
+index ccf0bc5..85ddc90 100644
+--- a/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
++++ b/src/modules/video_coding/codecs/h264/h264_encoder_impl.cc
+@@ -29,10 +29,10 @@
+ #include "system_wrappers/include/metrics.h"
+ #include "third_party/libyuv/include/libyuv/convert.h"
+ #include "third_party/libyuv/include/libyuv/scale.h"
+-#include "third_party/openh264/src/codec/api/svc/codec_api.h"
+-#include "third_party/openh264/src/codec/api/svc/codec_app_def.h"
+-#include "third_party/openh264/src/codec/api/svc/codec_def.h"
+-#include "third_party/openh264/src/codec/api/svc/codec_ver.h"
++#include <wels/codec_api.h>
++#include <wels/codec_app_def.h>
++#include <wels/codec_def.h>
++#include <wels/codec_ver.h>
+
+ namespace webrtc {
+
+diff --git a/src/modules/video_coding/codecs/h264/h264_encoder_impl.h b/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
+index 4eb4ad3..98e4c2f 100644
+--- a/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
++++ b/src/modules/video_coding/codecs/h264/h264_encoder_impl.h
+@@ -25,7 +25,7 @@
+ #include "common_video/h264/h264_bitstream_parser.h"
+ #include "modules/video_coding/codecs/h264/include/h264.h"
+ #include "modules/video_coding/utility/quality_scaler.h"
+-#include "third_party/openh264/src/codec/api/svc/codec_app_def.h"
++#include <wels/codec_app_def.h>
+
+ class ISVCEncoder;
+
+diff --git a/src/rtc_base/task_queue_libevent.cc b/src/rtc_base/task_queue_libevent.cc
+index 38660cd..04bc278 100644
+--- a/src/rtc_base/task_queue_libevent.cc
++++ b/src/rtc_base/task_queue_libevent.cc
+@@ -27,7 +27,7 @@
+ #include "absl/strings/string_view.h"
+ #include "api/task_queue/queued_task.h"
+ #include "api/task_queue/task_queue_base.h"
+-#include "base/third_party/libevent/event.h"
++#include <event.h>
+ #include "rtc_base/checks.h"
+ #include "rtc_base/logging.h"
+ #include "rtc_base/numerics/safe_conversions.h"
+--
+2.26.3
+
diff --git a/media-libs/tg_owt/tg_owt-0_pre20210422.ebuild b/media-libs/tg_owt/tg_owt-0_pre20210422.ebuild
new file mode 100644
index 000000000000..9861bd952328
--- /dev/null
+++ b/media-libs/tg_owt/tg_owt-0_pre20210422.ebuild
@@ -0,0 +1,83 @@
+# Copyright 2020-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit cmake
+
+TG_OWT_COMMIT="18cb4cd9bb4c2f5f5f5e760ec808f74c302bc1bf"
+LIBYUV_COMMIT="ad890067f661dc747a975bc55ba3767fe30d4452"
+
+DESCRIPTION="WebRTC build for Telegram"
+HOMEPAGE="https://github.com/desktop-app/tg_owt"
+SRC_URI="https://github.com/desktop-app/tg_owt/archive/${TG_OWT_COMMIT}.tar.gz -> ${P}.tar.gz
+ https://archive.org/download/libyuv-${LIBYUV_COMMIT}.tar/libyuv-${LIBYUV_COMMIT}.tar.gz"
+# Fetch libyuv archive from: https://chromium.googlesource.com/libyuv/libyuv/+archive/${LIBYUV_COMMIT}.tar.gz
+
+LICENSE="BSD"
+SLOT="0"
+KEYWORDS="~amd64 ~ppc64"
+
+# Bundled libs:
+# - libyuv (no stable versioning, www-client/chromium and media-libs/libvpx bundle it)
+# - libsrtp (project uses private APIs)
+# - pffft (no stable versioning, patched)
+# media-libs/libjpeg-turbo is required for libyuv
+DEPEND="
+ dev-cpp/abseil-cpp:=[cxx17(+)]
+ dev-libs/libevent:=
+ dev-libs/openssl:=
+ dev-libs/protobuf:=
+ media-libs/libjpeg-turbo:=
+ >=media-libs/libvpx-1.10.0:=
+ media-libs/openh264:=
+ media-libs/opus
+ media-video/ffmpeg:=
+ net-libs/usrsctp
+"
+RDEPEND="${DEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+S="${WORKDIR}/${PN}-${TG_OWT_COMMIT}"
+
+src_unpack() {
+ unpack "${P}.tar.gz"
+ cd "$S/src/third_party/libyuv" || die
+ unpack "libyuv-${LIBYUV_COMMIT}.tar.gz"
+}
+
+src_prepare() {
+ eapply "${FILESDIR}/Allow-using-packaged-third_party.patch"
+
+ # We aren't installing any third_party headers
+ sed -i '/third_party\/libyuv/d' cmake/libyuv.cmake || die
+
+ # libvpx source files aren't included in the repository
+ sed -i '/include(cmake\/libvpx.cmake)/d' CMakeLists.txt || die
+
+ # Remove screen_drawer files that cause linking errors
+ # (not used right now I don't think, maybe in a future version)
+ sed -i -e '/desktop_capture\/screen_drawer\.cc/d' \
+ -e '/desktop_capture\/screen_drawer_lock_posix\.cc/d' CMakeLists.txt || die
+
+ # Causes forced inclusion of SSE2, so we strip it out on x86* arches
+ if ! use amd64 && ! use x86; then
+ sed -i '/modules\/desktop_capture/d' CMakeLists.txt || die
+ fi
+
+ cmake_src_prepare
+}
+
+src_configure() {
+ # Defined by -DCMAKE_BUILD_TYPE=Release, avoids crashes
+ # see https://bugs.gentoo.org/754012
+ append-cppflags '-DNDEBUG'
+ cmake_src_configure
+}
+
+src_install() {
+ cmake_src_install
+
+ # Save about 15MB of useless headers
+ rm -r "${ED}/usr/include/tg_owt/third_party" || die
+}