git: 2bc3e6229feb - main - net-im/telegram-desktop: Update to 3.1.9

From: Li-Wen Hsu <lwhsu_at_FreeBSD.org>
Date: Tue, 12 Oct 2021 13:57:39 UTC
The branch main has been updated by lwhsu:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2bc3e6229febd07dd7f2980cb7065573d689a0f5

commit 2bc3e6229febd07dd7f2980cb7065573d689a0f5
Author:     Henry Hu <henry.hu.sh@gmail.com>
AuthorDate: 2021-10-12 13:55:54 +0000
Commit:     Li-Wen Hsu <lwhsu@FreeBSD.org>
CommitDate: 2021-10-12 13:55:54 +0000

    net-im/telegram-desktop: Update to 3.1.9
    
    Thanks to the work done by Gleb (glebius@), we are able to remove most
    of the patches. 11 patches are upstreamed, and 2 seem to be obsolete.
    
    Changelog: https://github.com/telegramdesktop/tdesktop/blob/dev/changelog.txt
    
    PR:             259014
---
 net-im/telegram-desktop/Makefile                   | 25 ++++++++++++----------
 net-im/telegram-desktop/distinfo                   |  6 +++---
 .../files/patch-Telegram_CMakeLists.txt            | 10 ---------
 ...ceFiles_chat__helpers_stickers__emoji__pack.cpp |  4 ++--
 ..._SourceFiles_platform_linux_specific__linux.cpp | 11 ----------
 ...elegram_ThirdParty_libtgvoip_VoIPController.cpp | 11 ----------
 ...Telegram_ThirdParty_libtgvoip_audio_AudioIO.cpp | 20 -----------------
 ...egram_ThirdParty_libtgvoip_audio_AudioInput.cpp | 20 -----------------
 ...gram_ThirdParty_libtgvoip_audio_AudioOutput.cpp | 20 -----------------
 ...patch-Telegram_ThirdParty_libtgvoip_logging.cpp | 20 -----------------
 ...hirdParty_libtgvoip_os_linux_AudioInputALSA.cpp | 13 -----------
 ...irdParty_libtgvoip_os_linux_AudioOutputALSA.cpp | 13 -----------
 ...patch-Telegram_ThirdParty_libtgvoip_threading.h | 23 --------------------
 ...y_libtgvoip_webrtc__dsp_rtc__base_stringutils.h | 11 ----------
 .../files/patch-Telegram_lib__base_base_bytes.h    |  4 ++--
 ...ew_platform_linux_webview__linux__webkit__gtk.h |  2 +-
 .../files/patch-cmake_external_CMakeLists.txt      | 12 -----------
 .../files/patch-cmake_options__linux.cmake         | 14 ------------
 18 files changed, 22 insertions(+), 217 deletions(-)

diff --git a/net-im/telegram-desktop/Makefile b/net-im/telegram-desktop/Makefile
index 2f9dafa3cca2..ac82241f4905 100644
--- a/net-im/telegram-desktop/Makefile
+++ b/net-im/telegram-desktop/Makefile
@@ -1,6 +1,5 @@
 PORTNAME=	telegram-desktop
-DISTVERSION=	2.8.11
-PORTREVISION=	3
+DISTVERSION=	3.1.9
 CATEGORIES=	net-im
 MASTER_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/releases/download/v${DISTVERSION}/
 DISTNAME=	tdesktop-${DISTVERSION}-full
@@ -12,7 +11,7 @@ COMMENT=	Telegram Desktop messaging app
 LICENSE=	GPLv3
 LICENSE_FILE=	${WRKSRC}/LICENSE
 
-BROKEN_i386=	Does not build, webrtc related.
+BROKEN_i386=	does not build, webrtc related
 NOT_FOR_ARCHS=		powerpc powerpc64 powerpcspe
 NOT_FOR_ARCHS_REASON=	Only little endian is supported
 
@@ -40,6 +39,7 @@ LIB_DEPENDS=	libavformat.so:multimedia/ffmpeg \
 		libpipewire-0.3.so:multimedia/pipewire \
 		libqrcodegencpp.so:graphics/qr-code-generator \
 		libusrsctp.so:net/libusrsctp \
+		libwebkit2gtk-4.0.so:www/webkit2-gtk3 \
 		libxcb-keysyms.so:x11/xcb-util-keysyms \
 		libxkbcommon.so:x11/libxkbcommon \
 		libxxhash.so:devel/xxhash \
@@ -52,9 +52,10 @@ USE_GITHUB=	nodefault
 GH_ACCOUNT=	telegramdesktop
 GH_PROJECT=	tdesktop
 USE_GL=		gl
