diff --git a/net-im/telegram-desktop/patches/telegram_desktop-2.3.0-defaults.patchset b/net-im/telegram-desktop/patches/telegram_desktop-2.3.0-defaults.patchset deleted file mode 100644 index e26785c77..000000000 --- a/net-im/telegram-desktop/patches/telegram_desktop-2.3.0-defaults.patchset +++ /dev/null @@ -1,32 +0,0 @@ -From f6179d9774a361a5440ae7d63e556a1d2aeeae7c Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Wed, 29 Jul 2020 10:53:43 +1000 -Subject: Use native window frame & native notifications by default - - -diff --git a/Telegram/SourceFiles/core/core_settings.h b/Telegram/SourceFiles/core/core_settings.h -index 95d9b59..e6cba65 100644 ---- a/Telegram/SourceFiles/core/core_settings.h -+++ b/Telegram/SourceFiles/core/core_settings.h -@@ -482,7 +482,7 @@ private: - bool _desktopNotify = true; - bool _flashBounceNotify = true; - DBINotifyView _notifyView = dbinvShowPreview; -- bool _nativeNotifications = false; -+ bool _nativeNotifications = true; - int _notificationsCount = 3; - ScreenCorner _notificationsCorner = ScreenCorner::BottomRight; - bool _includeMutedCounter = true; -@@ -520,7 +520,7 @@ private: - rpl::variable _dialogsWidthRatio; // per-window - rpl::variable _thirdColumnWidth = kDefaultThirdColumnWidth; // p-w - bool _notifyFromAll = true; -- rpl::variable _nativeWindowFrame = false; -+ rpl::variable _nativeWindowFrame = true; - rpl::variable> _systemDarkMode = std::nullopt; - rpl::variable _systemDarkModeEnabled = false; - rpl::variable _windowControlsLayout; --- -2.28.0 - - diff --git a/net-im/telegram-desktop/patches/telegram_desktop-2.3.2-owt.patchset b/net-im/telegram-desktop/patches/telegram_desktop-2.3.2-owt.patchset new file mode 100644 index 000000000..298c6020a --- /dev/null +++ b/net-im/telegram-desktop/patches/telegram_desktop-2.3.2-owt.patchset @@ -0,0 +1,789 @@ +From ad6dad2305aa619f65151a00be75813305ced1c3 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Tue, 25 Aug 2020 09:18:26 +1000 +Subject: Fix for Haiku + + +diff --git a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/CMakeLists.txt b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/CMakeLists.txt +index cbd13ff..587ffd7 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/CMakeLists.txt ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/CMakeLists.txt +@@ -42,7 +42,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) +@@ -77,7 +77,7 @@ PUBLIC + ${libopenh264_yasm_objects} + ) + +-if (NOT WIN32 AND NOT APPLE) ++if (NOT WIN32 AND NOT APPLE AND NOT HAIKU) + target_link_libraries(tg_owt PUBLIC tg_owt::libevent) + endif() + if (APPLE) +@@ -313,6 +313,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 +@@ -388,6 +390,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 +@@ -1238,6 +1241,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 +@@ -1722,7 +1727,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 +diff --git a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/cmake/libusrsctp.cmake b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/cmake/libusrsctp.cmake +index caa0529..1bb82e9 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/cmake/libusrsctp.cmake ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/cmake/libwebrtcbuild.cmake b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/cmake/libwebrtcbuild.cmake +index c3520b8..9c0d9c2 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/cmake/libwebrtcbuild.cmake ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/cmake/nice_target_sources.cmake b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/cmake/nice_target_sources.cmake +index cfc6aeb..699d0e6 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/cmake/nice_target_sources.cmake ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/api/task_queue/BUILD.gn b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/api/task_queue/BUILD.gn +index 4c9f591..e93c715 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/api/task_queue/BUILD.gn ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/api/task_queue/BUILD.gn +@@ -76,7 +76,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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/modules/video_capture/haiku/device_info_haiku.cc b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/modules/video_capture/haiku/device_info_haiku.cc +new file mode 100644 +index 0000000..6f1c551 +--- /dev/null ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/modules/video_capture/haiku/device_info_haiku.cc +@@ -0,0 +1,69 @@ ++#include "modules/video_capture/haiku/device_info_haiku.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++ ++#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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/modules/video_capture/haiku/device_info_haiku.h b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/modules/video_capture/haiku/device_info_haiku.h +new file mode 100644 +index 0000000..96352fa +--- /dev/null ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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 ++ ++#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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/modules/video_capture/haiku/video_capture_haiku.cc b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/modules/video_capture/haiku/video_capture_haiku.cc +new file mode 100644 +index 0000000..94a79df +--- /dev/null ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/modules/video_capture/haiku/video_capture_haiku.cc +@@ -0,0 +1,29 @@ ++#include "modules/video_capture/haiku/video_capture_haiku.h" ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#include ++#include ++ ++#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 VideoCaptureImpl::Create( ++ const char* deviceUniqueId) { ++ return nullptr; ++} ++} // namespace videocapturemodule ++} // namespace webrtc +diff --git a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/modules/video_capture/haiku/video_capture_haiku.h b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/modules/video_capture/haiku/video_capture_haiku.h +new file mode 100644 +index 0000000..55a27fc +--- /dev/null ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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 ++#include ++ ++#include ++ ++#include "modules/video_capture/video_capture_defines.h" ++#include "modules/video_capture/video_capture_impl.h" ++#include "rtc_base/critical_section.h" ++#include "rtc_base/platform_thread.h" ++ ++namespace webrtc { ++namespace videocapturemodule { ++ ++} // namespace videocapturemodule ++} // namespace webrtc ++ ++#endif // MODULES_VIDEO_CAPTURE_MAIN_SOURCE_HAIKU_VIDEO_CAPTURE_HAIKU_H_ +diff --git a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/BUILD.gn b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/BUILD.gn +index d078482..fe48338 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/BUILD.gn ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/BUILD.gn +@@ -450,7 +450,7 @@ rtc_source_set("rtc_operations_chain") { + ] + } + +-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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/ip_address.cc b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/ip_address.cc +index 9dd534c..aadf0fd 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/ip_address.cc ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/ip_address.cc +@@ -11,6 +11,9 @@ + #if defined(WEBRTC_POSIX) + #include + #include ++#if defined(WEBRTC_HAIKU) ++#include ++#endif + #ifdef OPENBSD + #include + #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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/logging.cc b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/logging.cc +index ff7369d..1208f3e 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/logging.cc ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/logging.cc +@@ -114,7 +114,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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/network.cc b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/network.cc +index ffa8f94..29b50ab 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/network.cc ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/network.cc +@@ -483,7 +483,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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/physical_socket_server.cc b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/physical_socket_server.cc +index 0cbcb81..c0347f1 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/physical_socket_server.cc ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/physical_socket_server.cc +@@ -70,7 +70,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; +@@ -319,7 +319,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. + ::setsockopt(s_, IPPROTO_IP, IP_TOS, (SockOptArg)&value, sizeof(value)); +@@ -554,7 +554,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; +@@ -572,7 +572,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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/platform_thread_types.h b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/platform_thread_types.h +index 6b9101e..0ae52e5 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/platform_thread_types.h ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/system/rtc_export.h b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/system/rtc_export.h +index d1eb60a..9dc761d 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/system/rtc_export.h ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/system/rtc_export_template.h b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/system/rtc_export_template.h +index 4ac7043..5fe950f 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/rtc_base/system/rtc_export_template.h ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/abseil-cpp/absl/base/options.h b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/abseil-cpp/absl/base/options.h +index 230bf1e..6e1b9e5 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/abseil-cpp/absl/base/options.h ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/abseil-cpp/absl/strings/match.cc b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/abseil-cpp/absl/strings/match.cc +index 8127cb0..40a23b6 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/abseil-cpp/absl/strings/match.cc ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/abseil-cpp/absl/strings/match.h b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/abseil-cpp/absl/strings/match.h +index 90fca98..53ada13 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/abseil-cpp/absl/strings/match.h ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/abseil-cpp/absl/strings/match.h +@@ -35,7 +35,9 @@ + + #include + ++#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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp +index 8aa67f1..5c2b6e1 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/openh264/src/codec/common/src/WelsThreadLib.cpp +@@ -48,7 +48,7 @@ + #include + #include + #include +-#ifndef __Fuchsia__ ++#if !defined(__Fuchsia__) && !defined(__HAIKU__) + #include + #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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h +index 9847624..82409dd 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp.h ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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 + #endif + +diff --git a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c +index 5afe781..e1d99a7 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_input.c ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h +index f09cb8d..c26fad1 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_os_userspace.h ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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 +-#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 + #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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c +index 28922b6..dba15fd 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/netinet/sctp_userspace.c ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c +index 146a6d9..63a6240 100644 +--- a/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/src/third_party/usrsctp/usrsctplib/usrsctplib/user_socket.c ++++ b/tg_owt-102b5e7eb15af02531f6ae07eb6ba935a8e0a348/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 +@@ -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.28.0 + diff --git a/net-im/telegram-desktop/patches/telegram_desktop-2.3.0.patchset b/net-im/telegram-desktop/patches/telegram_desktop-2.3.2.patchset similarity index 97% rename from net-im/telegram-desktop/patches/telegram_desktop-2.3.0.patchset rename to net-im/telegram-desktop/patches/telegram_desktop-2.3.2.patchset index 79bc5d85b..f1da20bda 100644 --- a/net-im/telegram-desktop/patches/telegram_desktop-2.3.0.patchset +++ b/net-im/telegram-desktop/patches/telegram_desktop-2.3.2.patchset @@ -1,14 +1,14 @@ -From 240c2208e5835152fcbbc36721713227f84d0219 Mon Sep 17 00:00:00 2001 +From 6f8c054743e72fabdec1a4533ca1eccdde6bd03d Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Sun, 16 Aug 2020 16:01:45 +1000 +Date: Tue, 25 Aug 2020 09:16:39 +1000 Subject: Add Haiku support diff --git a/Telegram/CMakeLists.txt b/Telegram/CMakeLists.txt -index b0e6dc4..b808b2a 100644 +index 600e38a..91398c1 100644 --- a/Telegram/CMakeLists.txt +++ b/Telegram/CMakeLists.txt -@@ -930,6 +930,16 @@ PRIVATE +@@ -931,6 +931,16 @@ PRIVATE platform/win/windows_event_filter.cpp platform/win/windows_event_filter.h platform/win/wrapper_wrl_implements_h.h @@ -25,7 +25,7 @@ index b0e6dc4..b808b2a 100644 platform/platform_audio.h platform/platform_file_utilities.h platform/platform_launcher.h -@@ -1143,7 +1153,7 @@ PRIVATE +@@ -1144,7 +1154,7 @@ PRIVATE settings.h ) @@ -34,6 +34,28 @@ index b0e6dc4..b808b2a 100644 remove_target_sources(Telegram ${src_loc} window/window_title_qt.cpp window/window_title_qt.h +diff --git a/Telegram/SourceFiles/core/core_settings.h b/Telegram/SourceFiles/core/core_settings.h +index a774db0..f0e38d2 100644 +--- a/Telegram/SourceFiles/core/core_settings.h ++++ b/Telegram/SourceFiles/core/core_settings.h +@@ -494,7 +494,7 @@ private: + bool _desktopNotify = true; + bool _flashBounceNotify = true; + DBINotifyView _notifyView = dbinvShowPreview; +- bool _nativeNotifications = false; ++ bool _nativeNotifications = true; + int _notificationsCount = 3; + ScreenCorner _notificationsCorner = ScreenCorner::BottomRight; + bool _includeMutedCounter = true; +@@ -533,7 +533,7 @@ private: + rpl::variable _dialogsWidthRatio; // per-window + rpl::variable _thirdColumnWidth = kDefaultThirdColumnWidth; // p-w + bool _notifyFromAll = true; +- rpl::variable _nativeWindowFrame = false; ++ rpl::variable _nativeWindowFrame = true; + rpl::variable> _systemDarkMode = std::nullopt; + rpl::variable _systemDarkModeEnabled = false; + rpl::variable _windowControlsLayout; diff --git a/Telegram/SourceFiles/core/launcher.cpp b/Telegram/SourceFiles/core/launcher.cpp index 46066bf..1dd944e 100644 --- a/Telegram/SourceFiles/core/launcher.cpp @@ -864,10 +886,10 @@ index 0000000..34b6aaf +} // namespace Platform diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp new file mode 100644 -index 0000000..d168dfb +index 0000000..fefc57d --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.cpp -@@ -0,0 +1,243 @@ +@@ -0,0 +1,247 @@ +/* +This file is part of Telegram Desktop for Haiku, + @@ -920,6 +942,10 @@ index 0000000..d168dfb + return true; +} + ++bool SetWindowExtents(QWindow *window, const QMargins &extents) { ++ return false; ++} ++ +std::optional IsDarkMode() { + return std::nullopt; +} @@ -1113,10 +1139,10 @@ index 0000000..d168dfb +} diff --git a/Telegram/SourceFiles/platform/haiku/specific_haiku.h b/Telegram/SourceFiles/platform/haiku/specific_haiku.h new file mode 100644 -index 0000000..3e04f46 +index 0000000..266e56d --- /dev/null +++ b/Telegram/SourceFiles/platform/haiku/specific_haiku.h -@@ -0,0 +1,113 @@ +@@ -0,0 +1,117 @@ +/* +This file is part of Telegram Desktop for Haiku, + @@ -1168,6 +1194,10 @@ index 0000000..3e04f46 + return false; +} + ++inline bool WindowsNeedShadow() { ++ return false; ++} ++ +} // namespace Platform + +inline void psCheckLocalSocket(const QString &serverName) { @@ -1295,24 +1325,6 @@ index ec419ba..14f99ee 100644 #elif defined Q_OS_UNIX // Q_OS_MAC #include "platform/linux/specific_linux.h" #elif defined Q_OS_WIN // Q_OS_MAC || Q_OS_UNIX -diff --git a/Telegram/SourceFiles/settings/settings_calls.cpp b/Telegram/SourceFiles/settings/settings_calls.cpp -index 01b1bf5..23faa9f 100644 ---- a/Telegram/SourceFiles/settings/settings_calls.cpp -+++ b/Telegram/SourceFiles/settings/settings_calls.cpp -@@ -33,6 +33,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL - #define NEED_TO_RESTORE_SLOTS - #endif // slots - -+// Don't include SupportDefs.h -+#ifdef __HAIKU__ -+#define _SUPPORT_DEFS_H -+typedef int32 status_t; -+typedef uint32 type_code; -+#endif -+ - #include - - #ifdef NEED_TO_RESTORE_SLOTS diff --git a/Telegram/SourceFiles/settings/settings_notifications.cpp b/Telegram/SourceFiles/settings/settings_notifications.cpp index 19ce0db..7597438 100644 --- a/Telegram/SourceFiles/settings/settings_notifications.cpp @@ -1340,7 +1352,7 @@ index e567d93..34162a6 100644 #endif return result; diff --git a/Telegram/ThirdParty/libtgvoip/VoIPController.cpp b/Telegram/ThirdParty/libtgvoip/VoIPController.cpp -index 4f5a13e..2dea04f 100644 +index d0b0038..c2c258b 100644 --- a/Telegram/ThirdParty/libtgvoip/VoIPController.cpp +++ b/Telegram/ThirdParty/libtgvoip/VoIPController.cpp @@ -8,6 +8,9 @@ @@ -2191,7 +2203,7 @@ diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_file.h b old mode 100755 new mode 100644 diff --git a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc -index 70cf237..e48948e 100644 +index cf7d478..f27b9a1 100644 --- a/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc +++ b/Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/platform_thread_types.cc @@ -20,6 +20,8 @@ namespace rtc { @@ -2218,10 +2230,10 @@ index 0bc42eb..c87cde9 100644 typedef pid_t PlatformThreadId; typedef pthread_t PlatformThreadRef; diff --git a/Telegram/cmake/lib_tgcalls.cmake b/Telegram/cmake/lib_tgcalls.cmake -index 1928ef5..fe91855 100644 +index b4841e6..354ce2c 100644 --- a/Telegram/cmake/lib_tgcalls.cmake +++ b/Telegram/cmake/lib_tgcalls.cmake -@@ -127,6 +127,11 @@ if (WIN32) +@@ -129,6 +129,11 @@ if (WIN32) PRIVATE WEBRTC_WIN ) @@ -2234,10 +2246,10 @@ index 1928ef5..fe91855 100644 target_compile_options(lib_tgcalls PRIVATE diff --git a/Telegram/cmake/lib_tgvoip.cmake b/Telegram/cmake/lib_tgvoip.cmake -index 328ec03..4477916 100644 +index 4fe3e26..f0d3d2e 100644 --- a/Telegram/cmake/lib_tgvoip.cmake +++ b/Telegram/cmake/lib_tgvoip.cmake -@@ -116,6 +116,14 @@ else() +@@ -120,6 +120,14 @@ if (NOT TGVOIP_FOUND) os/linux/AudioPulse.cpp os/linux/AudioPulse.h @@ -2252,12 +2264,12 @@ index 328ec03..4477916 100644 # POSIX os/posix/NetworkSocketPosix.cpp os/posix/NetworkSocketPosix.h -@@ -153,6 +161,20 @@ else() +@@ -157,6 +165,15 @@ if (NOT TGVOIP_FOUND) TGVOIP_NO_OSX_PRIVATE_API ) endif() + elseif (HAIKU) -+ target_compile_options(lib_tgvoip ++ target_compile_options(lib_tgvoip_bundled + PRIVATE + -Wno-unknown-pragmas + -Wno-error=sequence-point @@ -2265,26 +2277,21 @@ index 328ec03..4477916 100644 + -mmmx + -msse2 + ) -+ target_compile_definitions(lib_tgvoip -+ PUBLIC -+ WEBRTC_POSIX -+ WEBRTC_HAIKU -+ ) else() - target_compile_options(lib_tgvoip + target_compile_options(lib_tgvoip_bundled PRIVATE -@@ -801,6 +823,12 @@ else() +@@ -805,6 +822,12 @@ if (NOT TGVOIP_FOUND) WEBRTC_POSIX WEBRTC_MAC ) + elseif (HAIKU) -+ target_compile_definitions(lib_tgvoip ++ target_compile_definitions(lib_tgvoip_bundled + PUBLIC + WEBRTC_POSIX + WEBRTC_HAIKU + ) else() - target_compile_definitions(lib_tgvoip + target_compile_definitions(lib_tgvoip_bundled PUBLIC diff --git a/Telegram/lib_base/CMakeLists.txt b/Telegram/lib_base/CMakeLists.txt index 540662f..84af89f 100644 @@ -3019,11 +3026,29 @@ index 570d169..8644d20 100644 if (bold) { #ifdef DESKTOP_APP_USE_PACKAGED_FONTS result.setWeight(QFont::DemiBold); +diff --git a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp +index 8dfa916..01ece83 100644 +--- a/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp ++++ b/Telegram/lib_webrtc/webrtc/webrtc_audio_input_tester.cpp +@@ -5,7 +5,12 @@ + // https://github.com/desktop-app/legal/blob/master/LEGAL + // + #include "webrtc/webrtc_audio_input_tester.h" +- ++// Don't include SupportDefs.h ++#ifdef __HAIKU__ ++#define _SUPPORT_DEFS_H ++typedef int32 status_t; ++typedef uint32 type_code; ++#endif + #include "media/engine/webrtc_media_engine.h" + #include "api/task_queue/default_task_queue_factory.h" + #include "crl/crl_object_on_thread.h" diff --git a/cmake/external/webrtc/CMakeLists.txt b/cmake/external/webrtc/CMakeLists.txt -index 6b32f41..5f8af75 100644 +index 1273291..7f19110 100644 --- a/cmake/external/webrtc/CMakeLists.txt +++ b/cmake/external/webrtc/CMakeLists.txt -@@ -39,6 +39,11 @@ else() +@@ -44,6 +44,11 @@ else() INTERFACE WEBRTC_MAC ) @@ -3144,10 +3169,10 @@ index c87b135..5b488bf 100644 if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux" AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux32") diff --git a/cmake/variables.cmake b/cmake/variables.cmake -index eb913e6..f0b811a 100644 +index 92141bc..ec52697 100644 --- a/cmake/variables.cmake +++ b/cmake/variables.cmake -@@ -69,6 +69,7 @@ set(build_osx 0) +@@ -65,6 +65,7 @@ set(build_osx 0) set(build_macstore 0) set(build_winstore 0) set(build_linux32 0) @@ -3155,7 +3180,7 @@ index eb913e6..f0b811a 100644 if (WIN32) if (DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp") -@@ -80,6 +81,12 @@ elseif (APPLE) +@@ -76,6 +77,12 @@ elseif (APPLE) elseif (DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore") set(build_macstore 1) endif() diff --git a/net-im/telegram-desktop/telegram_desktop-2.3.0.recipe b/net-im/telegram-desktop/telegram_desktop-2.3.2.recipe similarity index 78% rename from net-im/telegram-desktop/telegram_desktop-2.3.0.recipe rename to net-im/telegram-desktop/telegram_desktop-2.3.2.recipe index b1c22b248..bf31b7f97 100644 --- a/net-im/telegram-desktop/telegram_desktop-2.3.0.recipe +++ b/net-im/telegram-desktop/telegram_desktop-2.3.2.recipe @@ -6,17 +6,20 @@ LICENSE="GNU GPL v3" REVISION="1" SOURCE_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v$portVersion/tdesktop-$portVersion-full.tar.gz" -CHECKSUM_SHA256="bc05b13c4cb2137a15d3ecc1c201295bb0020a78c20b8cdaa8856569c625ea79" +CHECKSUM_SHA256="292631bcac4b30f778879ecd2cebf4c6f569ab5be01230c8e62b924b4211a259" SOURCE_FILENAME="tdesktop-$portVersion-full.tar.gz" SOURCE_DIR="tdesktop-$portVersion-full" -srcGitRev_2="0663103551379b958b2e79c51d51d163ec484300" -SOURCE_URI_2="https://salsa.debian.org/debian/telegram-desktop/raw/$srcGitRev_2/debian/rules#noarchive" -CHECKSUM_SHA256_2="2b24fb808acee36b5a15824c4ff8bd8b8e83a326a9e4593d2b21922425c5ffb3" +srcGitRev_2="102b5e7eb15af02531f6ae07eb6ba935a8e0a348" +SOURCE_URI_2="https://github.com/desktop-app/tg_owt/archive/$srcGitRev_2.tar.gz" +CHECKSUM_SHA256_2="86f9a312c38443af370b1ccabd22928ba219c32df2c47f29d76df022c687ed08" +SOURCE_FILENAME_2="tg_owt-$srcGitRev_2.tar.gz" +srcGitRev_3="0663103551379b958b2e79c51d51d163ec484300" +SOURCE_URI_3="https://salsa.debian.org/debian/telegram-desktop/raw/$srcGitRev_3/debian/rules#noarchive" +CHECKSUM_SHA256_3="2b24fb808acee36b5a15824c4ff8bd8b8e83a326a9e4593d2b21922425c5ffb3" + +PATCHES="telegram_desktop-$portVersion.patchset" +PATCHES_2="telegram_desktop-$portVersion-owt.patchset" -PATCHES=" - telegram_desktop-$portVersion.patchset - telegram_desktop-$portVersion-defaults.patchset - " ADDITIONAL_FILES=" telegram_desktop.rdef.in logo_256_no_margin.png @@ -39,6 +42,7 @@ REQUIRES=" lib:libglib_2.0$secondaryArchSuffix lib:libgthread_2.0$secondaryArchSuffix lib:libhunspell_1.7$secondaryArchSuffix + lib:libjpeg$secondaryArchSuffix lib:liblz4$secondaryArchSuffix lib:liblzma$secondaryArchSuffix lib:libminizip$secondaryArchSuffix @@ -63,6 +67,7 @@ BUILD_REQUIRES=" devel:libglib_2.0$secondaryArchSuffix devel:libgthread_2.0$secondaryArchSuffix devel:libhunspell_1.7$secondaryArchSuffix + devel:libjpeg$secondaryArchSuffix devel:liblz4$secondaryArchSuffix devel:liblzma$secondaryArchSuffix devel:libminizip$secondaryArchSuffix @@ -88,6 +93,7 @@ BUILD_PREREQUIRES=" cmd:pkg_config$secondaryArchSuffix cmd:python cmd:sed + cmd:yasm " PATCH() @@ -97,9 +103,25 @@ PATCH() BUILD() { + export DISABLE_ASLR=1 + + # build webrtc + mkdir -p $sourceDir/../Libraries + ln -sfn $sourceDir2/tg_owt-$srcGitRev_2 $sourceDir/../Libraries/tg_owt + mkdir -p $sourceDir/../Libraries/tg_owt/out/Release + cd $sourceDir/../Libraries/tg_owt/out/Release + cmake ../.. \ + -DCMAKE_BUILD_TYPE=Release \ + -DTG_OWT_SPECIAL_TARGET=haiku \ + -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 + # get API_ID and API_HASH from Debian - local TELEGRAM_API_ID=`sed -n 's/TELEGRAM_API_ID = \(.*\)/\1/p' < $sourceDir2/rules` - local TELEGRAM_API_HASH=`sed -n 's/TELEGRAM_API_HASH = \(.*\)/\1/p' < $sourceDir2/rules` + local TELEGRAM_API_ID=`sed -n 's/TELEGRAM_API_ID = \(.*\)/\1/p' < $sourceDir3/rules` + local TELEGRAM_API_HASH=`sed -n 's/TELEGRAM_API_HASH = \(.*\)/\1/p' < $sourceDir3/rules` if [ -z $TELEGRAM_API_ID ] || [ -z $TELEGRAM_API_HASH ]; then TELEGRAM_API_ID="17349" @@ -113,8 +135,9 @@ BUILD() echo -e "\e[32m***************************************************************************\e[39m" fi - mkdir -p build - cd build + # build telegram + mkdir -p $sourceDir/build + cd $sourceDir/build cmake .. \ -DCMAKE_BUILD_TYPE=Release \ @@ -123,15 +146,12 @@ BUILD() -DTDESKTOP_DISABLE_GTK_INTEGRATION=ON \ -DDESKTOP_APP_DISABLE_AUTOUPDATE=ON \ -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=ON \ - -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF \ -DDESKTOP_APP_USE_PACKAGED_FONTS=ON \ -DDESKTOP_APP_USE_HUNSPELL_ONLY=ON \ - -DDESKTOP_APP_DISABLE_WEBRTC_INTEGRATION=ON \ -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF \ -DTDESKTOP_API_ID=$TELEGRAM_API_ID \ -DTDESKTOP_API_HASH=$TELEGRAM_API_HASH - export DISABLE_ASLR=1 # multi-job takes too much memory make