From 4a546599e416e96bb11f75af07e70f6fca1f1a8d Mon Sep 17 00:00:00 2001 From: Li-Wen Hsu Date: Fri, 4 Sep 2020 08:58:49 +0000 Subject: [PATCH] net-im/telegram-desktop: Update to 2.3.2 PR: 249094 Submitted by: Henry Hu (maintainer) --- net-im/telegram-desktop/Makefile | 47 ++++++++++++++----- net-im/telegram-desktop/distinfo | 8 ++-- ...es_chat__helpers_stickers__emoji__pack.cpp | 4 +- ..._base_platform_linux_base__info__linux.cpp | 31 ++++++------ ...patch-cmake_external_webrtc_CMakeLists.txt | 17 +++++++ .../files/patch-tg__owt_CMakeLists.txt | 26 ++++++++++ .../patch-tg__owt_cmake_init__target.cmake | 11 +++++ .../files/patch-tg__owt_cmake_libevent.cmake | 26 ++++++++++ ...-tg__owt_src_media_sctp_sctp__transport.cc | 11 +++++ .../patch-tg__owt_src_rtc__base_byte__order.h | 11 +++++ ...patch-tg__owt_src_rtc__base_ip__address.cc | 10 ++++ ..._src_rtc__base_physical__socket__server.cc | 29 ++++++++++++ ...t_src_rtc__base_physical__socket__server.h | 11 +++++ ...t_src_rtc__base_platform__thread__types.cc | 43 +++++++++++++++++ 14 files changed, 252 insertions(+), 33 deletions(-) create mode 100644 net-im/telegram-desktop/files/patch-cmake_external_webrtc_CMakeLists.txt create mode 100644 net-im/telegram-desktop/files/patch-tg__owt_CMakeLists.txt create mode 100644 net-im/telegram-desktop/files/patch-tg__owt_cmake_init__target.cmake create mode 100644 net-im/telegram-desktop/files/patch-tg__owt_cmake_libevent.cmake create mode 100644 net-im/telegram-desktop/files/patch-tg__owt_src_media_sctp_sctp__transport.cc create mode 100644 net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_byte__order.h create mode 100644 net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_ip__address.cc create mode 100644 net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_physical__socket__server.cc create mode 100644 net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_physical__socket__server.h create mode 100644 net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_platform__thread__types.cc diff --git a/net-im/telegram-desktop/Makefile b/net-im/telegram-desktop/Makefile index c767294fafc6..e762b4062256 100644 --- a/net-im/telegram-desktop/Makefile +++ b/net-im/telegram-desktop/Makefile @@ -1,10 +1,11 @@ # $FreeBSD$ PORTNAME= telegram-desktop -DISTVERSION= 2.1.13 +DISTVERSION= 2.3.2 CATEGORIES= net-im MASTER_SITES= https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/releases/download/v${DISTVERSION}/ DISTNAME= tdesktop-${DISTVERSION}-full +DISTFILES= ${DISTNAME}${EXTRACT_SUFX} MAINTAINER= henry.hu.sh@gmail.com COMMENT= Telegram Desktop messaging app @@ -14,23 +15,30 @@ LICENSE_FILE= ${WRKSRC}/LICENSE NOT_FOR_ARCHS= powerpc powerpc64 powerpcspe NOT_FOR_ARCHS_REASON= Only little endian is supported +BROKEN_i386= Does not build, webrtc related. BUILD_DEPENDS= alsa-lib>0:audio/alsa-lib \ dee>0:devel/dee \ + microsoft-gsl>0:devel/microsoft-gsl \ pulseaudio>0:audio/pulseaudio \ range-v3>0:devel/range-v3 \ - microsoft-gsl>0:devel/microsoft-gsl \ - tl-expected>0:devel/tl-expected + tl-expected>0:devel/tl-expected \ + v4l_compat>0:multimedia/v4l_compat \ + yasm:devel/yasm LIB_DEPENDS= libavformat.so:multimedia/ffmpeg \ libdbus-1.so:devel/dbus \ + libdbusmenu-qt5.so:devel/libdbusmenu-qt \ + libenchant-2.so:textproc/enchant2 \ + libhunspell-1.7.so:textproc/hunspell \ + libjpeg.so:graphics/jpeg-turbo \ + liblz4.so:archivers/liblz4 \ libminizip.so:archivers/minizip \ libopenal.so:audio/openal-soft \ libopus.so:audio/opus \ - libdbusmenu-qt5.so:devel/libdbusmenu-qt \ - libhunspell-1.7.so:textproc/hunspell \ - libxxhash.so:devel/xxhash \ - libenchant-2.so:textproc/enchant2 \ - liblz4.so:archivers/liblz4 + libqrcodegencpp.so:graphics/qr-code-generator \ + libusrsctp.so:net/libusrsctp \ + libxkbcommon.so:x11/libxkbcommon \ + libxxhash.so:devel/xxhash USES= cmake compiler:c++17-lang desktop-file-utils \ gnome pkgconfig python:3.7,build qt:5 ssl xorg @@ -38,12 +46,15 @@ USES= cmake compiler:c++17-lang desktop-file-utils \ # see Bugzilla #245452 for details NO_CCACHE= yes +USE_GITHUB= nodefault GH_ACCOUNT= telegramdesktop GH_PROJECT= tdesktop +GH_TUPLE= desktop-app:tg_owt:fc49a0e:tg_owt/tg_owt USE_GNOME= glib20 USE_QT= core dbus gui imageformats network widgets buildtools_build \ - qmake_build + qmake_build wayland USE_XORG= x11 xcb +USE_GL= gl CMAKE_ON= DESKTOP_APP_USE_PACKAGED DESKTOP_APP_DISABLE_CRASH_REPORTS \ TDESKTOP_DISABLE_REGISTER_CUSTOM_SCHEME TDESKTOP_DISABLE_DESKTOP_FILE_GENERATION @@ -51,7 +62,8 @@ CMAKE_OFF= DESKTOP_APP_USE_PACKAGED_RLOTTIE DESKTOP_APP_USE_PACKAGED_VARIANT \ DESKTOP_APP_USE_GLIBC_WRAPS TDESKTOP_USE_PACKAGED_TGVOIP CMAKE_ARGS= -DDESKTOP_APP_SPECIAL_TARGET="" -DTDESKTOP_LAUNCHER_BASENAME="telegramdesktop" \ -DTDESKTOP_API_ID=${TELEGRAM_API_ID} -DTDESKTOP_API_HASH=${TELEGRAM_API_HASH} \ - -Ddisable_autoupdate=1 + -Ddisable_autoupdate=1 \ + -DDESKTOP_APP_WEBRTC_LOCATION=${WRKSRC}/tg_owt/src # Telegram asks each custom build to have its own API ID and hash. TELEGRAM_API_ID= 601761 @@ -73,10 +85,23 @@ PULSEAUDIO_LIB_DEPENDS= libpulse.so:audio/pulseaudio GTK_CMAKE_BOOL_OFF= TDESKTOP_DISABLE_GTK_INTEGRATION +INSTALLS_ICONS= yes + .include .if ${PORT_OPTIONS:MGTK} USE_GNOME+= gtk30 .endif -.include +.include + +pre-configure: + @cd ${WRKSRC}/tg_owt && \ + ${MKDIR} out/${CMAKE_BUILD_TYPE} && \ + cd out/${CMAKE_BUILD_TYPE} && \ + ${CMAKE_BIN} ${CMAKE_ARGS} ${WRKSRC}/tg_owt + +pre-build: + @cd ${WRKSRC}/tg_owt/out/${CMAKE_BUILD_TYPE} && ${DO_MAKE_BUILD} + +.include diff --git a/net-im/telegram-desktop/distinfo b/net-im/telegram-desktop/distinfo index f3839ca87bcc..d5ebc97b9a9b 100644 --- a/net-im/telegram-desktop/distinfo +++ b/net-im/telegram-desktop/distinfo @@ -1,3 +1,5 @@ -TIMESTAMP = 1593031017 -SHA256 (tdesktop-2.1.13-full.tar.gz) = d1653a386107836a0808c3d828341ad54aa962f167d8b2e17430d8aedc710357 -SIZE (tdesktop-2.1.13-full.tar.gz) = 36549505 +TIMESTAMP = 1598842893 +SHA256 (tdesktop-2.3.2-full.tar.gz) = 292631bcac4b30f778879ecd2cebf4c6f569ab5be01230c8e62b924b4211a259 +SIZE (tdesktop-2.3.2-full.tar.gz) = 36402335 +SHA256 (desktop-app-tg_owt-fc49a0e_GH0.tar.gz) = bb17463246eeacf9f7bc97b04d0ff60f5f207f69a19482094e3a1cc14b46f4e4 +SIZE (desktop-app-tg_owt-fc49a0e_GH0.tar.gz) = 18379679 diff --git a/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_chat__helpers_stickers__emoji__pack.cpp b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_chat__helpers_stickers__emoji__pack.cpp index e2386395c9b2..0a485f86df83 100644 --- a/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_chat__helpers_stickers__emoji__pack.cpp +++ b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_chat__helpers_stickers__emoji__pack.cpp @@ -1,6 +1,6 @@ ---- Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp.orig 2019-10-07 15:58:21 UTC +--- Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp.orig 2020-08-23 13:36:52 UTC +++ Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp -@@ -107,7 +107,7 @@ constexpr auto kClearSourceTimeout = 10 * crl::time(10 +@@ -88,7 +88,7 @@ constexpr auto kRefreshTimeout = 7200 * crl::time(1000 }, 5, }; diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_platform_linux_base__info__linux.cpp b/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_platform_linux_base__info__linux.cpp index 1af49fbada6a..8d73b409c77b 100644 --- a/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_platform_linux_base__info__linux.cpp +++ b/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_platform_linux_base__info__linux.cpp @@ -1,5 +1,5 @@ ---- Telegram/lib_base/base/platform/linux/base_info_linux.cpp.orig 2020-06-24 20:32:27.483667000 +0300 -+++ Telegram/lib_base/base/platform/linux/base_info_linux.cpp 2020-06-24 20:45:44.399296000 +0300 +--- Telegram/lib_base/base/platform/linux/base_info_linux.cpp.orig 2020-08-10 11:25:13 UTC ++++ Telegram/lib_base/base/platform/linux/base_info_linux.cpp @@ -13,7 +13,6 @@ #include #include @@ -8,7 +8,7 @@ namespace Platform { namespace { -@@ -72,11 +71,9 @@ +@@ -72,11 +71,9 @@ QString SystemVersionPretty() { const auto value = result ? QString::fromLatin1(result) : QString(); const auto list = value.split(':', QString::SkipEmptyParts); @@ -22,32 +22,29 @@ } QString SystemCountry() { -@@ -92,13 +89,6 @@ - } - +@@ -94,10 +91,6 @@ QString SystemLanguage() { QDate WhenSystemBecomesOutdated() { -- if (IsLinux32Bit()) { -- return QDate(2020, 9, 1); + if (IsLinux32Bit()) { + return QDate(2020, 9, 1); - } else if (const auto version = GetGlibCVersion(); !version.isEmpty()) { - if (QVersionNumber::fromString(version) < QVersionNumber(2, 23)) { - return QDate(2020, 9, 1); // Older than Ubuntu 16.04. - } -- } + } return QDate(); } - -@@ -120,14 +110,6 @@ +@@ -118,14 +111,6 @@ QString AutoUpdateKey() { + } else { + Unexpected("Platform in AutoUpdateKey."); } - } - +-} +- -QString GetGlibCVersion() { - static const auto result = [&] { - const auto version = QString::fromLatin1(gnu_get_libc_version()); - return QVersionNumber::fromString(version).isNull() ? QString() : version; - }(); - return result; --} -- - bool IsWayland() { - return QGuiApplication::platformName().startsWith("wayland", Qt::CaseInsensitive); } + + bool IsWayland() { diff --git a/net-im/telegram-desktop/files/patch-cmake_external_webrtc_CMakeLists.txt b/net-im/telegram-desktop/files/patch-cmake_external_webrtc_CMakeLists.txt new file mode 100644 index 000000000000..cfd3a7592376 --- /dev/null +++ b/net-im/telegram-desktop/files/patch-cmake_external_webrtc_CMakeLists.txt @@ -0,0 +1,17 @@ +--- cmake/external/webrtc/CMakeLists.txt.orig 2020-08-20 13:59:10 UTC ++++ cmake/external/webrtc/CMakeLists.txt +@@ -76,7 +76,7 @@ if (APPLE) + ) + endif() + foreach (lib ${webrtc_libs}) +- list(APPEND webrtc_libs_list "${webrtc_build_loc}/${lib}${webrtc_lib_suffix}") ++ list(APPEND webrtc_libs_list "${DESKTOP_APP_WEBRTC_LOCATION}/../out/$/${lib}${webrtc_lib_suffix}") + endforeach() + + if (WIN32) +@@ -99,4 +99,5 @@ target_link_libraries(external_webrtc + INTERFACE + ${webrtc_libs_list} + desktop-app::external_openssl ++ jpeg + ) diff --git a/net-im/telegram-desktop/files/patch-tg__owt_CMakeLists.txt b/net-im/telegram-desktop/files/patch-tg__owt_CMakeLists.txt new file mode 100644 index 000000000000..3f79e6be0b3d --- /dev/null +++ b/net-im/telegram-desktop/files/patch-tg__owt_CMakeLists.txt @@ -0,0 +1,26 @@ +--- tg_owt/CMakeLists.txt.orig 2020-08-30 09:41:57 UTC ++++ tg_owt/CMakeLists.txt +@@ -38,7 +38,6 @@ 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) +@@ -61,7 +60,6 @@ PRIVATE + tg_owt::libpffft + tg_owt::librnnoise + tg_owt::libsrtp +- tg_owt::libusrsctp + tg_owt::libvpx + tg_owt::libvpx_mmx + tg_owt::libvpx_sse2 +@@ -1757,7 +1755,6 @@ TARGETS + libpffft + librnnoise + libsrtp +- libusrsctp + libvpx + libvpx_mmx + libvpx_sse2 diff --git a/net-im/telegram-desktop/files/patch-tg__owt_cmake_init__target.cmake b/net-im/telegram-desktop/files/patch-tg__owt_cmake_init__target.cmake new file mode 100644 index 000000000000..3d8cc9918339 --- /dev/null +++ b/net-im/telegram-desktop/files/patch-tg__owt_cmake_init__target.cmake @@ -0,0 +1,11 @@ +--- tg_owt/cmake/init_target.cmake.orig 2020-08-30 09:41:57 UTC ++++ tg_owt/cmake/init_target.cmake +@@ -10,7 +10,7 @@ function(init_target target_name) # init_target(my_tar + elseif (APPLE) + target_compile_features(${target_name} PUBLIC cxx_std_14) + else() +- target_compile_features(${target_name} PUBLIC cxx_std_20) ++ target_compile_features(${target_name} PUBLIC cxx_std_17) + endif() + if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") + set_target_properties(${target_name} PROPERTIES diff --git a/net-im/telegram-desktop/files/patch-tg__owt_cmake_libevent.cmake b/net-im/telegram-desktop/files/patch-tg__owt_cmake_libevent.cmake new file mode 100644 index 000000000000..77216670c30f --- /dev/null +++ b/net-im/telegram-desktop/files/patch-tg__owt_cmake_libevent.cmake @@ -0,0 +1,26 @@ +--- tg_owt/cmake/libevent.cmake.orig 2020-08-30 09:41:57 UTC ++++ tg_owt/cmake/libevent.cmake +@@ -17,14 +17,13 @@ if (APPLE) + else() + target_include_directories(libevent + PRIVATE +- ${libevent_loc}/linux ++ ${libevent_loc}/freebsd + ) + endif() + + nice_target_sources(libevent ${libevent_loc} + PRIVATE + buffer.c +- epoll.c + evbuffer.c + evdns.c + event.c +@@ -32,6 +31,7 @@ PRIVATE + evrpc.c + evutil.c + http.c ++ kqueue.c + log.c + poll.c + select.c diff --git a/net-im/telegram-desktop/files/patch-tg__owt_src_media_sctp_sctp__transport.cc b/net-im/telegram-desktop/files/patch-tg__owt_src_media_sctp_sctp__transport.cc new file mode 100644 index 000000000000..beb5350ffbbf --- /dev/null +++ b/net-im/telegram-desktop/files/patch-tg__owt_src_media_sctp_sctp__transport.cc @@ -0,0 +1,11 @@ +--- tg_owt/src/media/sctp/sctp_transport.cc.orig 2020-08-30 09:41:57 UTC ++++ tg_owt/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 { + diff --git a/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_byte__order.h b/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_byte__order.h new file mode 100644 index 000000000000..75e6ca781e96 --- /dev/null +++ b/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_byte__order.h @@ -0,0 +1,11 @@ +--- tg_owt/src/rtc_base/byte_order.h.orig 2020-08-30 09:41:57 UTC ++++ tg_owt/src/rtc_base/byte_order.h +@@ -89,7 +89,7 @@ + #endif // defined(WEBRTC_ARCH_LITTLE_ENDIAN) + + #elif defined(WEBRTC_POSIX) +-#include ++#include + #else + #error "Missing byte order functions for this arch." + #endif // defined(WEBRTC_MAC) diff --git a/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_ip__address.cc b/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_ip__address.cc new file mode 100644 index 000000000000..d539d30d6282 --- /dev/null +++ b/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_ip__address.cc @@ -0,0 +1,10 @@ +--- tg_owt/src/rtc_base/ip_address.cc.orig 2020-08-30 09:41:57 UTC ++++ tg_owt/src/rtc_base/ip_address.cc +@@ -15,6 +15,7 @@ + #include + #endif + #ifndef __native_client__ ++#include + #include + #endif + #include diff --git a/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_physical__socket__server.cc b/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_physical__socket__server.cc new file mode 100644 index 000000000000..d40dea6d99fd --- /dev/null +++ b/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_physical__socket__server.cc @@ -0,0 +1,29 @@ +--- tg_owt/src/rtc_base/physical_socket_server.cc.orig 2020-08-30 09:41:57 UTC ++++ tg_owt/src/rtc_base/physical_socket_server.cc +@@ -51,6 +51,8 @@ + #include "rtc_base/null_socket_server.h" + #include "rtc_base/time_utils.h" + ++#undef WEBRTC_LINUX ++ + #if defined(WEBRTC_LINUX) + #include + #endif +@@ -70,7 +72,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(__native_client__) && !defined(__FreeBSD__) + + int64_t GetSocketRecvTimestamp(int socket) { + struct timeval tv_ioctl; +@@ -551,7 +553,7 @@ int PhysicalSocket::TranslateOption(Option opt, int* s + *slevel = IPPROTO_IP; + *sopt = IP_DONTFRAGMENT; + break; +-#elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__) ++#elif defined(WEBRTC_MAC) || defined(BSD) || defined(__native_client__) || defined(__FreeBSD__) + RTC_LOG(LS_WARNING) << "Socket::OPT_DONTFRAGMENT not supported."; + return -1; + #elif defined(WEBRTC_POSIX) diff --git a/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_physical__socket__server.h b/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_physical__socket__server.h new file mode 100644 index 000000000000..4deb1446cba7 --- /dev/null +++ b/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_physical__socket__server.h @@ -0,0 +1,11 @@ +--- tg_owt/src/rtc_base/physical_socket_server.h.orig 2020-08-30 09:41:57 UTC ++++ tg_owt/src/rtc_base/physical_socket_server.h +@@ -12,8 +12,6 @@ + #define RTC_BASE_PHYSICAL_SOCKET_SERVER_H_ + + #if defined(WEBRTC_POSIX) && defined(WEBRTC_LINUX) +-#include +-#define WEBRTC_USE_EPOLL 1 + #endif + + #include diff --git a/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_platform__thread__types.cc b/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_platform__thread__types.cc new file mode 100644 index 000000000000..ce84319f9895 --- /dev/null +++ b/net-im/telegram-desktop/files/patch-tg__owt_src_rtc__base_platform__thread__types.cc @@ -0,0 +1,43 @@ +--- tg_owt/src/rtc_base/platform_thread_types.cc.orig 2020-08-30 09:41:57 UTC ++++ tg_owt/src/rtc_base/platform_thread_types.cc +@@ -11,10 +11,14 @@ + #include "rtc_base/platform_thread_types.h" + + #if defined(WEBRTC_LINUX) +-#include + #include + #endif + ++#ifdef __FreeBSD__ ++#include ++#include ++#endif ++ + namespace rtc { + + PlatformThreadId CurrentThreadId() { +@@ -28,7 +32,13 @@ PlatformThreadId CurrentThreadId() { + #elif defined(WEBRTC_FUCHSIA) + return zx_thread_self(); + #elif defined(WEBRTC_LINUX) ++#if defined(__FreeBSD__) ++ long id; ++ thr_self(&id); ++ return id; ++#else + return syscall(__NR_gettid); ++#endif + #elif defined(__EMSCRIPTEN__) + return static_cast(pthread_self()); + #else +@@ -78,9 +88,7 @@ void SetCurrentThreadName(const char* name) { + } + #pragma warning(pop) + #elif defined(WEBRTC_LINUX) || defined(WEBRTC_ANDROID) +- prctl(PR_SET_NAME, reinterpret_cast(name)); // NOLINT +-#elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS) +- pthread_setname_np(name); ++ pthread_set_name_np(pthread_self(), name); + #endif + } +