-USE_GNOME=	glib20 glibmm
+USE_GNOME=	glib20 glibmm gtk30
+INSTALLS_ICONS=	yes
 USE_QT=		core dbus gui imageformats network widgets buildtools_build \
-		qmake_build wayland
+		qmake_build wayland svg
 USE_XORG=	x11 xcb xcomposite xdamage xext xfixes xrender xrandr xtst
 
 CMAKE_ARGS=	-DDESKTOP_APP_SPECIAL_TARGET="" -DTDESKTOP_LAUNCHER_BASENAME="telegramdesktop" \
@@ -76,22 +77,24 @@ NO_CCACHE=	yes
 # Telegram uses OpenAL for its audio, but libtgvoip (for voice calls) can use PulseAudio or ALSA.
 # It dynamically loads PulseAudio, and if this fails, it loads ALSA.
 # If both of them are not installed, then voice calls do not work, but other functionalities still work.
-OPTIONS_DEFINE=		GTK
 OPTIONS_DEFAULT=	ALSA
 OPTIONS_MULTI=		AUDIO
 OPTIONS_MULTI_AUDIO=	ALSA PULSEAUDIO
 
 AUDIO_DESC=	Audio backend for voice calls
-GTK_DESC=	Gtk integration (Use Gtk dialogs, etc.)
 
 ALSA_LIB_DEPENDS=	libasound.so:audio/alsa-lib
-GTK_CMAKE_BOOL_OFF=	DESKTOP_APP_DISABLE_GTK_INTEGRATION
-GTK_LIB_DEPENDS=	libwebkit2gtk-4.0.so:www/webkit2-gtk3
-GTK_USE=	GNOME=gtk30
 PULSEAUDIO_LIB_DEPENDS=	libpulse.so:audio/pulseaudio
 
 # Telegram asks each custom build to have its own API ID and hash.
 TELEGRAM_API_HASH=	20a3432aab43f24bb4460fceac5ba38d
 TELEGRAM_API_ID=	601761
 
-.include <bsd.port.mk>
+.include <bsd.port.pre.mk>
+
+.if ${CHOSEN_COMPILER_TYPE} == clang && ${COMPILER_VERSION} <= 100
+post-patch:
+	@${REINPLACE_CMD} -e '/-fstack-clash-protection/d' ${WRKSRC}/cmake/options_linux.cmake
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/net-im/telegram-desktop/distinfo b/net-im/telegram-desktop/distinfo
index be2453ce719a..c4fde3b70327 100644
--- a/net-im/telegram-desktop/distinfo
+++ b/net-im/telegram-desktop/distinfo
@@ -1,3 +1,3 @@
-TIMESTAMP = 1626644072
-SHA256 (tdesktop-2.8.11-full.tar.gz) = 168487a59a8ae6ca1fbd66ccefc9eae19344af61bfb8d4cdde3cf73c115aa9dc
-SIZE (tdesktop-2.8.11-full.tar.gz) = 37105468
+TIMESTAMP = 1633724864
+SHA256 (tdesktop-3.1.9-full.tar.gz) = 569555194f8c8396ee21de44971709dc0d331fe9b3d99cce49977d6dd19fcecf
+SIZE (tdesktop-3.1.9-full.tar.gz) = 38494199
diff --git a/net-im/telegram-desktop/files/patch-Telegram_CMakeLists.txt b/net-im/telegram-desktop/files/patch-Telegram_CMakeLists.txt
deleted file mode 100644
index b73658c83961..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_CMakeLists.txt
+++ /dev/null
@@ -1,10 +0,0 @@
---- Telegram/CMakeLists.txt.orig	2020-02-18 08:28:06 UTC
-+++ Telegram/CMakeLists.txt
-@@ -4,6 +4,7 @@
- # For license and copyright information please follow this link:
- # https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
- 
-+link_directories(${OPUS_LIBDIR})
- add_executable(Telegram WIN32 MACOSX_BUNDLE)
- init_target(Telegram)
- 
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 0a485f86df83..8650be013302 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	2020-08-23 13:36:52 UTC
+--- Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp.orig	2021-10-08 09:51:22 UTC
 +++ Telegram/SourceFiles/chat_helpers/stickers_emoji_pack.cpp
-@@ -88,7 +88,7 @@ constexpr auto kRefreshTimeout = 7200 * crl::time(1000
+@@ -99,7 +99,7 @@ constexpr auto kRefreshTimeout = 7200 * crl::time(1000
  		},
  		5,
  	};
