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/, net-im/telegram-desktop/files/
Date: Tue, 29 Nov 2022 14:59:41
Message-Id: 1669733947.f62d7c6599bbb275f7863bd1fef0f5d31a673703.gyakovlev@gentoo
1 commit: f62d7c6599bbb275f7863bd1fef0f5d31a673703
2 Author: Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
3 AuthorDate: Sun Nov 27 19:05:52 2022 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Tue Nov 29 14:59:07 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f62d7c65
7
8 net-im/telegram-desktop: Bump to 4.3.4
9
10 Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com>
11 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
12
13 net-im/telegram-desktop/Manifest | 1 +
14 .../tdesktop-4.3.4-fix-disabling-spellcheck.patch | 43 +++++
15 .../tdesktop-4.3.4-qt5-incompatibility-1.patch | 42 +++++
16 .../tdesktop-4.3.4-qt5-incompatibility-2.patch | 28 +++
17 .../telegram-desktop/telegram-desktop-4.3.4.ebuild | 206 +++++++++++++++++++++
18 5 files changed, 320 insertions(+)
19
20 diff --git a/net-im/telegram-desktop/Manifest b/net-im/telegram-desktop/Manifest
21 index fd5e85fb3f0d..b7e61178b0e8 100644
22 --- a/net-im/telegram-desktop/Manifest
23 +++ b/net-im/telegram-desktop/Manifest
24 @@ -1,3 +1,4 @@
25 DIST tdesktop-3.6.1-full.tar.gz 41226549 BLAKE2B 6922ae015e36f86597aaedf1212ed951d6313a8f5f76a8838ab7ef9e02afe0cbc428acd991488190bafdf28faf2a69a09a5a1e963b2aa6ed27ef941602e15d88 SHA512 dd216c720ea3b1c72669805bb31319746a7ddfe746d188bf2ae0c5cdf0a10b379fc2e888a26fe755d77381fc5d9aa638cedc76b2dce1f1126a9c1ef9c02da2ba
26 DIST tdesktop-4.2.4-full.tar.gz 49210806 BLAKE2B 5900f977156f8ec98098a5e2fe97efcc5c2d7e2768123268e4b232e384c47a02fec11b3d5d875f99134aace9d3d7f937defb83ea1572d41c7df52f4d1bda1e9c SHA512 c0b458e4f21855d1041f7343ffdd501890a7535d040b45a8bd565e545d5bc01a00703af65e14ae407bf53f81a6d28d3f7d6afa664eb5b8e5641b21bb8e669a3a
27 DIST tdesktop-4.3.1-full.tar.gz 49305237 BLAKE2B 3f0605adb6b471ecd913921a836c8d0e09d5fb40f107290d085af2a0ad64f7f067014b381a50317ffa089ce68724629972c565619d4d24776ac3496c15d9959f SHA512 365c16f4260827e3ad7e066f6ec96fc97a6f5874df376933f16de20c3488c24f52bc1aa3bd5df936f29a198e287dc8e706b259d57d7d7a9d6468c7edc7568514
28 +DIST tdesktop-4.3.4-full.tar.gz 50030732 BLAKE2B 68d9001128cca6e8a68d991e77a20f9764af9a634c37d792e92f7e77b0446b6d16ec1342f9e7ce7e0c49464f385f795164f9d176d65a74fc64fc072eae33d263 SHA512 415e0d60508317ef6d07e1f8aa2d974b166925f19349106cc543e487dd5bef8d1ff0548fb815682c6c4bb3bf762c08fcb1c7073f2c7ad305ae885b7979c70f88
29
30 diff --git a/net-im/telegram-desktop/files/tdesktop-4.3.4-fix-disabling-spellcheck.patch b/net-im/telegram-desktop/files/tdesktop-4.3.4-fix-disabling-spellcheck.patch
31 new file mode 100644
32 index 000000000000..9529370cdbae
33 --- /dev/null
34 +++ b/net-im/telegram-desktop/files/tdesktop-4.3.4-fix-disabling-spellcheck.patch
35 @@ -0,0 +1,43 @@
36 +Fix building without spellcheck
37 +
38 +Upcoming changes to tdesktop include language recognition, which is a bit of a
39 +doozy, and as is tradition, "unusual" compilation flags go untested.
40 +
41 +Regular builds would always return false here, anyway, as linux isn't a
42 +priority with these things.
43 +
44 +/var/tmp/portage/net-im/telegram-desktop-4.3.4/work/tdesktop-4.3.4-full/Telegram/SourceFiles/boxes/translate_box.cpp:18:10: fatal error: spellcheck/platform/platform_language.h: No such file or directory
45 + 18 | #include "spellcheck/platform/platform_language.h"
46 + | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47 +compilation terminated.
48 +
49 +--- tdesktop-4.3.4-full.orig/Telegram/SourceFiles/boxes/translate_box.cpp
50 ++++ tdesktop-4.3.4-full/Telegram/SourceFiles/boxes/translate_box.cpp
51 +@@ -15,7 +15,9 @@
52 + #include "main/main_session.h"
53 + #include "mtproto/sender.h"
54 + #include "settings/settings_common.h"
55 ++#ifndef TDESKTOP_DISABLE_SPELLCHECK
56 + #include "spellcheck/platform/platform_language.h"
57 ++#endif
58 + #include "ui/effects/loading_element.h"
59 + #include "ui/layers/generic_box.h"
60 + #include "ui/widgets/buttons.h"
61 +@@ -331,6 +333,7 @@
62 + if (!hasLetters) {
63 + return true;
64 + }
65 ++#ifndef TDESKTOP_DISABLE_SPELLCHECK
66 + const auto result = Platform::Language::Recognize(text);
67 + if (result.unknown) {
68 + return false;
69 +@@ -343,6 +346,9 @@
70 + ? QLocale::English
71 + : settingsLang;
72 + return (result.locale.language() == skip);
73 ++#else
74 ++ return false;
75 ++#endif
76 + }
77 +
78 + } // namespace Ui
79
80 diff --git a/net-im/telegram-desktop/files/tdesktop-4.3.4-qt5-incompatibility-1.patch b/net-im/telegram-desktop/files/tdesktop-4.3.4-qt5-incompatibility-1.patch
81 new file mode 100644
82 index 000000000000..3229b5be54c8
83 --- /dev/null
84 +++ b/net-im/telegram-desktop/files/tdesktop-4.3.4-qt5-incompatibility-1.patch
85 @@ -0,0 +1,42 @@
86 +Disable portal-related event loop with qt5
87 +
88 +QEventLoop::ApplicationExec is undocumented, but only present in qt6, so I have
89 +no idea if the functionality can be preserved in qt5. Upstream code indicates
90 +that not using it at all is safe, and unlikely to cause problems in
91 +distribution packaging.
92 +
93 +Yet another reminder that qt5 is dying.
94 +
95 +/var/tmp/portage/net-im/telegram-desktop-4.3.4/work/tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp: In lambda function:
96 +/var/tmp/portage/net-im/telegram-desktop-4.3.4/work/tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp:294:55: error: ‘ApplicationExec’ is not a member of ‘QEventLoop’
97 + 294 | loop.exec(QEventLoop::ApplicationExec);
98 + | ^~~~~~~~~~~~~~~
99 +
100 +--- tdesktop-4.3.4-full.orig/Telegram/SourceFiles/platform/linux/specific_linux.cpp
101 ++++ tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp
102 +@@ -229,6 +229,7 @@
103 + }
104 + }
105 +
106 ++#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
107 + void LaunchGApplication() {
108 + const auto connection = [] {
109 + try {
110 +@@ -401,6 +402,7 @@
111 + });
112 + }
113 + }
114 ++#endif // QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
115 +
116 + bool GenerateDesktopFile(
117 + const QString &targetPath,
118 +@@ -862,7 +864,9 @@
119 + LOG(("Fallback icon theme: %1").arg(QIcon::fallbackThemeName()));
120 +
121 + #ifndef DESKTOP_APP_DISABLE_DBUS_INTEGRATION
122 ++#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
123 + LaunchGApplication();
124 ++#endif // QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
125 + #endif // !DESKTOP_APP_DISABLE_DBUS_INTEGRATION
126 + }
127 +
128
129 diff --git a/net-im/telegram-desktop/files/tdesktop-4.3.4-qt5-incompatibility-2.patch b/net-im/telegram-desktop/files/tdesktop-4.3.4-qt5-incompatibility-2.patch
130 new file mode 100644
131 index 000000000000..ae5c84763c8d
132 --- /dev/null
133 +++ b/net-im/telegram-desktop/files/tdesktop-4.3.4-qt5-incompatibility-2.patch
134 @@ -0,0 +1,28 @@
135 +Disable unused incompatible overload with qt5
136 +
137 +Neither Qt nore C++ are my forte, but this code is unused with the packaged
138 +distro version, anyway.
139 +
140 +/var/tmp/portage/net-im/telegram-desktop-4.3.4/work/tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp: In lambda function:
141 +/var/tmp/portage/net-im/telegram-desktop-4.3.4/work/tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp:705:74: error: call of overloaded ‘arg(QByteArray&)’ is ambiguous
142 + 705 | return qsl("org.telegram.desktop.%1.desktop").arg(md5Hash);
143 + | ^
144 +
145 +--- tdesktop-4.3.4-full.orig/Telegram/SourceFiles/platform/linux/specific_linux.cpp
146 ++++ tdesktop-4.3.4-full/Telegram/SourceFiles/platform/linux/specific_linux.cpp
147 +@@ -692,6 +692,7 @@
148 + + qsl(".desktop");
149 + }
150 +
151 ++#if !(defined(TDESKTOP_DISABLE_AUTOUPDATE) && QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
152 + if (!Core::UpdaterDisabled()) {
153 + QByteArray md5Hash(h);
154 + if (!Launcher::Instance().customWorkingDir()) {
155 +@@ -706,6 +707,7 @@
156 +
157 + return qsl("org.telegram.desktop.%1.desktop").arg(md5Hash);
158 + }
159 ++#endif // !(defined(TDESKTOP_DISABLE_AUTOUPDATE) && QT_VERSION < QT_VERSION_CHECK(6, 2, 0))
160 +
161 + return qsl("org.telegram.desktop.desktop");
162 + }());
163
164 diff --git a/net-im/telegram-desktop/telegram-desktop-4.3.4.ebuild b/net-im/telegram-desktop/telegram-desktop-4.3.4.ebuild
165 new file mode 100644
166 index 000000000000..2f1d55aaabb3
167 --- /dev/null
168 +++ b/net-im/telegram-desktop/telegram-desktop-4.3.4.ebuild
169 @@ -0,0 +1,206 @@
170 +# Copyright 2020-2022 Gentoo Authors
171 +# Distributed under the terms of the GNU General Public License v2
172 +
173 +EAPI=8
174 +
175 +PYTHON_COMPAT=( python3_{8..11} )
176 +
177 +inherit xdg cmake python-any-r1 optfeature
178 +
179 +DESCRIPTION="Official desktop client for Telegram"
180 +HOMEPAGE="https://desktop.telegram.org"
181 +
182 +MY_P="tdesktop-${PV}-full"
183 +SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz"
184 +S="${WORKDIR}/${MY_P}"
185 +
186 +LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+"
187 +SLOT="0"
188 +KEYWORDS="~amd64 ~arm64 ~ppc64 ~riscv"
189 +IUSE="+dbus enchant +fonts +hunspell +jemalloc screencast +spell qt6 qt6-imageformats wayland +X"
190 +REQUIRED_USE="
191 + spell? (
192 + ^^ ( enchant hunspell )
193 + )
194 + qt6-imageformats? ( qt6 )
195 +"
196 +
197 +KIMAGEFORMATS_RDEPEND="
198 + media-libs/libavif:=
199 + media-libs/libheif:=
200 + media-libs/libjxl
201 +"
202 +RDEPEND="
203 + !net-im/telegram-desktop-bin
204 + app-arch/lz4:=
205 + dev-cpp/abseil-cpp:=
206 + dev-libs/glib:2
207 + dev-libs/libdispatch
208 + dev-libs/libsigc++:2
209 + dev-libs/openssl:=
210 + dev-libs/xxhash
211 + media-libs/fontconfig:=
212 + media-libs/libjpeg-turbo:=
213 + ~media-libs/libtgvoip-2.4.4_p20220503
214 + media-libs/openal
215 + media-libs/opus:=
216 + media-libs/rnnoise
217 + ~media-libs/tg_owt-0_pre20220507:=[screencast=,X=]
218 + media-video/ffmpeg:=[opus]
219 + sys-libs/zlib:=[minizip]
220 + x11-libs/xcb-util-keysyms
221 + virtual/opengl
222 + dbus? ( dev-cpp/glibmm:2.68 )
223 + enchant? ( app-text/enchant:= )
224 + hunspell? ( >=app-text/hunspell-1.7:= )
225 + jemalloc? ( dev-libs/jemalloc:=[-lazy-lock] )
226 + !qt6? (
227 + >=dev-qt/qtcore-5.15:5
228 + >=dev-qt/qtgui-5.15:5[dbus?,jpeg,png,wayland?,X?]
229 + >=dev-qt/qtimageformats-5.15:5
230 + >=dev-qt/qtnetwork-5.15:5[ssl]
231 + >=dev-qt/qtsvg-5.15:5
232 + >=dev-qt/qtwidgets-5.15:5[png,X?]
233 + kde-frameworks/kcoreaddons:=
234 + )
235 + qt6? (
236 + dev-qt/qt5compat:6
237 + dev-qt/qtbase:6[dbus?,gui,network,opengl,widgets,X?]
238 + dev-qt/qtimageformats:6
239 + dev-qt/qtsvg:6
240 + wayland? ( dev-qt/qtwayland:6 )
241 + qt6-imageformats? ( ${KIMAGEFORMATS_RDEPEND} )
242 + )
243 + X? ( x11-libs/libxcb:= )
244 +"
245 +DEPEND="${RDEPEND}
246 + dev-cpp/range-v3
247 + =dev-cpp/ms-gsl-3*
248 +"
249 +BDEPEND="
250 + ${PYTHON_DEPS}
251 + >=dev-util/cmake-3.16
252 + virtual/pkgconfig
253 +"
254 +# dev-libs/jemalloc:=[-lazy-lock] -> https://bugs.gentoo.org/803233
255 +
256 +PATCHES=(
257 + "${FILESDIR}/tdesktop-4.2.4-jemalloc-only-telegram.patch"
258 + "${FILESDIR}/tdesktop-3.3.0-fix-enchant.patch"
259 + "${FILESDIR}/tdesktop-4.3.4-fix-disabling-spellcheck.patch"
260 + "${FILESDIR}/tdesktop-4.3.4-qt5-incompatibility-1.patch"
261 + "${FILESDIR}/tdesktop-4.3.4-qt5-incompatibility-2.patch"
262 +)
263 +
264 +# Current desktop-file-utils-0.26 does not understand Version=1.5
265 +QA_DESKTOP_FILE="usr/share/applications/${PN}.desktop"
266 +
267 +pkg_pretend() {
268 + if has ccache ${FEATURES}; then
269 + ewarn "ccache does not work with ${PN} out of the box"
270 + ewarn "due to usage of precompiled headers"
271 + ewarn "check bug https://bugs.gentoo.org/715114 for more info"
272 + ewarn
273 + fi
274 +}
275 +
276 +src_prepare() {
277 + # Bundle kde-frameworks/kimageformats for qt6, since it's impossible to
278 + # build in gentoo right now.
279 + if use qt6-imageformats; then
280 + sed -e 's/DESKTOP_APP_USE_PACKAGED_LAZY/TRUE/' -i \
281 + cmake/external/kimageformats/CMakeLists.txt || die
282 + printf "%s\n" \
283 + 'Q_IMPORT_PLUGIN(QAVIFPlugin)' \
284 + 'Q_IMPORT_PLUGIN(HEIFPlugin)' \
285 + 'Q_IMPORT_PLUGIN(QJpegXLPlugin)' \
286 + >> cmake/external/qt/qt_static_plugins/qt_static_plugins.cpp || die
287 + fi
288 +
289 + # kde-frameworks/kcoreaddons is bundled when using qt6, see:
290 + # cmake/external/kcoreaddons/CMakeLists.txt
291 +
292 + cmake_src_prepare
293 +}
294 +
295 +src_configure() {
296 + local mycmakeargs=(
297 + -DCMAKE_DISABLE_FIND_PACKAGE_tl-expected=ON # header only lib, some git version. prevents warnings.
298 + -DQT_VERSION_MAJOR=$(usex qt6 6 5)
299 +
300 + -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=$(usex !dbus)
301 + -DDESKTOP_APP_DISABLE_X11_INTEGRATION=$(usex !X)
302 + -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=$(usex !wayland)
303 + -DDESKTOP_APP_DISABLE_JEMALLOC=$(usex !jemalloc)
304 + -DDESKTOP_APP_DISABLE_SPELLCHECK=$(usex !spell) # enables hunspell (recommended)
305 + -DDESKTOP_APP_USE_ENCHANT=$(usex enchant) # enables enchant and disables hunspell
306 + -DDESKTOP_APP_USE_PACKAGED_FONTS=$(usex !fonts) # use system fonts instead of bundled ones
307 + )
308 +
309 + if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
310 + einfo "Found custom API credentials"
311 + mycmakeargs+=(
312 + -DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
313 + -DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
314 + )
315 + else
316 + # https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml
317 + # Building with snapcraft API credentials by default
318 + # Custom API credentials can be obtained here:
319 + # https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md
320 + # After getting credentials you can export variables:
321 + # export MY_TDESKTOP_API_ID="17349""
322 + # export MY_TDESKTOP_API_HASH="344583e45741c457fe1862106095a5eb"
323 + # and restart the build"
324 + # you can set above variables (without export) in /etc/portage/env/net-im/telegram-desktop
325 + # portage will use custom variable every build automatically
326 + mycmakeargs+=(
327 + -DTDESKTOP_API_ID="611335"
328 + -DTDESKTOP_API_HASH="d524b414d21f4d37f08684c1df41ac9c"
329 + )
330 + fi
331 +
332 + cmake_src_configure
333 +}
334 +
335 +pkg_postinst() {
336 + xdg_pkg_postinst
337 + if ! use X && ! use screencast; then
338 + ewarn "both the 'X' and 'screencast' USE flags are disabled, screen sharing won't work!"
339 + ewarn
340 + fi
341 + if has_version '<dev-qt/qtcore-5.15.2-r10'; then
342 + ewarn "Versions of dev-qt/qtcore lower than 5.15.2-r10 might cause telegram"
343 + ewarn "to crash when pasting big images from the clipboard."
344 + ewarn
345 + fi
346 + if ! use jemalloc && use elibc_glibc; then
347 + # https://github.com/telegramdesktop/tdesktop/issues/16084
348 + # https://github.com/desktop-app/cmake_helpers/pull/91#issuecomment-881788003
349 + ewarn "Disabling USE=jemalloc on glibc systems may cause very high RAM usage!"
350 + ewarn "Do NOT report issues about RAM usage without enabling this flag first."
351 + ewarn
352 + fi
353 + if use qt6; then
354 + ewarn "Qt6 support in gentoo is experimental."
355 + ewarn "Please report any issues you may find, but don't expect"
356 + ewarn "everything to work correctly as of yet."
357 + ewarn
358 + fi
359 + if use wayland && ! use qt6; then
360 + ewarn "Wayland-specific integrations have been deprecated with Qt5."
361 + ewarn "The app will continue to function under wayland, but some"
362 + ewarn "functionality may be reduced."
363 + ewarn "These integrations are only supported when built with Qt6."
364 + ewarn
365 + fi
366 + if use qt6 && ! use qt6-imageformats; then
367 + elog "Enable USE=qt6-imageformats for AVIF, HEIF and JpegXL support"
368 + elog
369 + fi
370 + optfeature_header
371 + optfeature "shop payment support (requires USE=dbus enabled)" net-libs/webkit-gtk:4
372 + if ! use qt6; then
373 + optfeature "AVIF, HEIF and JpegXL image support" kde-frameworks/kimageformats[avif,heif,jpegxl]
374 + fi
375 +}