commit:     a1b825fb223fb6ba135082e0ac83f776dab3e63a
Author:     Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
AuthorDate: Fri Dec 10 15:16:20 2021 +0000
Commit:     Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
CommitDate: Fri Dec 10 21:29:36 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a1b825fb

media-libs/tg_owt: Bump to 0_pre20211207

Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com>
Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>

 media-libs/tg_owt/Manifest                         |   1 +
 .../tg_owt-0_pre20211207-allow-disabling-X11.patch | 115 +++++++++++++++++++
 ...g_owt-0_pre20211207-fix-dcsctp-references.patch |  17 +++
 media-libs/tg_owt/tg_owt-0_pre20211207.ebuild      | 125 +++++++++++++++++++++
 4 files changed, 258 insertions(+)

diff --git a/media-libs/tg_owt/Manifest b/media-libs/tg_owt/Manifest
index 70bfd2264067..01088f5e5cb8 100644
--- a/media-libs/tg_owt/Manifest
+++ b/media-libs/tg_owt/Manifest
@@ -1,2 +1,3 @@
 DIST libyuv-ad890067f661dc747a975bc55ba3767fe30d4452.tar.gz 473845 BLAKE2B 
664be51c166440e6b03fa98f65d907efc446800804058a5ea7fdf944e12cb1237a1487e83fbe9a2f1ce4c73521234e43632f921ad0333507737d81e1cb23ce8f
 SHA512 
f97529b80a786e2e92443caabebd6d85a42641e10c3d2940b0f69bedf3b8a96c69c3247abddd059c4ddd6f78107ab7214222a4267a559fc2086c8edf5ea1afbc
 DIST tg_owt-0_pre20210914.tar.gz 16266351 BLAKE2B 
048d6a77046b10af63f4e5c1530b6aeb9d423702a6e34e6e0082a10b06262e19c30aa766cc9ea38549605d8d2cc08bfcd5a4e715ab53c46031c23938f94af27e
 SHA512 
bd46393d9a85fa38fcd560af4f68a4868b25528b134731070e8578217cb0b9bb8b5cf7b3990f619d321ba373e5630a52e467e14d93f71b24de3a5b3e591b8866
+DIST tg_owt-0_pre20211207.tar.gz 16780636 BLAKE2B 
bfa35a43b2085b897eb16986ecfb79ece5f8076d88572869580716014a564023dbc156b1d0885685bf04c57e34f26870dde497e8aae9889e5b2eed6d9a012d8e
 SHA512 
7f8b1ae63371106cd59db6e2a290fd24554d31de4188d243ed6645468dad91c9653b7685add61291830e5309284a87512a73b63c3be76f01ea33701c72f48c90