diff --git a/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_specific__linux.cpp b/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_specific__linux.cpp
deleted file mode 100644
index 6a5dbdc9c42c..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_SourceFiles_platform_linux_specific__linux.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- Telegram/SourceFiles/platform/linux/specific_linux.cpp.orig	2021-07-17 09:47:10 UTC
-+++ Telegram/SourceFiles/platform/linux/specific_linux.cpp
-@@ -48,7 +48,7 @@ https://github.com/telegramdesktop/tdesktop/blob/maste
- #include <gio/gio.h>
- #include <glibmm.h>
- #include <giomm.h>
--#include <jemalloc/jemalloc.h>
-+#include <malloc_np.h>
- 
- #include <sys/stat.h>
- #include <sys/types.h>
diff --git a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_VoIPController.cpp b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_VoIPController.cpp
deleted file mode 100644
index 1b19e7c3c042..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_VoIPController.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- Telegram/ThirdParty/libtgvoip/VoIPController.cpp.orig	2020-02-12 13:11:18 UTC
-+++ Telegram/ThirdParty/libtgvoip/VoIPController.cpp
-@@ -3005,7 +3005,7 @@ static void initMachTimestart() {
- #endif
- 
- double VoIPController::GetCurrentTime(){
--#if defined(__linux__)
-+#if defined(__linux__) || defined(__FreeBSD__)
- 	struct timespec ts;
- 	clock_gettime(CLOCK_MONOTONIC, &ts);
- 	return ts.tv_sec+(double)ts.tv_nsec/1000000000.0;
diff --git a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioIO.cpp b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioIO.cpp
deleted file mode 100644
index 80883aad5e83..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioIO.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
---- Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp.orig	2018-12-31 01:05:58 UTC
-+++ Telegram/ThirdParty/libtgvoip/audio/AudioIO.cpp
-@@ -31,7 +31,7 @@
- #endif
- #include "../os/windows/AudioInputWASAPI.h"
- #include "../os/windows/AudioOutputWASAPI.h"
--#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__gnu_hurd__)
-+#elif defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__gnu_hurd__)
- #ifndef WITHOUT_ALSA
- #include "../os/linux/AudioInputALSA.h"
- #include "../os/linux/AudioOutputALSA.h"
-@@ -65,7 +65,7 @@ AudioIO* AudioIO::Create(std::string inputDevice, std:
- 		return new ContextlessAudioIO<AudioInputWave, AudioOutputWave>(inputDevice, outputDevice);
- #endif
- 	return new ContextlessAudioIO<AudioInputWASAPI, AudioOutputWASAPI>(inputDevice, outputDevice);
--#elif defined(__linux__)
-+#elif defined(__linux__) || defined(__FreeBSD__)
- #ifndef WITHOUT_ALSA
- #ifndef WITHOUT_PULSE
- 	if(AudioPulse::Load()){
diff --git a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioInput.cpp b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioInput.cpp
deleted file mode 100644
index 241943022c2e..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioInput.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
---- Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp.orig	2018-12-31 01:05:58 UTC
-+++ Telegram/ThirdParty/libtgvoip/audio/AudioInput.cpp
-@@ -26,7 +26,7 @@
- #include "../os/windows/AudioInputWave.h"
- #endif
- #include "../os/windows/AudioInputWASAPI.h"
--#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__gnu_hurd__)
-+#elif defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__gnu_hurd__)
- #ifndef WITHOUT_ALSA
- #include "../os/linux/AudioInputALSA.h"
- #endif
-@@ -72,7 +72,7 @@ void AudioInput::EnumerateDevices(std::vector<AudioInp
- 	}
- #endif
- 	AudioInputWASAPI::EnumerateDevices(devs);
--#elif defined(__linux__) && !defined(__ANDROID__)
-+#elif (defined(__linux__) || defined(__FreeBSD__)) && !defined(__ANDROID__)
- #if !defined(WITHOUT_PULSE) && !defined(WITHOUT_ALSA)
- 	if(!AudioInputPulse::EnumerateDevices(devs))
- 		AudioInputALSA::EnumerateDevices(devs);
diff --git a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioOutput.cpp b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioOutput.cpp
deleted file mode 100644
index 90f7d18f159e..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_audio_AudioOutput.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
---- Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp.orig	2018-12-31 01:05:58 UTC
-+++ Telegram/ThirdParty/libtgvoip/audio/AudioOutput.cpp
-@@ -29,7 +29,7 @@
- #include "../os/windows/AudioOutputWave.h"
- #endif
- #include "../os/windows/AudioOutputWASAPI.h"
--#elif defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__gnu_hurd__)
-+#elif defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__gnu_hurd__)
- #ifndef WITHOUT_ALSA
- #include "../os/linux/AudioOutputALSA.h"
- #endif
-@@ -83,7 +83,7 @@ void AudioOutput::EnumerateDevices(std::vector<AudioOu
- 	}
- #endif
- 	AudioOutputWASAPI::EnumerateDevices(devs);
--#elif defined(__linux__) && !defined(__ANDROID__)
-+#elif (defined(__linux__) || defined(__FreeBSD__)) && !defined(__ANDROID__)
- #if !defined(WITHOUT_PULSE) && !defined(WITHOUT_ALSA)
- 	if(!AudioOutputPulse::EnumerateDevices(devs))
- 		AudioOutputALSA::EnumerateDevices(devs);
diff --git a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_logging.cpp b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_logging.cpp
deleted file mode 100644
index 575594ac28ac..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_logging.cpp
+++ /dev/null
@@ -1,20 +0,0 @@
---- Telegram/ThirdParty/libtgvoip/logging.cpp.orig	2018-12-31 01:05:58 UTC
-+++ Telegram/ThirdParty/libtgvoip/logging.cpp
-@@ -13,7 +13,7 @@
- 
- #ifdef __ANDROID__
- #include <sys/system_properties.h>
--#elif defined(__linux__)
-+#elif defined(__linux__) || defined(__FreeBSD__)
- #include <sys/utsname.h>
- #endif
- 
-@@ -51,7 +51,7 @@ void tgvoip_log_file_write_header(FILE* file){
- #else
- 			char* systemVersion="Windows RT";
- #endif
--#elif defined(__linux__)
-+#elif defined(__linux__) || defined(__FreeBSD__)
- #ifdef __ANDROID__
- 		char systemVersion[128];
- 		char sysRel[PROP_VALUE_MAX];
diff --git a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_os_linux_AudioInputALSA.cpp b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_os_linux_AudioInputALSA.cpp
deleted file mode 100644
index 750f205f7496..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_os_linux_AudioInputALSA.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
---- Telegram/ThirdParty/libtgvoip/os/linux/AudioInputALSA.cpp.orig	2018-11-23 01:03:16 UTC
-+++ Telegram/ThirdParty/libtgvoip/os/linux/AudioInputALSA.cpp
-@@ -12,6 +12,10 @@
- #include "../../logging.h"
- #include "../../VoIPController.h"
- 
-+#ifndef typeof
-+#define typeof __typeof__
-+#endif
-+
- using namespace tgvoip::audio;
- 
- #define BUFFER_SIZE 960
diff --git a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_os_linux_AudioOutputALSA.cpp b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_os_linux_AudioOutputALSA.cpp
deleted file mode 100644
index 5b409bc4e3e8..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_os_linux_AudioOutputALSA.cpp
+++ /dev/null
@@ -1,13 +0,0 @@
---- Telegram/ThirdParty/libtgvoip/os/linux/AudioOutputALSA.cpp.orig	2018-11-23 01:03:16 UTC
-+++ Telegram/ThirdParty/libtgvoip/os/linux/AudioOutputALSA.cpp
-@@ -11,6 +11,10 @@
- #include "../../logging.h"
- #include "../../VoIPController.h"
- 
-+#ifndef typeof
-+#define typeof __typeof__
-+#endif
-+
- #define BUFFER_SIZE 960
- #define CHECK_ERROR(res, msg) if(res<0){LOGE(msg ": %s", _snd_strerror(res)); failed=true; return;}
- #define CHECK_DL_ERROR(res, msg) if(!res){LOGE(msg ": %s", dlerror()); failed=true; return;}
diff --git a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_threading.h b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_threading.h
deleted file mode 100644
index e1b6695ccac0..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_threading.h
+++ /dev/null
@@ -1,23 +0,0 @@
---- Telegram/ThirdParty/libtgvoip/threading.h.orig	2018-11-23 01:03:16 UTC
-+++ Telegram/ThirdParty/libtgvoip/threading.h
-@@ -18,6 +18,9 @@
- #ifdef __APPLE__
- #include "os/darwin/DarwinSpecific.h"
- #endif
-+#ifdef __FreeBSD__
-+#include <pthread_np.h>
-+#endif
- 
- namespace tgvoip{
- 	class Mutex{
-@@ -92,7 +95,9 @@ namespace tgvoip{
- 		static void* ActualEntryPoint(void* arg){
- 			Thread* self=reinterpret_cast<Thread*>(arg);
- 			if(self->name){
--#if !defined(__APPLE__) && !defined(__gnu_hurd__)
-+#if defined(__FreeBSD__)
-+				pthread_set_name_np(self->thread, self->name);
-+#elif !defined(__APPLE__) && !defined(__gnu_hurd__)
- 				pthread_setname_np(self->thread, self->name);
- #elif !defined(__gnu_hurd__)
- 				pthread_setname_np(self->name);
diff --git a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_webrtc__dsp_rtc__base_stringutils.h b/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_webrtc__dsp_rtc__base_stringutils.h
deleted file mode 100644
index d5cbd84ab180..000000000000
--- a/net-im/telegram-desktop/files/patch-Telegram_ThirdParty_libtgvoip_webrtc__dsp_rtc__base_stringutils.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/stringutils.h.orig	2018-11-23 01:03:16 UTC
-+++ Telegram/ThirdParty/libtgvoip/webrtc_dsp/rtc_base/stringutils.h
-@@ -25,7 +25,7 @@
- #endif  // WEBRTC_WIN
- 
- #if defined(WEBRTC_POSIX)
--#ifdef BSD
-+#ifdef __FreeBSD__
- #include <stdlib.h>
- #else  // BSD
- #include <alloca.h>
diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_bytes.h b/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_bytes.h
index e72f800947a4..86acdd096d6d 100644
--- a/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_bytes.h
+++ b/net-im/telegram-desktop/files/patch-Telegram_lib__base_base_bytes.h
@@ -1,4 +1,4 @@
---- Telegram/lib_base/base/bytes.h.orig	2020-05-12 13:19:31 UTC
+--- Telegram/lib_base/base/bytes.h.orig	2021-10-06 07:02:39 UTC
 +++ Telegram/lib_base/base/bytes.h
 @@ -145,7 +145,7 @@ template <
  vector concatenate(Args &&...args) {
@@ -9,7 +9,7 @@
  	return result;
  }
  
-@@ -157,7 +157,7 @@ vector concatenate(SpanRange args) {
+@@ -156,7 +156,7 @@ vector concatenate(SpanRange args) {
  		size += bytes::make_span(arg).size();
  	}
  	auto result = vector(size);
diff --git a/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkit__gtk.h b/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkit__gtk.h
index 4d3abc07b7be..3d0e797856ff 100644
--- a/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkit__gtk.h
+++ b/net-im/telegram-desktop/files/patch-Telegram_lib__webview_webview_platform_linux_webview__linux__webkit__gtk.h
@@ -5,6 +5,6 @@
  #pragma once
  
 +#include <type_traits>  // Required for glib/gatomic.h
- extern "C" {
  #include <JavaScriptCore/JavaScript.h>
  #include <gtk/gtk.h>
+ #include <webkit2/webkit2.h>
diff --git a/net-im/telegram-desktop/files/patch-cmake_external_CMakeLists.txt b/net-im/telegram-desktop/files/patch-cmake_external_CMakeLists.txt
deleted file mode 100644
index e2b542cb42f4..000000000000
--- a/net-im/telegram-desktop/files/patch-cmake_external_CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
---- cmake/external/CMakeLists.txt.orig	2021-07-13 19:08:45 UTC
-+++ cmake/external/CMakeLists.txt
-@@ -37,9 +37,6 @@ if (add_hunspell_library)
- 	add_checked_subdirectory(hunspell)
- endif()
- add_checked_subdirectory(iconv)
--if (LINUX)
--    add_checked_subdirectory(jemalloc)
--endif()
- add_checked_subdirectory(jpeg)
- if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION)
-     add_checked_subdirectory(kwayland)
diff --git a/net-im/telegram-desktop/files/patch-cmake_options__linux.cmake b/net-im/telegram-desktop/files/patch-cmake_options__linux.cmake
deleted file mode 100644
index aa6e5e7df10e..000000000000
--- a/net-im/telegram-desktop/files/patch-cmake_options__linux.cmake
+++ /dev/null
@@ -1,14 +0,0 @@
---- cmake/options_linux.cmake.orig	2021-07-13 19:08:45 UTC
-+++ cmake/options_linux.cmake
-@@ -58,11 +58,6 @@ if (DESKTOP_APP_SPECIAL_TARGET)
-     endif()
- endif()
- 
--target_link_libraries(common_options
--INTERFACE
--    desktop-app::external_jemalloc
--)
--
- if (DESKTOP_APP_USE_PACKAGED)
-     find_library(ATOMIC_LIBRARY atomic)
- else()