Gentoo Archives: gentoo-commits

From: Georgy Yakovlev <gyakovlev@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: net-im/telegram-desktop/files/, net-im/telegram-desktop/
Date: Sat, 17 Jul 2021 20:05:34
Message-Id: 1626552284.d091935d85df82d49cf2473e21881b7a2e628deb.gyakovlev@gentoo
1 commit: d091935d85df82d49cf2473e21881b7a2e628deb
2 Author: Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
3 AuthorDate: Sat Jul 17 10:39:22 2021 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Sat Jul 17 20:04:44 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d091935d
7
8 net-im/telegram-desktop: Drop jemalloc patch
9
10 Upstream clarified; The glibc allocator causes telegram to use excessive
11 amounts of memory, and never free it. That's a bug.
12
13 See-also: https://github.com/telegramdesktop/tdesktop/issues/16084
14 See-also: https://github.com/desktop-app/cmake_helpers/pull/91#issuecomment-881788003
15 Closes: https://github.com/gentoo/gentoo/pull/21688
16 Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com>
17 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
18
19 ...desktop-2.8.9-disable-jemalloc-separately.patch | 100 ---------------------
20 .../telegram-desktop-2.8.10.ebuild | 10 +--
21 2 files changed, 3 insertions(+), 107 deletions(-)
22
23 diff --git a/net-im/telegram-desktop/files/tdesktop-2.8.9-disable-jemalloc-separately.patch b/net-im/telegram-desktop/files/tdesktop-2.8.9-disable-jemalloc-separately.patch
24 deleted file mode 100644
25 index dff2455d4e3..00000000000
26 --- a/net-im/telegram-desktop/files/tdesktop-2.8.9-disable-jemalloc-separately.patch
27 +++ /dev/null
28 @@ -1,100 +0,0 @@
29 -Allow controlling the use of jemalloc
30 -
31 -Jemalloc is often controlled through USE=jemalloc in Gentoo. Removing or
32 -replacing it is trivial, and I'm not aware of any particular advantages that
33 -come with using this allocator, especially for an IM client. Benchmarks
34 -regarding this allocator provide a huge variety of results depending on the
35 -workload and system, so it's hard to establish when this allocator provides any
36 -tangible advantage.
37 -
38 -Considering things like Hardened Gentoo, the user might prefer to use a more
39 -exploit-resistant allocator, like GrapheneOS/hardened_malloc, and I've heard
40 -Musl is hardening their allocator as well.
41 -
42 -I trust the user can better judge if they need this in their particular setup.
43 -
44 -If a telegram dev is reading this, feel free to drop me a message (metadata.xml
45 -contains the maintainer's address), if you believe it should be forced due to
46 -usability concerns, or if you can provide me with some context I might be
47 -missing. Jemalloc is currently enabled by default.
48 -
49 ---- tdesktop-2.8.9-full.orig/Telegram/SourceFiles/platform/linux/specific_linux.cpp
50 -+++ tdesktop-2.8.9-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp
51 -@@ -48,7 +48,10 @@
52 - #include <gio/gio.h>
53 - #include <glibmm.h>
54 - #include <giomm.h>
55 -+
56 -+#ifndef DESKTOP_APP_DISABLE_JEMALLOC
57 - #include <jemalloc/jemalloc.h>
58 -+#endif // !DESKTOP_APP_DISABLE_JEMALLOC
59 -
60 - #include <sys/stat.h>
61 - #include <sys/types.h>
62 -@@ -727,8 +730,10 @@
63 - namespace Platform {
64 -
65 - void start() {
66 -+#ifndef DESKTOP_APP_DISABLE_JEMALLOC
67 - auto backgroundThread = true;
68 - mallctl("background_thread", nullptr, nullptr, &backgroundThread, sizeof(bool));
69 -+#endif // !DESKTOP_APP_DISABLE_JEMALLOC
70 -
71 - LOG(("Launcher filename: %1").arg(QGuiApplication::desktopFileName()));
72 -
73 ---- tdesktop-2.8.9-full.orig/cmake/external/CMakeLists.txt
74 -+++ tdesktop-2.8.9-full/cmake/external/CMakeLists.txt
75 -@@ -37,7 +37,7 @@
76 - add_checked_subdirectory(hunspell)
77 - endif()
78 - add_checked_subdirectory(iconv)
79 --if (LINUX)
80 -+if (LINUX AND NOT DESKTOP_APP_DISABLE_JEMALLOC)
81 - add_checked_subdirectory(jemalloc)
82 - endif()
83 - add_checked_subdirectory(jpeg)
84 ---- tdesktop-2.8.9-full.orig/cmake/options.cmake
85 -+++ tdesktop-2.8.9-full/cmake/options.cmake
86 -@@ -56,6 +56,13 @@
87 - )
88 - endif()
89 -
90 -+if (DESKTOP_APP_DISABLE_JEMALLOC)
91 -+ target_compile_definitions(common_options
92 -+ INTERFACE
93 -+ DESKTOP_APP_DISABLE_JEMALLOC
94 -+ )
95 -+endif()
96 -+
97 - if (DESKTOP_APP_USE_PACKAGED)
98 - target_compile_definitions(common_options
99 - INTERFACE
100 ---- tdesktop-2.8.9-full.orig/cmake/options_linux.cmake
101 -+++ tdesktop-2.8.9-full/cmake/options_linux.cmake
102 -@@ -58,10 +58,12 @@
103 - endif()
104 - endif()
105 -
106 --target_link_libraries(common_options
107 --INTERFACE
108 -- desktop-app::external_jemalloc
109 --)
110 -+if (NOT DESKTOP_APP_DISABLE_JEMALLOC)
111 -+ target_link_libraries(common_options
112 -+ INTERFACE
113 -+ desktop-app::external_jemalloc
114 -+ )
115 -+endif()
116 -
117 - if (DESKTOP_APP_USE_PACKAGED)
118 - find_library(ATOMIC_LIBRARY atomic)
119 ---- tdesktop-2.8.9-full.orig/cmake/variables.cmake
120 -+++ tdesktop-2.8.9-full/cmake/variables.cmake
121 -@@ -38,6 +38,7 @@
122 - option(DESKTOP_APP_USE_PACKAGED_FFMPEG_STATIC "Link ffmpeg statically in packaged mode." OFF)
123 - option(DESKTOP_APP_DISABLE_SPELLCHECK "Disable spellcheck library." ${osx_special_target})
124 - option(DESKTOP_APP_DISABLE_WEBKIT "Disable WebkitGTK library (Linux only)." OFF)
125 -+option(DESKTOP_APP_DISABLE_JEMALLOC "Disable use of the jemalloc allocator (Linux only)." OFF)
126 - option(DESKTOP_APP_DISABLE_CRASH_REPORTS "Disable crash report generation." ${no_special_target})
127 - option(DESKTOP_APP_DISABLE_AUTOUPDATE "Disable autoupdate." ${disable_autoupdate})
128 - option(DESKTOP_APP_USE_HUNSPELL_ONLY "Disable system spellchecker and use bundled Hunspell only. (For debugging purposes)" OFF)
129
130 diff --git a/net-im/telegram-desktop/telegram-desktop-2.8.10.ebuild b/net-im/telegram-desktop/telegram-desktop-2.8.10.ebuild
131 index 69bfb7c3a17..e738b91f41d 100644
132 --- a/net-im/telegram-desktop/telegram-desktop-2.8.10.ebuild
133 +++ b/net-im/telegram-desktop/telegram-desktop-2.8.10.ebuild
134 @@ -16,7 +16,7 @@ SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${
135 LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+"
136 SLOT="0"
137 KEYWORDS="~amd64 ~ppc64"
138 -IUSE="+dbus enchant +gtk +hunspell +jemalloc +spell wayland webkit +X"
139 +IUSE="+dbus enchant +gtk +hunspell +spell wayland webkit +X"
140 REQUIRED_USE="
141 spell? (
142 ^^ ( enchant hunspell )
143 @@ -29,6 +29,7 @@ RDEPEND="
144 !net-im/telegram-desktop-bin
145 app-arch/lz4:=
146 dev-cpp/glibmm:2
147 + dev-libs/jemalloc:=
148 dev-libs/xxhash
149 >=dev-qt/qtcore-5.15:5
150 >=dev-qt/qtgui-5.15:5[dbus?,jpeg,png,wayland?,X(-)?]
151 @@ -53,7 +54,6 @@ RDEPEND="
152 enchant? ( app-text/enchant:= )
153 gtk? ( x11-libs/gtk+:3[X?,wayland?] )
154 hunspell? ( >=app-text/hunspell-1.7:= )
155 - jemalloc? ( dev-libs/jemalloc:= )
156 wayland? ( kde-frameworks/kwayland:= )
157 webkit? ( net-libs/webkit-gtk:= )
158 X? ( x11-libs/libxcb:= )
159 @@ -74,9 +74,6 @@ PATCHES=(
160 # https://github.com/desktop-app/cmake_helpers/pull/91
161 # https://github.com/desktop-app/lib_webview/pull/2
162 "${FILESDIR}/tdesktop-2.8.9-disable-webkit-separately.patch"
163 - # Not going to attempt upstreaming this after the reaction to
164 - # "disable-webkit-separately"
165 - "${FILESDIR}/tdesktop-2.8.9-disable-jemalloc-separately.patch"
166 # Not a proper fix, not upstreamed
167 "${FILESDIR}/tdesktop-2.8.9-webview-fix-glib.patch"
168 )
169 @@ -110,7 +107,6 @@ src_configure() {
170 -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=$(usex dbus OFF ON)
171 -DDESKTOP_APP_DISABLE_GTK_INTEGRATION=$(usex gtk OFF ON)
172 -DDESKTOP_APP_DISABLE_WEBKIT=$(usex webkit OFF ON)
173 - -DDESKTOP_APP_DISABLE_JEMALLOC=$(usex jemalloc OFF ON)
174 -DDESKTOP_APP_DISABLE_SPELLCHECK=$(usex spell OFF ON) # enables hunspell (recommended)
175 -DDESKTOP_APP_USE_ENCHANT=$(usex enchant ON OFF) # enables enchant and disables hunspell
176 )
177 @@ -143,5 +139,5 @@ src_configure() {
178
179 pkg_postinst() {
180 xdg_pkg_postinst
181 - use gtk || elog "enable 'gtk' useflag if you have image copy-paste problems"
182 + use gtk || elog "enable the 'gtk' useflag if you have image copy-paste problems"
183 }