diff --git 
a/media-libs/tg_owt/files/tg_owt-0_pre20211207-allow-disabling-X11.patch 
b/media-libs/tg_owt/files/tg_owt-0_pre20211207-allow-disabling-X11.patch
new file mode 100644
index 000000000000..0abb3cfb4a37
--- /dev/null
+++ b/media-libs/tg_owt/files/tg_owt-0_pre20211207-allow-disabling-X11.patch
@@ -0,0 +1,115 @@
+Add -DTG_OWT_USE_X11
+
+Allows disabling X11 desktop capturing independently of pipewire support, for
+the few people that run wayland without any X11 support whatsoever.
+
+This setup is untested, but supported by the GNI build system, see:
+* src/modules/desktop_capture/BUILD.gn (option rtc_use_x11_extensions)
+
+Toggling the WEBRTC_USE_X11 define also affects some files under
+src/modules/audio_device, but that falls under "X11 support", regardless...
+
+--- tg_owt-d5c3d43b959c7e9e7d8004b9b7fdadd12ce7d589.orig/CMakeLists.txt
++++ tg_owt-d5c3d43b959c7e9e7d8004b9b7fdadd12ce7d589/CMakeLists.txt
+@@ -21,11 +21,13 @@
+ 
+ option(BUILD_SHARED_LIBS "Builds shared libraries instead of static." 
${TG_OWT_PACKAGED_BUILD})
+ option(TG_OWT_USE_PROTOBUF "Use protobuf to generate additional headers. 
Useful for packaged build." ${BUILD_SHARED_LIBS})
++option(TG_OWT_USE_X11 "Use X11 for desktop capture on non-Apple Unix." ON)
+ option(TG_OWT_USE_PIPEWIRE "Use pipewire for desktop capture on non-Apple 
Unix." ON)
+ option(TG_OWT_DLOPEN_PIPEWIRE "dlopen pipewire 0.3 for desktop capture on 
non-Apple Unix." ${not_packaged_build})
+ option(TG_OWT_BUILD_AUDIO_BACKENDS "Build webrtc audio backends." ON)
+ 
+ if (NOT UNIX OR APPLE)
++    set(TG_OWT_USE_X11 OFF)
+     set(TG_OWT_USE_PIPEWIRE OFF)
+ endif()
+ 
+@@ -84,6 +86,10 @@
+ add_library(tg_owt)
+ init_target(tg_owt)
+ 
++if (TG_OWT_USE_X11)
++    link_x11(tg_owt)
++endif()
++
+ if (TG_OWT_USE_PIPEWIRE)
+     link_glib(tg_owt)
+     if (TG_OWT_DLOPEN_PIPEWIRE)
+@@ -161,10 +167,6 @@
+ include(cmake/libwebrtcbuild.cmake)
+ target_link_libraries(tg_owt PUBLIC tg_owt::libwebrtcbuild)
+ 
+-if (UNIX AND NOT APPLE)
+-    link_x11(tg_owt)
+-endif()
+-
+ function(add_sublibrary postfix)
+     add_library(tg_owt_${postfix} OBJECT)
+     init_feature_target(tg_owt_${postfix} ${postfix})
+@@ -2204,6 +2206,37 @@
+     )
+ endif()
+ 
++if (NOT TG_OWT_USE_X11)
++    remove_target_sources(tg_owt ${webrtc_loc}
++        modules/desktop_capture/linux/mouse_cursor_monitor_x11.cc
++        modules/desktop_capture/linux/mouse_cursor_monitor_x11.h
++        modules/desktop_capture/linux/screen_capturer_x11.cc
++        modules/desktop_capture/linux/screen_capturer_x11.h
++        modules/desktop_capture/linux/shared_x_display.cc
++        modules/desktop_capture/linux/shared_x_display.h
++        modules/desktop_capture/linux/window_capturer_x11.cc
++        modules/desktop_capture/linux/window_capturer_x11.h
++        modules/desktop_capture/linux/window_finder_x11.cc
++        modules/desktop_capture/linux/window_finder_x11.h
++        modules/desktop_capture/linux/window_list_utils.cc
++        modules/desktop_capture/linux/window_list_utils.h
++        modules/desktop_capture/linux/x_atom_cache.cc
++        modules/desktop_capture/linux/x_atom_cache.h
++        modules/desktop_capture/linux/x_error_trap.cc
++        modules/desktop_capture/linux/x_error_trap.h
++        modules/desktop_capture/linux/x_server_pixel_buffer.cc
++        modules/desktop_capture/linux/x_server_pixel_buffer.h
++        modules/desktop_capture/linux/x_window_property.cc
++        modules/desktop_capture/linux/x_window_property.h
++
++        modules/desktop_capture/screen_drawer.cc
++        modules/desktop_capture/screen_drawer.h
++        modules/desktop_capture/screen_drawer_linux.cc
++        modules/desktop_capture/screen_drawer_lock_posix.cc
++        modules/desktop_capture/screen_drawer_lock_posix.h
++    )
++endif()
++
+ if (NOT TG_OWT_USE_PIPEWIRE)
+     remove_target_sources(tg_owt ${webrtc_loc}
+         modules/desktop_capture/linux/base_capturer_pipewire.cc
+--- 
tg_owt-d5c3d43b959c7e9e7d8004b9b7fdadd12ce7d589.orig/cmake/libwebrtcbuild.cmake
++++ tg_owt-d5c3d43b959c7e9e7d8004b9b7fdadd12ce7d589/cmake/libwebrtcbuild.cmake
+@@ -28,6 +28,13 @@
+     BWE_TEST_LOGGING_COMPILE_TIME_ENABLE=0
+ )
+ 
++if (TG_OWT_USE_X11)
++    target_compile_definitions(libwebrtcbuild
++    INTERFACE
++        WEBRTC_USE_X11
++    )
++endif()
++
+ if (TG_OWT_USE_PIPEWIRE)
+     target_compile_definitions(libwebrtcbuild
+     INTERFACE
+@@ -64,11 +71,6 @@
+         INTERFACE
+             WEBRTC_MAC
+         )
+-    else()
+-        target_compile_definitions(libwebrtcbuild
+-        INTERFACE
+-            WEBRTC_USE_X11
+-        )
+     endif()
+ 
+     if (CMAKE_SYSTEM_NAME STREQUAL "Linux")

diff --git 
a/media-libs/tg_owt/files/tg_owt-0_pre20211207-fix-dcsctp-references.patch 
b/media-libs/tg_owt/files/tg_owt-0_pre20211207-fix-dcsctp-references.patch
new file mode 100644
index 000000000000..7b3380dd55de
--- /dev/null
+++ b/media-libs/tg_owt/files/tg_owt-0_pre20211207-fix-dcsctp-references.patch
@@ -0,0 +1,17 @@
+Fix undefined references to dcsctp when linking this library
+
+/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld:
 /usr/lib64/libtg_owt.so.0.0.0: undefined reference to 
`dcsctp::TaskQueueTimeoutFactory::TaskQueueTimeout::TaskQueueTimeout(dcsctp::TaskQueueTimeoutFactory&)'
+/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld:
 /usr/lib64/libtg_owt.so.0.0.0: undefined reference to 
`dcsctp::DcSctpSocketFactory::Create(std::basic_string_view<char, 
std::char_traits<char> >, dcsctp::DcSctpSocketCallbacks&, 
std::unique_ptr<dcsctp::PacketObserver, 
std::default_delete<dcsctp::PacketObserver> >, dcsctp::DcSctpOptions const&)'
+/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/../../../../x86_64-pc-linux-gnu/bin/ld:
 /usr/lib64/libtg_owt.so.0.0.0: undefined reference to `vtable for 
dcsctp::TextPcapPacketObserver'
+
+--- tg_owt-d5c3d43b959c7e9e7d8004b9b7fdadd12ce7d589.orig/CMakeLists.txt
++++ tg_owt-d5c3d43b959c7e9e7d8004b9b7fdadd12ce7d589/CMakeLists.txt
+@@ -808,8 +808,6 @@
+     media/engine/webrtc_media_engine_defaults.cc
+     media/engine/webrtc_video_engine.cc
+     media/engine/webrtc_voice_engine.cc
+-    media/sctp/dcsctp_transport.cc
+-    media/sctp/dcsctp_transport.h
+     media/sctp/sctp_transport_factory.cc
+     media/sctp/sctp_transport_factory.h
+     media/sctp/usrsctp_transport.cc

diff --git a/media-libs/tg_owt/tg_owt-0_pre20211207.ebuild 
b/media-libs/tg_owt/tg_owt-0_pre20211207.ebuild
new file mode 100644
index 000000000000..a0f20c6643ce
--- /dev/null
+++ b/media-libs/tg_owt/tg_owt-0_pre20211207.ebuild
@@ -0,0 +1,125 @@
+# Copyright 2020-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit cmake flag-o-matic
+
+DESCRIPTION="WebRTC build for Telegram"
+HOMEPAGE="https://github.com/desktop-app/tg_owt";
+
+TG_OWT_COMMIT="d5c3d43b959c7e9e7d8004b9b7fdadd12ce7d589"
+LIBYUV_COMMIT="ad890067f661dc747a975bc55ba3767fe30d4452"
+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";
+S="${WORKDIR}/${PN}-${TG_OWT_COMMIT}"
+# Fetch libyuv archive from: 
https://chromium.googlesource.com/libyuv/libyuv/+archive/${LIBYUV_COMMIT}.tar.gz
+
+LICENSE="BSD"
+SLOT="0/${PV##*pre}"
+KEYWORDS="~amd64 ~ppc64"
+IUSE="screencast +X"
+
+# This package's USE flags may change the ABI and require a rebuild of
+#  dependent pacakges. As such, one should make sure to depend on
+#  media-libs/tg_owt[x=,y=,z=] for any package that uses this.
+
+# 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
+       screencast? (
+               dev-libs/glib:2
+               media-video/pipewire:=
+       )
+       X? (
+               x11-libs/libX11
+               x11-libs/libXcomposite
+               x11-libs/libXdamage
+               x11-libs/libXext
+               x11-libs/libXfixes
+               x11-libs/libXrender
+               x11-libs/libXrandr
+               x11-libs/libXtst
+       )
+"
+RDEPEND="${DEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=(
+       "${FILESDIR}/tg_owt-0_pre20210626-allow-disabling-pipewire.patch"
+       "${FILESDIR}/tg_owt-0_pre20211207-allow-disabling-X11.patch"
+       "${FILESDIR}/tg_owt-0_pre20210626-allow-disabling-pulseaudio.patch"
+       "${FILESDIR}/tg_owt-0_pre20211207-fix-dcsctp-references.patch"
+)
+
+src_unpack() {
+       unpack "${P}.tar.gz"
+       cd "${S}/src/third_party/libyuv" || die
+       unpack "libyuv-${LIBYUV_COMMIT}.tar.gz"
+}
+
+src_prepare() {
+       # libvpx source files aren't included in the repository
+       sed -i '/include(cmake\/libvpx.cmake)/d' CMakeLists.txt || die
+
+       # libopenh264 has GENERATED files with yasm that aren't excluded by
+       # EXCLUDE_FROM_ALL, and I have no clue how to avoid this.
+       # These source files aren't used with system-openh264, anyway.
+       sed -i '/include(cmake\/libopenh264.cmake)/d' CMakeLists.txt || die
+
+       cmake_src_prepare
+}
+
+src_configure() {
+       # Defined by -DCMAKE_BUILD_TYPE=Release, avoids crashes
+       # see https://bugs.gentoo.org/754012
+       # EAPI 8 still wipes this flag.
+       append-cppflags '-DNDEBUG'
+
+       local mycmakeargs=(
+               -DTG_OWT_USE_X11=$(usex X)
+               -DTG_OWT_USE_PIPEWIRE=$(usex screencast)
+
+               # Not required by net-im/telegram-desktop right now, I'd rather 
avoid
+               #  the (ABI compatibility) headache.
+               -DTG_OWT_BUILD_AUDIO_BACKENDS=OFF
+               #-DTG_OWT_BUILD_AUDIO_BACKENDS=$(usex alsa)
+               #-DTG_OWT_BUILD_PULSE_BACKEND=$(usex pulseaudio)
+       )
+       cmake_src_configure
+}
+
+src_install() {
+       cmake_src_install
+
+       # Save about 15MB of useless headers
+       rm -r "${ED}/usr/include/tg_owt/rtc_base/third_party" || die
+       rm -r "${ED}/usr/include/tg_owt/common_audio/third_party" || die
+       rm -r "${ED}/usr/include/tg_owt/modules/third_party" || die
+       rm -r "${ED}/usr/include/tg_owt/third_party" || die
+
+       # Install a few headers anyway, as required by 
net-im/telegram-desktop...
+       local headers=(
+               third_party/libyuv/include
+               rtc_base/third_party/sigslot
+               rtc_base/third_party/base64
+       )
+       for dir in "${headers[@]}"; do
+               pushd "${S}/src/${dir}" > /dev/null || die
+               find -type f -name "*.h" -exec install -Dm644 '{}' 
"${ED}/usr/include/tg_owt/${dir}/{}" \; || die
+               popd > /dev/null || die
+       done
+}

Reply via email to