pkgsrc-WIP-changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
+tg_owt-git: WebRTC build for telegram-desktop
Module Name: pkgsrc-wip
Committed By: AcidBear <jake.slazenger%yandex.com@localhost>
Pushed By: jakeSlaz
Date: Sat Feb 27 15:47:36 2021 +0300
Changeset: 154b5e4587d31af1ef609f07bd4c4e646894b011
Added Files:
tg_owt-git/DESCR
tg_owt-git/Makefile
tg_owt-git/PLIST
tg_owt-git/TODO
tg_owt-git/distinfo
tg_owt-git/patches/patch-CMakeLists.txt
tg_owt-git/patches/patch-cmake_external.cmake
tg_owt-git/patches/patch-cmake_libwebrtcbuild.cmake
tg_owt-git/patches/patch-src_media_sctp_sctp_transport.cc
tg_owt-git/patches/patch-src_modules_audio_device_audio_device_impl.cc
tg_owt-git/patches/patch-src_rtc_base_physical_socket_server.cc
tg_owt-git/patches/patch-src_rtc_base_platform_thread_types.h
tg_owt-git/patches/patch-src_rtc_base_task_queue_libevent.cc
Log Message:
+tg_owt-git: WebRTC build for telegram-desktop
To see a diff of this commit:
https://wip.pkgsrc.org/cgi-bin/gitweb.cgi?p=pkgsrc-wip.git;a=commitdiff;h=154b5e4587d31af1ef609f07bd4c4e646894b011
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
diffstat:
tg_owt-git/DESCR | 2 +
tg_owt-git/Makefile | 34 +++++
tg_owt-git/PLIST | 4 +
tg_owt-git/TODO | 1 +
tg_owt-git/distinfo | 14 ++
tg_owt-git/patches/patch-CMakeLists.txt | 164 +++++++++++++++++++++
tg_owt-git/patches/patch-cmake_external.cmake | 47 ++++++
.../patches/patch-cmake_libwebrtcbuild.cmake | 16 ++
.../patches/patch-src_media_sctp_sctp_transport.cc | 22 +++
...h-src_modules_audio_device_audio_device_impl.cc | 14 ++
.../patch-src_rtc_base_physical_socket_server.cc | 25 ++++
.../patch-src_rtc_base_platform_thread_types.h | 13 ++
.../patch-src_rtc_base_task_queue_libevent.cc | 13 ++
13 files changed, 369 insertions(+)
diffs:
diff --git a/tg_owt-git/DESCR b/tg_owt-git/DESCR
new file mode 100644
index 0000000000..30e41add36
--- /dev/null
+++ b/tg_owt-git/DESCR
@@ -0,0 +1,2 @@
+TODO: Fill in a short description of the package.
+TODO: It should be between 3 and 20 lines.
diff --git a/tg_owt-git/Makefile b/tg_owt-git/Makefile
new file mode 100644
index 0000000000..a125f3dcce
--- /dev/null
+++ b/tg_owt-git/Makefile
@@ -0,0 +1,34 @@
+# $NetBSD$
+
+GITHUB_PROJECT= tg_owt
+GITHUB_TAG= 10b988aa9111fd25358443ac34d0d422b5108029
+DISTNAME= ${GITHUB_TAG}
+PKGNAME= ${GITHUB_PROJECT}-git
+CATEGORIES= www
+MASTER_SITES= ${MASTER_SITE_GITHUB:=desktop-app/}
+DIST_SUBDIR= ${GITHUB_PROJECT}
+
+MAINTAINER= pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE= https://github.com/desktop-app/tg_owt/
+COMMENT= WebRTC build for Telegram
+LICENSE= modified-bsd
+
+WRKSRC= ${WRKDIR}/tg_owt-${GITHUB_TAG}
+USE_CMAKE= yes
+USE_TOOLS+= pkg-config
+USE_LANGUAGES= c c++
+
+.include "../../mk/bsd.prefs.mk"
+
+CMAKE_ARGS+= -DCMAKE_C_FLAGS="${CMAKE_C_FLAGS} -fPIC -no-pie"
+
+.include "../../audio/libopus/buildlink3.mk"
+.include "../../comms/srtp/buildlink3.mk"
+.include "../../devel/libevent/buildlink3.mk"
+.include "../../devel/protobuf/buildlink3.mk"
+.include "../../graphics/jpeg/buildlink3.mk"
+.include "../../multimedia/ffmpeg4/buildlink3.mk"
+.include "../../multimedia/libvpx/buildlink3.mk"
+.include "../../wip/usrsctp/buildlink3.mk"
+
+.include "../../mk/bsd.pkg.mk"
diff --git a/tg_owt-git/PLIST b/tg_owt-git/PLIST
new file mode 100644
index 0000000000..92ba51a2d7
--- /dev/null
+++ b/tg_owt-git/PLIST
@@ -0,0 +1,4 @@
+@comment $NetBSD$
+@comment TODO: to fill this file with the file listing:
+@comment TODO: 1. run "/usr/bin/make package"
+@comment TODO: 2. run "/usr/bin/make print-PLIST"
diff --git a/tg_owt-git/TODO b/tg_owt-git/TODO
new file mode 100644
index 0000000000..667c99f071
--- /dev/null
+++ b/tg_owt-git/TODO
@@ -0,0 +1 @@
+* Make it build
diff --git a/tg_owt-git/distinfo b/tg_owt-git/distinfo
new file mode 100644
index 0000000000..c42b6cc38d
--- /dev/null
+++ b/tg_owt-git/distinfo
@@ -0,0 +1,14 @@
+$NetBSD$
+
+SHA1 (tg_owt/10b988aa9111fd25358443ac34d0d422b5108029-10b988aa9111fd25358443ac34d0d422b5108029.tar.gz) = 9e7dcd7a8ac2276bddd7363038b738ff8158adfd
+RMD160 (tg_owt/10b988aa9111fd25358443ac34d0d422b5108029-10b988aa9111fd25358443ac34d0d422b5108029.tar.gz) = 31ed6a96ca980320cc4c15ffe482fa44139ea9d7
+SHA512 (tg_owt/10b988aa9111fd25358443ac34d0d422b5108029-10b988aa9111fd25358443ac34d0d422b5108029.tar.gz) = 10f6ca1a6a82e9bd9af9e815b4d849fdace39332df61d32a9b706bffc3e8647b20f58e63a2fcc4e714e1480768ddd8f7ad21588f1e9762b3c056b205abfd5806
+Size (tg_owt/10b988aa9111fd25358443ac34d0d422b5108029-10b988aa9111fd25358443ac34d0d422b5108029.tar.gz) = 18391959 bytes
+SHA1 (patch-CMakeLists.txt) = 996722b3130d6f49ebdf7265cd90f7ac759fa9bb
+SHA1 (patch-cmake_external.cmake) = 0bba30c00a1645a3c6498f8aebc1fac959924e93
+SHA1 (patch-cmake_libwebrtcbuild.cmake) = 18395d0618ba0bbbe98495c67fc97dc4fd01150e
+SHA1 (patch-src_media_sctp_sctp_transport.cc) = 2446ae9b2cafa1b56f9055d0264903943c8e5fbe
+SHA1 (patch-src_modules_audio_device_audio_device_impl.cc) = 4d8c6c36e98f1e0f50b73fed68184ab53e625b9f
+SHA1 (patch-src_rtc_base_physical_socket_server.cc) = 38e8d8b73723a2f427c8a9f06845c175a0b423b5
+SHA1 (patch-src_rtc_base_platform_thread_types.h) = bda006adbee309a578e4b068c36416c5ae86c947
+SHA1 (patch-src_rtc_base_task_queue_libevent.cc) = 5023e87f776014c7ef7217a3b0eb1c21a33af18a
diff --git a/tg_owt-git/patches/patch-CMakeLists.txt b/tg_owt-git/patches/patch-CMakeLists.txt
new file mode 100644
index 0000000000..91602d3f94
--- /dev/null
+++ b/tg_owt-git/patches/patch-CMakeLists.txt
@@ -0,0 +1,164 @@
+$NetBSD$
+
+--- CMakeLists.txt.orig 2020-11-13 06:17:31.000000000 +0000
++++ CMakeLists.txt
+@@ -3,6 +3,7 @@ cmake_policy(SET CMP0076 NEW)
+ cmake_policy(SET CMP0091 NEW)
+
+ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
++set(CMAKE_POSITION_INDEPENDENT_BINARIES True)
+
+ set(TG_OWT_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'macstore' for Mac App Store.")
+
+@@ -44,17 +45,11 @@ include(cmake/libopenh264.cmake)
+ include(cmake/libpffft.cmake)
+ 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)
+-endif()
+ if (APPLE)
+ include(cmake/libsdkmacos.cmake)
+ endif()
+-
+ # Use a separate subdirectory, because it will be exported as an INTERFACE
+ # for the generated sources and headers.
+ if (TG_OWT_USE_PROTOBUF)
+@@ -76,14 +71,6 @@ if (is_x86 OR is_x64)
+ 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()
+@@ -96,8 +83,6 @@ else()
+ tg_owt::libpffft
+ tg_owt::librnnoise
+ tg_owt::libsrtp
+- tg_owt::libusrsctp
+- tg_owt::libvpx
+ tg_owt::libyuv
+ )
+ endif()
+@@ -111,13 +96,9 @@ endif()
+
+ target_sources(tg_owt
+ PRIVATE
+- ${libvpx_yasm_objects}
+ ${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()
+@@ -125,13 +106,54 @@ endif()
+ link_openssl(tg_owt)
+ link_ffmpeg(tg_owt)
+ link_opus(tg_owt)
++link_usrsctp(tg_owt)
++link_libvpx(tg_owt)
++if (NOT WIN32 AND NOT APPLE)
++ link_libevent(tg_owt)
++endif()
+
+-if (UNIX AND NOT APPLE)
++if (UNIX AND NOT APPLE AND NOT (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|DragonFly"))
+ link_libalsa(tg_owt)
+ link_libpulse(tg_owt)
+ link_dl(tg_owt)
+ endif()
+
++if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|DragonFly")
++ remove_target_sources(tg_owt ${webrtc_loc}
++ modules/audio_device/linux/alsasymboltable_linux.cc
++ modules/audio_device/linux/alsasymboltable_linux.h
++ modules/audio_device/linux/audio_device_alsa_linux.cc
++ modules/audio_device/linux/audio_device_alsa_linux.h
++ modules/audio_device/linux/audio_mixer_manager_alsa_linux.cc
++ modules/audio_device/linux/audio_mixer_manager_alsa_linux.h
++ modules/audio_device/linux/latebindingsymboltable_linux.cc
++ modules/audio_device/linux/latebindingsymboltable_linux.h
++ modules/audio_device/linux/audio_device_pulse_linux.cc
++ modules/audio_device/linux/audio_device_pulse_linux.h
++ modules/audio_device/linux/audio_mixer_manager_pulse_linux.cc
++ modules/audio_device/linux/audio_mixer_manager_pulse_linux.h
++ modules/audio_device/linux/pulseaudiosymboltable_linux.cc
++ modules/audio_device/linux/pulseaudiosymboltable_linux.h
++ modules/audio_device/mac/audio_device_mac.cc
++ modules/audio_device/mac/audio_device_mac.h
++ modules/audio_device/mac/audio_mixer_manager_mac.cc
++ modules/audio_device/mac/audio_mixer_manager_mac.h
++ modules/audio_device/win/audio_device_core_win.cc
++ modules/audio_device/win/audio_device_core_win.h
++ modules/video_capture/linux/device_info_linux.cc
++ modules/video_capture/linux/video_capture_linux.cc
++ modules/video_capture/windows/device_info_ds.cc
++ modules/video_capture/windows/device_info_ds.h
++ modules/video_capture/windows/help_functions_ds.cc
++ modules/video_capture/windows/help_functions_ds.h
++ modules/video_capture/windows/sink_filter_ds.cc
++ modules/video_capture/windows/sink_filter_ds.h
++ modules/video_capture/windows/video_capture_ds.cc
++ modules/video_capture/windows/video_capture_ds.h
++ modules/video_capture/windows/video_capture_factory_windows.cc
++ )
++endif()
++
+ nice_target_sources(tg_owt ${webrtc_loc}
+ PRIVATE
+ rtc_base/async_invoker.cc
+@@ -1841,28 +1863,12 @@ else()
+ endif()
+
+ set(platform_export)
+-if (NOT WIN32 AND NOT APPLE)
+- set(platform_export
+- libevent
+- )
+-elseif (APPLE)
++if (APPLE)
+ set(platform_export
+ libsdkmacos
+ )
+ endif()
+
+-set(vpx_export)
+-if (is_x86 OR is_x64)
+- set(vpx_export
+- libvpx_mmx
+- libvpx_sse2
+- libvpx_ssse3
+- libvpx_sse4
+- libvpx_avx
+- libvpx_avx2
+- )
+-endif()
+-
+ set(export_targets
+ tg_owt
+ libabsl
+@@ -1870,9 +1876,6 @@ set(export_targets
+ libpffft
+ librnnoise
+ libsrtp
+- libusrsctp
+- libvpx
+- ${vpx_export}
+ libwebrtcbuild
+ libyuv
+ ${platform_export}
diff --git a/tg_owt-git/patches/patch-cmake_external.cmake b/tg_owt-git/patches/patch-cmake_external.cmake
new file mode 100644
index 0000000000..46b8f6767f
--- /dev/null
+++ b/tg_owt-git/patches/patch-cmake_external.cmake
@@ -0,0 +1,47 @@
+$NetBSD$
+
+--- cmake/external.cmake.orig 2020-11-13 06:17:31.000000000 +0000
++++ cmake/external.cmake
+@@ -123,6 +123,42 @@ function(link_libpulse target_name)
+ endif()
+ endfunction()
+
++# usrsctp
++function(link_usrsctp target_name)
++ if (TG_OWT_PACKAGED_BUILD)
++ find_package(PkgConfig REQUIRED)
++ pkg_check_modules(USRSCTP REQUIRED usrsctp)
++ target_link_libraries(${target_name} PRIVATE ${USRSCTP_LIBRARIES})
++ endif()
++endfunction()
++
++# srtp
++set(TG_OWT_SRTP_INCLUDE_PATH "" CACHE STRING "Include path for srtp2.")
++function(link_srtp target_name)
++ if (TG_OWT_PACKAGED_BUILD)
++ find_library(SRTP NAMES srtp2)
++ target_link_libraries(${target_name} PRIVATE ${SRTP_LIBRARIES})
++ endif()
++endfunction()
++
++# libvpx
++function(link_libvpx target_name)
++ if (TG_OWT_PACKAGED_BUILD)
++ find_package(PkgConfig REQUIRED)
++ pkg_check_modules(LIBVPX REQUIRED vpx)
++ target_link_libraries(${target_name} PRIVATE ${LIBVPX_LIBRARIES})
++ endif()
++endfunction()
++
++# libevent
++function(link_libevent target_name)
++ if (TG_OWT_PACKAGED_BUILD)
++ find_package(PkgConfig REQUIRED)
++ pkg_check_modules(LIBEVENT REQUIRED libevent)
++ target_link_libraries(${target_name} PRIVATE ${LIBEVENT_LIBRARIES})
++ endif()
++endfunction()
++
+ # dl
+ function(link_dl target_name)
+ if (TG_OWT_PACKAGED_BUILD)
diff --git a/tg_owt-git/patches/patch-cmake_libwebrtcbuild.cmake b/tg_owt-git/patches/patch-cmake_libwebrtcbuild.cmake
new file mode 100644
index 0000000000..cd97f2e518
--- /dev/null
+++ b/tg_owt-git/patches/patch-cmake_libwebrtcbuild.cmake
@@ -0,0 +1,16 @@
+$NetBSD$
+
+--- cmake/libwebrtcbuild.cmake.orig 2021-02-25 16:19:56.688047871 +0000
++++ cmake/libwebrtcbuild.cmake
+@@ -34,6 +34,11 @@ elseif (APPLE)
+ WEBRTC_POSIX
+ WEBRTC_MAC
+ )
++elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|DragonFly")
++ target_compile_definitions(libwebrtcbuild
++ INTERFACE
++ WEBRTC_POSIX
++ )
+ else()
+ target_compile_definitions(libwebrtcbuild
+ INTERFACE
diff --git a/tg_owt-git/patches/patch-src_media_sctp_sctp_transport.cc b/tg_owt-git/patches/patch-src_media_sctp_sctp_transport.cc
new file mode 100644
index 0000000000..42311155a1
--- /dev/null
+++ b/tg_owt-git/patches/patch-src_media_sctp_sctp_transport.cc
@@ -0,0 +1,22 @@
+$NetBSD$
+
+--- src/media/sctp/sctp_transport.cc.orig 2020-11-13 06:17:31.000000000 +0000
++++ src/media/sctp/sctp_transport.cc
+@@ -43,7 +43,7 @@ enum PreservedErrno {
+ #include "rtc_base/thread_annotations.h"
+ #include "rtc_base/thread_checker.h"
+ #include "rtc_base/trace_event.h"
+-#include "usrsctplib/usrsctp.h"
++#include <usrsctp.h>
+
+ namespace {
+
+@@ -470,7 +470,7 @@ class SctpTransport::UsrSctpWrapper {
+ return transport;
+ }
+
+- static int SendThresholdCallback(struct socket* sock, uint32_t sb_free) {
++ static int SendThresholdCallback(struct socket* sock, uint32_t sb_free, void *ulp_info) {
+ // Fired on our I/O thread. SctpTransport::OnPacketReceived() gets
+ // a packet containing acknowledgments, which goes into usrsctp_conninput,
+ // and then back here.
diff --git a/tg_owt-git/patches/patch-src_modules_audio_device_audio_device_impl.cc b/tg_owt-git/patches/patch-src_modules_audio_device_audio_device_impl.cc
new file mode 100644
index 0000000000..045f194749
--- /dev/null
+++ b/tg_owt-git/patches/patch-src_modules_audio_device_audio_device_impl.cc
@@ -0,0 +1,14 @@
+$NetBSD$
+
+--- src/modules/audio_device/audio_device_impl.cc.orig 2021-02-26 02:58:55.001895821 +0000
++++ src/modules/audio_device/audio_device_impl.cc
+@@ -135,6 +135,9 @@ int32_t AudioDeviceModuleImpl::CheckPlat
+ #elif defined(WEBRTC_LINUX)
+ platform = kPlatformLinux;
+ RTC_LOG(INFO) << "current platform is Linux";
++#elif defined(__NetBSD__)
++ platform = kPlatformNotSupported;
++ RTC_LOG(INFO) << "current platform is NetBSD";
+ #elif defined(WEBRTC_IOS)
+ platform = kPlatformIOS;
+ RTC_LOG(INFO) << "current platform is IOS";
diff --git a/tg_owt-git/patches/patch-src_rtc_base_physical_socket_server.cc b/tg_owt-git/patches/patch-src_rtc_base_physical_socket_server.cc
new file mode 100644
index 0000000000..cce2ba34b4
--- /dev/null
+++ b/tg_owt-git/patches/patch-src_rtc_base_physical_socket_server.cc
@@ -0,0 +1,25 @@
+$NetBSD$
+
+--- src/rtc_base/physical_socket_server.cc.orig 2020-11-13 06:17:31.000000000 +0000
++++ src/rtc_base/physical_socket_server.cc
+@@ -74,7 +74,11 @@ typedef void* SockOptArg;
+
+ int64_t GetSocketRecvTimestamp(int socket) {
+ struct timeval tv_ioctl;
++#if defined(WEBRTC_LINUX)
+ int ret = ioctl(socket, SIOCGSTAMP, &tv_ioctl);
++#elif defined(__NetBSD__)
++ int ret = ioctl(socket, SO_TIMESTAMP, &tv_ioctl);
++#endif
+ if (ret != 0)
+ return -1;
+ int64_t timestamp =
+@@ -551,7 +555,7 @@ int PhysicalSocket::TranslateOption(Opti
+ *slevel = IPPROTO_IP;
+ *sopt = IP_DONTFRAGMENT;
+ break;
+-#elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__)
++#elif defined(WEBRTC_MAC) || defined(__NetBSD__) || defined(BSD) || defined(__native_client__)
+ RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported.";
+ return -1;
+ #elif defined(WEBRTC_POSIX)
diff --git a/tg_owt-git/patches/patch-src_rtc_base_platform_thread_types.h b/tg_owt-git/patches/patch-src_rtc_base_platform_thread_types.h
new file mode 100644
index 0000000000..6f7b54ffd9
--- /dev/null
+++ b/tg_owt-git/patches/patch-src_rtc_base_platform_thread_types.h
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/rtc_base/platform_thread_types.h.orig 2021-02-25 16:41:57.499459681 +0000
++++ src/rtc_base/platform_thread_types.h
+@@ -39,7 +39,7 @@ typedef DWORD PlatformThreadRef;
+ typedef zx_handle_t PlatformThreadId;
+ typedef zx_handle_t PlatformThreadRef;
+ #elif defined(WEBRTC_POSIX)
+-typedef pid_t PlatformThreadId;
++typedef long PlatformThreadId;
+ typedef pthread_t PlatformThreadRef;
+ #endif
+
diff --git a/tg_owt-git/patches/patch-src_rtc_base_task_queue_libevent.cc b/tg_owt-git/patches/patch-src_rtc_base_task_queue_libevent.cc
new file mode 100644
index 0000000000..257b411e57
--- /dev/null
+++ b/tg_owt-git/patches/patch-src_rtc_base_task_queue_libevent.cc
@@ -0,0 +1,13 @@
+$NetBSD$
+
+--- src/rtc_base/task_queue_libevent.cc.orig 2021-02-25 17:44:32.125524582 +0000
++++ 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/critical_section.h"
+ #include "rtc_base/logging.h"
Home |
Main Index |
Thread Index |
Old Index