tg_owt: add recipe

This commit is contained in:
Gerasim Troeglazov
2021-02-24 18:54:16 +10:00
parent 2c61819c7e
commit 700d78861a
2 changed files with 897 additions and 0 deletions

View File

@@ -0,0 +1,798 @@
From 77f26fbc38aec1a70ba401b3507bc15f9921ad3a Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 22 Feb 2021 20:26:03 +1000
Subject: Add Haiku support
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7a5bb2c..24db2ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -58,7 +58,7 @@ include(cmake/libusrsctp.cmake)
include(cmake/libvpx.cmake)
include(cmake/libwebrtcbuild.cmake)
include(cmake/libyuv.cmake)
-if (NOT WIN32 AND NOT APPLE)
+if (NOT WIN32 AND NOT APPLE AND NOT HAIKU)
include(cmake/libevent.cmake)
endif()
if (APPLE)
@@ -127,7 +127,7 @@ PRIVATE
${libopenh264_yasm_objects}
)
-if (NOT WIN32 AND NOT APPLE)
+if (NOT WIN32 AND NOT APPLE AND NOT HAIKU)
target_link_libraries(tg_owt PRIVATE tg_owt::libevent)
endif()
if (APPLE)
@@ -410,6 +410,8 @@ PRIVATE
rtc_base/task_queue.cc
rtc_base/task_queue_gcd.cc
rtc_base/task_queue_gcd.h
+ rtc_base/task_queue_stdlib.cc
+ rtc_base/task_queue_stdlib.h
rtc_base/task_queue_libevent.cc
rtc_base/task_queue_libevent.h
rtc_base/task_queue_win.cc
@@ -489,6 +491,7 @@ PRIVATE
api/stats_types.cc
api/task_queue/default_task_queue_factory.h
api/task_queue/default_task_queue_factory_gcd.cc
+ api/task_queue/default_task_queue_factory_stdlib.cc
api/task_queue/default_task_queue_factory_libevent.cc
api/task_queue/default_task_queue_factory_win.cc
api/task_queue/task_queue_base.cc
@@ -1410,6 +1413,8 @@ PRIVATE
modules/video_capture/device_info_impl.cc
modules/video_capture/linux/device_info_linux.cc
modules/video_capture/linux/video_capture_linux.cc
+ modules/video_capture/haiku/device_info_haiku.cc
+ modules/video_capture/haiku/video_capture_haiku.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
@@ -2105,7 +2110,7 @@ else()
)
endif()
-if (WIN32 OR APPLE)
+if (WIN32 OR APPLE OR HAIKU)
remove_target_sources(tg_owt ${webrtc_loc}
rtc_base/task_queue_libevent.cc
rtc_base/task_queue_libevent.h
@@ -2121,7 +2126,7 @@ else()
endif()
set(platform_export)
-if (NOT WIN32 AND NOT APPLE)
+if (NOT WIN32 AND NOT APPLE AND NOT HAIKU)
set(platform_export
libevent
)
diff --git a/cmake/libusrsctp.cmake b/cmake/libusrsctp.cmake
index f652679..0c00f10 100644
--- a/cmake/libusrsctp.cmake
+++ b/cmake/libusrsctp.cmake
@@ -25,6 +25,11 @@ elseif (APPLE)
PRIVATE
-U__APPLE__
)
+elseif (HAIKU)
+ target_compile_definitions(libusrsctp
+ PRIVATE
+ __Userspace_os_Haiku
+ )
else()
target_compile_definitions(libusrsctp
PRIVATE
diff --git a/cmake/libwebrtcbuild.cmake b/cmake/libwebrtcbuild.cmake
index d79049e..bad89f0 100644
--- a/cmake/libwebrtcbuild.cmake
+++ b/cmake/libwebrtcbuild.cmake
@@ -17,8 +17,8 @@ INTERFACE
WEBRTC_USE_H264
WEBRTC_LIBRARY_IMPL
WEBRTC_NON_STATIC_TRACE_EVENT_HANDLERS=1
- WEBRTC_ENABLE_LINUX_ALSA
- WEBRTC_ENABLE_LINUX_PULSE
+# WEBRTC_ENABLE_LINUX_ALSA
+# WEBRTC_ENABLE_LINUX_PULSE
HAVE_WEBRTC_VIDEO
RTC_ENABLE_VP9
)
@@ -34,6 +34,12 @@ elseif (APPLE)
WEBRTC_POSIX
WEBRTC_MAC
)
+elseif (HAIKU)
+ target_compile_definitions(libwebrtcbuild
+ INTERFACE
+ WEBRTC_POSIX
+ WEBRTC_HAIKU
+ )
else()
target_compile_definitions(libwebrtcbuild
INTERFACE
diff --git a/cmake/nice_target_sources.cmake b/cmake/nice_target_sources.cmake
index cfc6aeb..699d0e6 100644
--- a/cmake/nice_target_sources.cmake
+++ b/cmake/nice_target_sources.cmake
@@ -15,6 +15,7 @@ function(nice_target_sources target_name src_loc)
set(not_win_sources "")
set(not_mac_sources "")
set(not_linux_sources "")
+ set(not_haiku_sources "")
foreach (entry ${list})
if (${entry} STREQUAL "PRIVATE" OR ${entry} STREQUAL "PUBLIC" OR ${entry} STREQUAL "INTERFACE")
set(writing_now ${entry})
@@ -23,12 +24,19 @@ function(nice_target_sources target_name src_loc)
if (${entry} MATCHES "(^|/)win/" OR ${entry} MATCHES "(^|/)winrc/" OR ${entry} MATCHES "(^|/)windows/" OR ${entry} MATCHES "[_\\/]win\\.")
list(APPEND not_mac_sources ${full_name})
list(APPEND not_linux_sources ${full_name})
+ list(APPEND not_haiku_sources ${full_name})
elseif (${entry} MATCHES "(^|/)mac/" OR ${entry} MATCHES "(^|/)darwin/" OR ${entry} MATCHES "(^|/)osx/" OR ${entry} MATCHES "[_\\/]mac\\." OR ${entry} MATCHES "[_\\/]darwin\\." OR ${entry} MATCHES "[_\\/]osx\\.")
list(APPEND not_win_sources ${full_name})
list(APPEND not_linux_sources ${full_name})
+ list(APPEND not_haiku_sources ${full_name})
elseif (${entry} MATCHES "(^|/)linux/" OR ${entry} MATCHES "[_\\/]linux\\.")
list(APPEND not_win_sources ${full_name})
list(APPEND not_mac_sources ${full_name})
+ list(APPEND not_haiku_sources ${full_name})
+ elseif (${entry} MATCHES "(^|/)haiku/" OR ${entry} MATCHES "[_\\/]haiku\\.")
+ list(APPEND not_win_sources ${full_name})
+ list(APPEND not_mac_sources ${full_name})
+ list(APPEND not_linux_sources ${full_name})
elseif (${entry} MATCHES "(^|/)posix/" OR ${entry} MATCHES "[_\\/]posix\\.")
list(APPEND not_win_sources ${full_name})
endif()
@@ -64,6 +72,9 @@ function(nice_target_sources target_name src_loc)
elseif (APPLE)
set_source_files_properties(${not_mac_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
set_source_files_properties(${not_mac_sources} PROPERTIES SKIP_AUTOGEN TRUE)
+ elseif (HAIKU)
+ set_source_files_properties(${not_haiku_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
+ set_source_files_properties(${not_haiku_sources} PROPERTIES SKIP_AUTOGEN TRUE)
else()
set_source_files_properties(${not_linux_sources} PROPERTIES HEADER_FILE_ONLY TRUE)
set_source_files_properties(${not_linux_sources} PROPERTIES SKIP_AUTOGEN TRUE)
diff --git a/src/api/task_queue/BUILD.gn b/src/api/task_queue/BUILD.gn
index 1072057..745f5b7 100644
--- a/src/api/task_queue/BUILD.gn
+++ b/src/api/task_queue/BUILD.gn
@@ -82,7 +82,7 @@ rtc_library("default_task_queue_factory") {
sources = [ "default_task_queue_factory.h" ]
deps = [ ":task_queue" ]
- if (rtc_enable_libevent) {
+ if (rtc_enable_libevent && !is_haiku) {
sources += [ "default_task_queue_factory_libevent.cc" ]
deps += [ "../../rtc_base:rtc_task_queue_libevent" ]
} else if (is_mac || is_ios) {
diff --git a/src/modules/video_capture/haiku/device_info_haiku.cc b/src/modules/video_capture/haiku/device_info_haiku.cc
new file mode 100644
index 0000000..6f1c551
--- /dev/null
+++ b/src/modules/video_capture/haiku/device_info_haiku.cc
@@ -0,0 +1,69 @@
+#include "modules/video_capture/haiku/device_info_haiku.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+#include <vector>
+
+#include "modules/video_capture/video_capture.h"
+#include "modules/video_capture/video_capture_defines.h"
+#include "modules/video_capture/video_capture_impl.h"
+#include "rtc_base/logging.h"
+
+namespace webrtc {
+namespace videocapturemodule {
+VideoCaptureModule::DeviceInfo* VideoCaptureImpl::CreateDeviceInfo() {
+ return new videocapturemodule::DeviceInfoHaiku();
+}
+
+DeviceInfoHaiku::DeviceInfoHaiku() : DeviceInfoImpl() {}
+
+int32_t DeviceInfoHaiku::Init() {
+ return 0;
+}
+
+DeviceInfoHaiku::~DeviceInfoHaiku() {}
+
+uint32_t DeviceInfoHaiku::NumberOfDevices() {
+ return 0;
+}
+
+int32_t DeviceInfoHaiku::GetDeviceName(uint32_t deviceNumber,
+ char* deviceNameUTF8,
+ uint32_t deviceNameLength,
+ char* deviceUniqueIdUTF8,
+ uint32_t deviceUniqueIdUTF8Length,
+ char* /*productUniqueIdUTF8*/,
+ uint32_t /*productUniqueIdUTF8Length*/) {
+ return -1;
+}
+
+int32_t DeviceInfoHaiku::CreateCapabilityMap(const char* deviceUniqueIdUTF8) {
+ return -1;
+}
+
+int32_t DeviceInfoHaiku::DisplayCaptureSettingsDialogBox(
+ const char* /*deviceUniqueIdUTF8*/,
+ const char* /*dialogTitleUTF8*/,
+ void* /*parentWindow*/,
+ uint32_t /*positionX*/,
+ uint32_t /*positionY*/) {
+ return -1;
+}
+
+bool DeviceInfoHaiku::IsDeviceNameMatches(const char* name,
+ const char* deviceUniqueIdUTF8) {
+ return false;
+}
+
+int32_t DeviceInfoHaiku::FillCapabilities(int fd) {
+ return -1;
+}
+
+} // namespace videocapturemodule
+} // namespace webrtc
diff --git a/src/modules/video_capture/haiku/device_info_haiku.h b/src/modules/video_capture/haiku/device_info_haiku.h
new file mode 100644
index 0000000..96352fa
--- /dev/null
+++ b/src/modules/video_capture/haiku/device_info_haiku.h
@@ -0,0 +1,36 @@
+#ifndef MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_DEVICE_INFO_HAIKU_H_
+#define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_DEVICE_INFO_HAIKU_H_
+
+#include <stdint.h>
+
+#include "modules/video_capture/device_info_impl.h"
+
+namespace webrtc {
+namespace videocapturemodule {
+class DeviceInfoHaiku : public DeviceInfoImpl {
+ public:
+ DeviceInfoHaiku();
+ ~DeviceInfoHaiku() override;
+ uint32_t NumberOfDevices() override;
+ int32_t GetDeviceName(uint32_t deviceNumber,
+ char* deviceNameUTF8,
+ uint32_t deviceNameLength,
+ char* deviceUniqueIdUTF8,
+ uint32_t deviceUniqueIdUTF8Length,
+ char* productUniqueIdUTF8 = 0,
+ uint32_t productUniqueIdUTF8Length = 0) override;
+ int32_t CreateCapabilityMap(const char* deviceUniqueIdUTF8) override;
+ int32_t DisplayCaptureSettingsDialogBox(const char*,
+ const char*,
+ void*,
+ uint32_t,
+ uint32_t) override;
+ int32_t FillCapabilities(int fd);
+ int32_t Init() override;
+
+ private:
+ bool IsDeviceNameMatches(const char* name, const char* deviceUniqueIdUTF8);
+};
+} // namespace videocapturemodule
+} // namespace webrtc
+#endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_DEVICE_INFO_HAIKU_H_
diff --git a/src/modules/video_capture/haiku/video_capture_haiku.cc b/src/modules/video_capture/haiku/video_capture_haiku.cc
new file mode 100644
index 0000000..94a79df
--- /dev/null
+++ b/src/modules/video_capture/haiku/video_capture_haiku.cc
@@ -0,0 +1,29 @@
+#include "modules/video_capture/haiku/video_capture_haiku.h"
+
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/mman.h>
+#include <sys/select.h>
+#include <time.h>
+#include <unistd.h>
+
+#include <new>
+#include <string>
+
+#include "api/scoped_refptr.h"
+#include "media/base/video_common.h"
+#include "modules/video_capture/video_capture.h"
+#include "rtc_base/logging.h"
+#include "rtc_base/ref_counted_object.h"
+
+namespace webrtc {
+namespace videocapturemodule {
+rtc::scoped_refptr<VideoCaptureModule> VideoCaptureImpl::Create(
+ const char* deviceUniqueId) {
+ return nullptr;
+}
+} // namespace videocapturemodule
+} // namespace webrtc
diff --git a/src/modules/video_capture/haiku/video_capture_haiku.h b/src/modules/video_capture/haiku/video_capture_haiku.h
new file mode 100644
index 0000000..ac60bb0
--- /dev/null
+++ b/src/modules/video_capture/haiku/video_capture_haiku.h
@@ -0,0 +1,20 @@
+#ifndef MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_VIDEO_CAPTURE_HAIKU_H_
+#define MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_VIDEO_CAPTURE_HAIKU_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <memory>
+
+#include "modules/video_capture/video_capture_defines.h"
+#include "modules/video_capture/video_capture_impl.h"
+#include "rtc_base/platform_thread.h"
+#include "rtc_base/synchronization/mutex.h"
+
+namespace webrtc {
+namespace videocapturemodule {
+
+} // namespace videocapturemodule
+} // namespace webrtc
+
+#endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_VIDEO_CAPTURE_HAIKU_H_
diff --git a/src/rtc_base/BUILD.gn b/src/rtc_base/BUILD.gn
index c4f4d32..d5d82d1 100644
--- a/src/rtc_base/BUILD.gn
+++ b/src/rtc_base/BUILD.gn
@@ -489,7 +489,7 @@ rtc_source_set("rtc_operations_chain") {
absl_deps = [ "//third_party/abseil-cpp/absl/types:optional" ]
}
-if (rtc_enable_libevent) {
+if (rtc_enable_libevent && !is_haiku) {
rtc_library("rtc_task_queue_libevent") {
visibility = [ "../api/task_queue:default_task_queue_factory" ]
sources = [
diff --git a/src/rtc_base/ip_address.cc b/src/rtc_base/ip_address.cc
index 9dd534c..aadf0fd 100644
--- a/src/rtc_base/ip_address.cc
+++ b/src/rtc_base/ip_address.cc
@@ -11,6 +11,9 @@
#if defined(WEBRTC_POSIX)
#include <netinet/in.h>
#include <sys/socket.h>
+#if defined(WEBRTC_HAIKU)
+#include <netinet6/in6.h>
+#endif
#ifdef OPENBSD
#include <netinet/in_systm.h>
#endif
@@ -32,6 +35,15 @@
namespace rtc {
// Prefixes used for categorizing IPv6 addresses.
+#if defined(WEBRTC_HAIKU)
+static const in6_addr kV4MappedPrefix = {
+ {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0}};
+static const in6_addr k6To4Prefix = {{0x20, 0x02, 0}};
+static const in6_addr kTeredoPrefix = {{0x20, 0x01, 0x00, 0x00}};
+static const in6_addr kV4CompatibilityPrefix = {{0}};
+static const in6_addr k6BonePrefix = {{0x3f, 0xfe, 0}};
+static const in6_addr kPrivateNetworkPrefix = {{0xFD}};
+#else
static const in6_addr kV4MappedPrefix = {
{{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xFF, 0xFF, 0}}};
static const in6_addr k6To4Prefix = {{{0x20, 0x02, 0}}};
@@ -39,6 +51,7 @@ static const in6_addr kTeredoPrefix = {{{0x20, 0x01, 0x00, 0x00}}};
static const in6_addr kV4CompatibilityPrefix = {{{0}}};
static const in6_addr k6BonePrefix = {{{0x3f, 0xfe, 0}}};
static const in6_addr kPrivateNetworkPrefix = {{{0xFD}}};
+#endif
static bool IPIsHelper(const IPAddress& ip,
const in6_addr& tomatch,
diff --git a/src/rtc_base/logging.cc b/src/rtc_base/logging.cc
index 13a5f02..8362c3e 100644
--- a/src/rtc_base/logging.cc
+++ b/src/rtc_base/logging.cc
@@ -122,7 +122,11 @@ LogMessage::LogMessage(const char* file,
if (thread_) {
PlatformThreadId id = CurrentThreadId();
+#ifdef WEBRTC_HAIKU
+ print_stream_ << "[" << (uint64_t)id << "] ";
+#else
print_stream_ << "[" << id << "] ";
+#endif
}
if (file != nullptr) {
diff --git a/src/rtc_base/network.cc b/src/rtc_base/network.cc
index 07c39ae..a2c077a 100644
--- a/src/rtc_base/network.cc
+++ b/src/rtc_base/network.cc
@@ -524,7 +524,7 @@ void BasicNetworkManager::ConvertIfAddrs(struct ifaddrs* interfaces,
continue;
}
// Skip ones which are down.
- if (!(cursor->ifa_flags & IFF_RUNNING)) {
+ if (!(cursor->ifa_flags & IFF_LINK)) {
continue;
}
// Skip unknown family.
diff --git a/src/rtc_base/physical_socket_server.cc b/src/rtc_base/physical_socket_server.cc
index 3cb7c20..ee1b674 100644
--- a/src/rtc_base/physical_socket_server.cc
+++ b/src/rtc_base/physical_socket_server.cc
@@ -69,7 +69,7 @@ typedef void* SockOptArg;
#endif // WEBRTC_POSIX
-#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(__native_client__)
+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_MAC) && !defined(WEBRTC_HAIKU) && !defined(__native_client__)
int64_t GetSocketRecvTimestamp(int socket) {
struct timeval tv_ioctl;
@@ -332,7 +332,7 @@ int PhysicalSocket::SetOption(Option opt, int value) {
value <<= 2;
#endif
}
-#if defined(WEBRTC_POSIX)
+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_HAIKU)
if (sopt == IPV6_TCLASS) {
// Set the IPv4 option in all cases to support dual-stack sockets.
// Don't bother checking the return code, as this is expected to fail if
@@ -574,7 +574,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) {
#elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__)
RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported.";
return -1;
-#elif defined(WEBRTC_POSIX)
+#elif defined(WEBRTC_POSIX) && !defined(WEBRTC_HAIKU)
*slevel = IPPROTO_IP;
*sopt = IP_MTU_DISCOVER;
break;
@@ -592,7 +592,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* slevel, int* sopt) {
*sopt = TCP_NODELAY;
break;
case OPT_DSCP:
-#if defined(WEBRTC_POSIX)
+#if defined(WEBRTC_POSIX) && !defined(WEBRTC_HAIKU)
if (family_ == AF_INET6) {
*slevel = IPPROTO_IPV6;
*sopt = IPV6_TCLASS;
diff --git a/src/rtc_base/platform_thread_types.h b/src/rtc_base/platform_thread_types.h
index 6b9101e..0ae52e5 100644
--- a/src/rtc_base/platform_thread_types.h
+++ b/src/rtc_base/platform_thread_types.h
@@ -38,6 +38,9 @@ typedef DWORD PlatformThreadRef;
#elif defined(WEBRTC_FUCHSIA)
typedef zx_handle_t PlatformThreadId;
typedef zx_handle_t PlatformThreadRef;
+#elif defined(WEBRTC_HAIKU)
+typedef pthread_t PlatformThreadId;
+typedef pthread_t PlatformThreadRef;
#elif defined(WEBRTC_POSIX)
typedef pid_t PlatformThreadId;
typedef pthread_t PlatformThreadRef;
diff --git a/src/rtc_base/system/rtc_export.h b/src/rtc_base/system/rtc_export.h
index d1eb60a..9dc761d 100644
--- a/src/rtc_base/system/rtc_export.h
+++ b/src/rtc_base/system/rtc_export.h
@@ -28,7 +28,7 @@
#else // WEBRTC_WIN
-#if __has_attribute(visibility) && defined(WEBRTC_LIBRARY_IMPL)
+#if defined(WEBRTC_LIBRARY_IMPL)
#define RTC_EXPORT __attribute__((visibility("default")))
#endif
diff --git a/src/rtc_base/system/rtc_export_template.h b/src/rtc_base/system/rtc_export_template.h
index 4ac7043..5fe950f 100644
--- a/src/rtc_base/system/rtc_export_template.h
+++ b/src/rtc_base/system/rtc_export_template.h
@@ -185,7 +185,7 @@
RTC_EXPORT_TEMPLATE_TEST(DEFAULT, ); // NOLINT
RTC_EXPORT_TEMPLATE_TEST(DEFAULT, __attribute__((visibility("default"))));
-RTC_EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport));
+//RTC_EXPORT_TEMPLATE_TEST(MSVC_HACK, __declspec(dllexport));
RTC_EXPORT_TEMPLATE_TEST(DEFAULT, __declspec(dllimport));
#undef RTC_EXPORT_TEMPLATE_TEST
diff --git a/src/third_party/abseil-cpp/absl/base/options.h b/src/third_party/abseil-cpp/absl/base/options.h
index 230bf1e..6e1b9e5 100644
--- a/src/third_party/abseil-cpp/absl/base/options.h
+++ b/src/third_party/abseil-cpp/absl/base/options.h
@@ -100,7 +100,7 @@
// User code should not inspect this macro. To check in the preprocessor if
// absl::any is a typedef of std::any, use the feature macro ABSL_USES_STD_ANY.
-#define ABSL_OPTION_USE_STD_ANY 2
+#define ABSL_OPTION_USE_STD_ANY 0
// ABSL_OPTION_USE_STD_OPTIONAL
@@ -127,7 +127,7 @@
// absl::optional is a typedef of std::optional, use the feature macro
// ABSL_USES_STD_OPTIONAL.
-#define ABSL_OPTION_USE_STD_OPTIONAL 2
+#define ABSL_OPTION_USE_STD_OPTIONAL 0
// ABSL_OPTION_USE_STD_STRING_VIEW
@@ -154,7 +154,7 @@
// absl::string_view is a typedef of std::string_view, use the feature macro
// ABSL_USES_STD_STRING_VIEW.
-#define ABSL_OPTION_USE_STD_STRING_VIEW 2
+#define ABSL_OPTION_USE_STD_STRING_VIEW 0
// ABSL_OPTION_USE_STD_VARIANT
//
@@ -180,7 +180,7 @@
// absl::variant is a typedef of std::variant, use the feature macro
// ABSL_USES_STD_VARIANT.
-#define ABSL_OPTION_USE_STD_VARIANT 2
+#define ABSL_OPTION_USE_STD_VARIANT 0
// ABSL_OPTION_USE_INLINE_NAMESPACE
diff --git a/src/third_party/abseil-cpp/absl/strings/match.cc b/src/third_party/abseil-cpp/absl/strings/match.cc
index 8127cb0..40a23b6 100644
--- a/src/third_party/abseil-cpp/absl/strings/match.cc
+++ b/src/third_party/abseil-cpp/absl/strings/match.cc
@@ -19,22 +19,5 @@
namespace absl {
ABSL_NAMESPACE_BEGIN
-bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) {
- return (piece1.size() == piece2.size() &&
- 0 == absl::strings_internal::memcasecmp(piece1.data(), piece2.data(),
- piece1.size()));
- // memcasecmp uses absl::ascii_tolower().
-}
-
-bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix) {
- return (text.size() >= prefix.size()) &&
- EqualsIgnoreCase(text.substr(0, prefix.size()), prefix);
-}
-
-bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix) {
- return (text.size() >= suffix.size()) &&
- EqualsIgnoreCase(text.substr(text.size() - suffix.size()), suffix);
-}
-
ABSL_NAMESPACE_END
} // namespace absl
diff --git a/src/third_party/abseil-cpp/absl/strings/match.h b/src/third_party/abseil-cpp/absl/strings/match.h
index 90fca98..53ada13 100644
--- a/src/third_party/abseil-cpp/absl/strings/match.h
+++ b/src/third_party/abseil-cpp/absl/strings/match.h
@@ -35,7 +35,9 @@
#include <cstring>
+#include "absl/strings/match.h"
#include "absl/strings/string_view.h"
+#include "absl/strings/internal/memutil.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
@@ -70,19 +72,30 @@ inline bool EndsWith(absl::string_view text, absl::string_view suffix) {
//
// Returns whether given ASCII strings `piece1` and `piece2` are equal, ignoring
// case in the comparison.
-bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2);
+inline bool EqualsIgnoreCase(absl::string_view piece1, absl::string_view piece2) {
+ return (piece1.size() == piece2.size() &&
+ 0 == absl::strings_internal::memcasecmp(piece1.data(), piece2.data(),
+ piece1.size()));
+ // memcasecmp uses absl::ascii_tolower().
+}
// StartsWithIgnoreCase()
//
// Returns whether a given ASCII string `text` starts with `prefix`,
// ignoring case in the comparison.
-bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix);
+inline bool StartsWithIgnoreCase(absl::string_view text, absl::string_view prefix) {
+ return (text.size() >= prefix.size()) &&
+ EqualsIgnoreCase(text.substr(0, prefix.size()), prefix);
+}
// EndsWithIgnoreCase()
//
// Returns whether a given ASCII string `text` ends with `suffix`, ignoring
// case in the comparison.
-bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix);
+inline bool EndsWithIgnoreCase(absl::string_view text, absl::string_view suffix) {
+ return (text.size() >= suffix.size()) &&
+ EqualsIgnoreCase(text.substr(text.size() - suffix.size()), suffix);
+}
ABSL_NAMESPACE_END
} // namespace absl
diff --git a/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp b/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp
index 8aa67f1..5c2b6e1 100644
--- a/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp
+++ b/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp
@@ -48,7 +48,7 @@
#include <sys/types.h>
#include <sys/param.h>
#include <unistd.h>
-#ifndef __Fuchsia__
+#if !defined(__Fuchsia__) && !defined(__HAIKU__)
#include <sys/sysctl.h>
#endif
#ifdef __APPLE__
@@ -244,7 +244,7 @@ WELS_THREAD_ERROR_CODE WelsThreadCreate (WELS_THREAD_HANDLE* thread, LPWELS_
err = pthread_attr_init (&at);
if (err)
return err;
-#if !defined(__ANDROID__) && !defined(__Fuchsia__)
+#if !defined(__ANDROID__) && !defined(__Fuchsia__) && !defined(__HAIKU__)
err = pthread_attr_setscope (&at, PTHREAD_SCOPE_SYSTEM);
if (err)
return err;
@@ -517,6 +517,10 @@ WELS_THREAD_ERROR_CODE WelsQueryLogicalProcessInfo (WelsLogicalProcessInfo* p
return WELS_THREAD_ERROR_OK;
+#elif defined(__HAIKU__)
+ pInfo->ProcessorCount = 1;
+ return WELS_THREAD_ERROR_OK;
+
#elif defined(__EMSCRIPTEN__)
// There is not yet a way to determine CPU count in emscripten JS environment.
diff --git a/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h b/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h
index 9847624..82409dd 100644
--- a/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h
+++ b/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h
@@ -40,7 +40,7 @@ __FBSDID("$FreeBSD: head/sys/netinet/sctp.h 356357 2020-01-04 20:33:12Z tuexen $
#ifndef _NETINET_SCTP_H_
#define _NETINET_SCTP_H_
-#if (defined(__APPLE__) || defined(__Userspace_os_Linux) || defined(__Userspace_os_Darwin))
+#if (defined(__APPLE__) || defined(__Userspace_os_Linux) || defined(__Userspace_os_Darwin) || defined(__Userspace_os_Haiku))
#include <stdint.h>
#endif
diff --git a/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c b/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c
index 5afe781..e1d99a7 100644
--- a/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c
+++ b/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c
@@ -6304,7 +6304,7 @@ sctp_input(i_pak, va_alist)
#if defined(__Windows__)
NTOHS(ip->ip_len);
#endif
-#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows)
+#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Haiku)
ip->ip_len = ntohs(ip->ip_len);
#endif
#if defined(__FreeBSD__)
@@ -6316,7 +6316,7 @@ sctp_input(i_pak, va_alist)
#elif defined(__APPLE__)
length = ip->ip_len + iphlen;
#elif defined(__Userspace__)
-#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows)
+#if defined(__Userspace_os_Linux) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Haiku)
length = ip->ip_len;
#else
length = ip->ip_len + iphlen;
diff --git a/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h b/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h
index f09cb8d..c26fad1 100644
--- a/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h
+++ b/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h
@@ -277,7 +277,7 @@ typedef char* caddr_t;
#else /* !defined(Userspace_os_Windows) */
#include <sys/socket.h>
-#if defined(__Userspace_os_DragonFly) || defined(__Userspace_os_FreeBSD) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_OpenBSD) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_Fuchsia)
+#if defined(__Userspace_os_DragonFly) || defined(__Userspace_os_FreeBSD) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_OpenBSD) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_Fuchsia) || defined(__Userspace_os_Haiku)
#include <pthread.h>
#endif
typedef pthread_mutex_t userland_mutex_t;
@@ -1155,7 +1155,7 @@ sctp_get_mbuf_for_msg(unsigned int space_needed, int want_header, int how, int a
#define SCTP_IS_LISTENING(inp) ((inp->sctp_flags & SCTP_PCB_FLAGS_ACCEPTING) != 0)
-#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia)
+#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia) || defined(__Userspace_os_Haiku)
int
timingsafe_bcmp(const void *, const void *, size_t);
#endif
diff --git a/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c b/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c
index 28922b6..dba15fd 100644
--- a/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c
+++ b/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c
@@ -94,7 +94,7 @@ sctp_userspace_set_threadname(const char *name)
#endif
}
-#if !defined(_WIN32) && !defined(__Userspace_os_NaCl)
+#if !defined(_WIN32) && !defined(__Userspace_os_NaCl) && !defined(__Userspace_os_Haiku)
int
sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af)
{
@@ -118,7 +118,7 @@ sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af)
}
#endif
-#if defined(__Userspace_os_NaCl)
+#if defined(__Userspace_os_NaCl) || defined(__Userspace_os_Haiku)
int
sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af)
{
@@ -126,7 +126,7 @@ sctp_userspace_get_mtu_from_ifn(uint32_t if_index, int af)
}
#endif
-#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia)
+#if defined(__Userspace_os_Darwin) || defined(__Userspace_os_DragonFly) || defined(__Userspace_os_Linux) || defined(__Userspace_os_NaCl) || defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Windows) || defined(__Userspace_os_Fuchsia) || defined(__Userspace_os_Haiku)
int
timingsafe_bcmp(const void *b1, const void *b2, size_t n)
{
diff --git a/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c b/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c
index 146a6d9..63a6240 100644
--- a/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c
+++ b/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c
@@ -50,6 +50,9 @@
#if defined(__Userspace_os_Linux)
#define __FAVOR_BSD /* (on Ubuntu at least) enables UDP header field names like BSD in RFC 768 */
#endif
+#if defined(__Userspace_os_Haiku)
+#define UIO_MAXIOV _SC_IOV_MAX
+#endif
#if !defined (__Userspace_os_Windows)
#if defined INET || defined INET6
#include <netinet/udp.h>
@@ -1068,7 +1071,7 @@ userspace_sctp_recvmsg(struct socket *so,
if (error) {
if ((auio.uio_resid != ulen) &&
(error == EINTR ||
-#if !defined(__Userspace_os_NetBSD)
+#if !defined(__Userspace_os_NetBSD) && !defined(__Userspace_os_Haiku)
error == ERESTART ||
#endif
error == EWOULDBLOCK)) {
@@ -1161,7 +1164,7 @@ usrsctp_recvv(struct socket *so,
if (errno) {
if ((auio.uio_resid != ulen) &&
(errno == EINTR ||
-#if !defined(__Userspace_os_NetBSD)
+#if !defined(__Userspace_os_NetBSD) && !defined(__Userspace_os_Haiku)
errno == ERESTART ||
#endif
errno == EWOULDBLOCK)) {
@@ -2117,7 +2120,7 @@ int user_connect(struct socket *so, struct sockaddr *sa)
error = pthread_cond_wait(SOCK_COND(so), SOCK_MTX(so));
#endif
if (error) {
-#if defined(__Userspace_os_NetBSD)
+#if defined(__Userspace_os_NetBSD) || defined(__Userspace_os_Haiku)
if (error == EINTR) {
#else
if (error == EINTR || error == ERESTART) {
@@ -2137,7 +2140,7 @@ bad:
if (!interrupted) {
so->so_state &= ~SS_ISCONNECTING;
}
-#if !defined(__Userspace_os_NetBSD)
+#if !defined(__Userspace_os_NetBSD) && !defined(__Userspace_os_Haiku)
if (error == ERESTART) {
error = EINTR;
}
--
2.30.0

View File

@@ -0,0 +1,99 @@
SUMMARY="WebRTC build for Telegram"
DESCRIPTION="Telegram Desktop's fork of Google's WebRTC."
HOMEPAGE="https://github.com/desktop-app/tg_owt"
COPYRIGHT="2013-2021 Telegram"
LICENSE="BSD (3-clause)"
REVISION="1"
srcGitRev="be23804afce3bb2e80a1d57a7c1318c71b82b7de"
SOURCE_URI="https://github.com/desktop-app/tg_owt/archive/$srcGitRev.tar.gz"
SOURCE_DIR="tg_owt-$srcGitRev"
CHECKSUM_SHA256="b0bcf4f982fe955d41d30c2d2ccab65a9f7fc587dc334c03219aba0c4dd3d13e"
SOURCE_FILENAME="tg_owt-$srcGitRev.tar.gz"
srcGitRev_2="ebb5ffc1d462c70dfb2283a5c7afcb75288c7692"
SOURCE_URI_2="https://github.com/webmproject/libvpx/archive/$srcGitRev_2.tar.gz"
CHECKSUM_SHA256_2="a7adf6a905fe7e51caf45ef16c2c4b80fff253db08d49633a045310e0fd3793c"
SOURCE_FILENAME_2="libvpx-$srcGitRev_2.tar.gz"
srcGitRev_3="19d71f6b351fe992ae34b114eebd872c383a6bdb"
SOURCE_URI_3="https://github.com/lemenkov/libyuv/archive/$srcGitRev_3.tar.gz"
CHECKSUM_SHA256_3="64a277a20a85f38ac963a9434ec7faa261bf66d2f9268c24461476c8b3d9b39f"
SOURCE_FILENAME_3="libyuv-$srcGitRev_3.tar.gz"
PATCHES="tg_owt-$portVersion.patchset"
ARCHITECTURES="!x86_gcc2 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
tg_owt$secondaryArchSuffix = $portVersion
devel:libtg_owt$secondaryArchSuffix = 0.0.0 compat >= 0
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libavcodec$secondaryArchSuffix
lib:libavformat$secondaryArchSuffix
lib:libavutil$secondaryArchSuffix
lib:libcrypto$secondaryArchSuffix
lib:libjpeg$secondaryArchSuffix
lib:libopus$secondaryArchSuffix
lib:libprotobuf$secondaryArchSuffix
lib:libswresample$secondaryArchSuffix
lib:libswscale$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
devel:libavcodec$secondaryArchSuffix
devel:libavformat$secondaryArchSuffix
devel:libavutil$secondaryArchSuffix
devel:libcrypto$secondaryArchSuffix
devel:libjpeg$secondaryArchSuffix
devel:libopus$secondaryArchSuffix
devel:libprotobuf$secondaryArchSuffix
devel:libswresample$secondaryArchSuffix
devel:libswscale$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
cmd:cmake
cmd:gcc$secondaryArchSuffix
cmd:make
cmd:pkg_config$secondaryArchSuffix
cmd:python
cmd:sed
cmd:yasm
"
BUILD()
{
export DISABLE_ASLR=1
rm -rf $sourceDir/src/third_party/libvpx/source/libvpx
cp -r $sourceDir2/libvpx-$srcGitRev_2 $sourceDir/src/third_party/libvpx/source/libvpx
rm -rf $sourceDir/src/third_party/libyuv
cp -r $sourceDir3/libyuv-$srcGitRev_3 $sourceDir/src/third_party/libyuv
mkdir -p build
cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_LIBDIR=$developLibDir \
-DCMAKE_INSTALL_INCLUDEDIR=$includeDir \
-DBUILD_SHARED_LIBS=FALSE \
-DTG_OWT_PACKAGED_BUILD=TRUE \
-DTG_OWT_SPECIAL_TARGET=haiku \
-DTG_OWT_USE_PROTOBUF=FALSE \
-DTG_OWT_LIBJPEG_INCLUDE_PATH=/system/$relativeIncludeDir \
-DTG_OWT_OPENSSL_INCLUDE_PATH=/system/$relativeIncludeDir \
-DTG_OWT_OPUS_INCLUDE_PATH=/system/$relativeIncludeDir/opus \
-DTG_OWT_FFMPEG_INCLUDE_PATH=/system/$relativeIncludeDir
make $jobArgs
}
INSTALL()
{
cd build
make install
mkdir -p $libDir
mv $developLibDir/cmake $libDir
}