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: Fri, 24 Sep 2021 17:33:45
Message-Id: 1632504800.6db826e810332e5e040e943836eddd79db7d0ee9.gyakovlev@gentoo
1 commit: 6db826e810332e5e040e943836eddd79db7d0ee9
2 Author: Esteve Varela Colominas <esteve.varela <AT> gmail <DOT> com>
3 AuthorDate: Mon Sep 20 17:03:54 2021 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Fri Sep 24 17:33:20 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6db826e8
7
8 net-im/telegram-desktop: Bump to 3.1.0
9
10 Also fix openssl3 compilation error in this new version.
11 Won't backport fixes, by the time openssl3 goes stable these will be
12 phased out anyway...
13
14 Signed-off-by: Esteve Varela Colominas <esteve.varela <AT> gmail.com>
15 Closes: https://github.com/gentoo/gentoo/pull/22342
16 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
17
18 net-im/telegram-desktop/Manifest | 1 +
19 .../files/tdesktop-3.1.0-fix-openssl3.patch | 19 +++
20 .../tdesktop-3.1.0-jemalloc-only-telegram.patch | 35 +++++
21 .../telegram-desktop/telegram-desktop-3.1.0.ebuild | 146 +++++++++++++++++++++
22 4 files changed, 201 insertions(+)
23
24 diff --git a/net-im/telegram-desktop/Manifest b/net-im/telegram-desktop/Manifest
25 index f2bd8bdf9dc..857e615c8ce 100644
26 --- a/net-im/telegram-desktop/Manifest
27 +++ b/net-im/telegram-desktop/Manifest
28 @@ -1,2 +1,3 @@
29 DIST tdesktop-2.9.3-full.tar.gz 37335782 BLAKE2B 197583ba6568c455218c51f590c1ba1a3f10c390caa4fd03657098f499ce113a4f5f57ca9dd53bc4baba31992d4229768ed35e68ad6b0685010bc335817edcac SHA512 810cfac5d7e6ce9413b1b2406927e89c1383ea5b725233a68b2cb29dd374b4c3386c22186640afde4492c844516c88889a5db8e5b167a09d6d6c1270ac965ac4
30 DIST tdesktop-3.0.1-full.tar.gz 37531917 BLAKE2B c139501f23c742f76d4acd43def69963413ffafef1be584f13d7359b3c20625def7ec283a981556c795aa4dc5ad2e117e1f8aada28cd4815f66f02510e607435 SHA512 6bff6be5f2c0c7a17df61dccc5a3216dcbb95a1c6d3176442c530e2c1b525e6d15079b230d40751f20684da2a1067d4518a9a1ab90d49d1a7338d3e05239d447
31 +DIST tdesktop-3.1.0-full.tar.gz 38465279 BLAKE2B c9442507d3ec6f6e36e68d44ec86a9c1dfb864498ee90eef5f50b12482de4e1c93256352fc21bf997c38cda0dfce03f53776c47afe1a3066b109c1675ffc8749 SHA512 7fbb5722917c482aed820154e425642c4a3c7649defebae7076e48ac25da8744933877b70539d5cd6952e9f80493ccc5f144bf2c0c01083bade3473f00a23ec4
32
33 diff --git a/net-im/telegram-desktop/files/tdesktop-3.1.0-fix-openssl3.patch b/net-im/telegram-desktop/files/tdesktop-3.1.0-fix-openssl3.patch
34 new file mode 100644
35 index 00000000000..2b92e8adce4
36 --- /dev/null
37 +++ b/net-im/telegram-desktop/files/tdesktop-3.1.0-fix-openssl3.patch
38 @@ -0,0 +1,19 @@
39 +Fix openssl 3.x compatibility
40 +
41 +FIPS_mode_set was merely used to clean up resources. This isn't necessary
42 +anymore on the newer openssl version.
43 +
44 +There's still a lot of functions that are used that were deprecated. I hope
45 +upstream can fix those, as I'm unsure what to do with them.
46 +
47 +--- tdesktop-3.1.0-full.orig/Telegram/SourceFiles/core/utils.cpp
48 ++++ tdesktop-3.1.0-full/Telegram/SourceFiles/core/utils.cpp
49 +@@ -124,7 +124,7 @@
50 +
51 + void finish() {
52 + CRYPTO_cleanup_all_ex_data();
53 +-#ifndef LIBRESSL_VERSION_NUMBER
54 ++#if !defined(LIBRESSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x20000000L
55 + FIPS_mode_set(0);
56 + #endif
57 + ENGINE_cleanup();
58
59 diff --git a/net-im/telegram-desktop/files/tdesktop-3.1.0-jemalloc-only-telegram.patch b/net-im/telegram-desktop/files/tdesktop-3.1.0-jemalloc-only-telegram.patch
60 new file mode 100644
61 index 00000000000..7ad3e75e49b
62 --- /dev/null
63 +++ b/net-im/telegram-desktop/files/tdesktop-3.1.0-jemalloc-only-telegram.patch
64 @@ -0,0 +1,35 @@
65 +Only link jemalloc for the Telegram binary
66 +
67 +Some combination of factors is making the different codegen tools hang when
68 +jemalloc is linked for those, and they're ran under portage's sandbox. Since
69 +this is only used during build-time, and jemalloc is merely necessary to
70 +improve runtime memory use, it's unnecessary to use it for anything else.
71 +
72 +--- tdesktop-3.1.0-full.orig/Telegram/CMakeLists.txt
73 ++++ tdesktop-3.1.0-full/Telegram/CMakeLists.txt
74 +@@ -1256,6 +1256,11 @@
75 + endif()
76 + endif()
77 + else()
78 ++ target_link_libraries(Telegram
79 ++ PRIVATE
80 ++ desktop-app::external_jemalloc
81 ++ )
82 ++
83 + if (NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION)
84 + target_link_libraries(Telegram
85 + PRIVATE
86 +--- tdesktop-3.1.0-full.orig/cmake/options_linux.cmake
87 ++++ tdesktop-3.1.0-full/cmake/options_linux.cmake
88 +@@ -45,11 +45,6 @@
89 + target_link_options(common_options INTERFACE $<IF:$<CONFIG:Debug>,,-g -flto -fuse-linker-plugin>)
90 + endif()
91 +
92 +-target_link_libraries(common_options
93 +-INTERFACE
94 +- desktop-app::external_jemalloc
95 +-)
96 +-
97 + if (DESKTOP_APP_USE_ALLOCATION_TRACER)
98 + target_link_options(common_options
99 + INTERFACE
100
101 diff --git a/net-im/telegram-desktop/telegram-desktop-3.1.0.ebuild b/net-im/telegram-desktop/telegram-desktop-3.1.0.ebuild
102 new file mode 100644
103 index 00000000000..675c8aefaa4
104 --- /dev/null
105 +++ b/net-im/telegram-desktop/telegram-desktop-3.1.0.ebuild
106 @@ -0,0 +1,146 @@
107 +# Copyright 2020-2021 Gentoo Authors
108 +# Distributed under the terms of the GNU General Public License v2
109 +
110 +EAPI=7
111 +
112 +PYTHON_COMPAT=( python3_{7..10} )
113 +
114 +inherit xdg cmake python-any-r1 flag-o-matic
115 +
116 +DESCRIPTION="Official desktop client for Telegram"
117 +HOMEPAGE="https://desktop.telegram.org"
118 +
119 +MY_P="tdesktop-${PV}-full"
120 +SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz"
121 +
122 +LICENSE="BSD GPL-3-with-openssl-exception LGPL-2+"
123 +SLOT="0"
124 +KEYWORDS="~amd64 ~ppc64"
125 +IUSE="+dbus enchant +hunspell screencast +spell wayland webkit +X"
126 +REQUIRED_USE="
127 + spell? (
128 + ^^ ( enchant hunspell )
129 + )
130 + webkit? ( dbus )
131 +"
132 +
133 +RDEPEND="
134 + !net-im/telegram-desktop-bin
135 + app-arch/lz4:=
136 + dev-cpp/abseil-cpp:=
137 + dev-libs/jemalloc:=[-lazy-lock]
138 + dev-libs/openssl:=
139 + dev-libs/xxhash
140 + >=dev-qt/qtcore-5.15:5
141 + >=dev-qt/qtgui-5.15:5[dbus?,jpeg,png,wayland?,X?]
142 + >=dev-qt/qtimageformats-5.15:5
143 + >=dev-qt/qtnetwork-5.15:5[ssl]
144 + >=dev-qt/qtsvg-5.15:5
145 + >=dev-qt/qtwidgets-5.15:5[png,X?]
146 + media-fonts/open-sans
147 + media-libs/fontconfig:=
148 + ~media-libs/libtgvoip-2.4.4_p20210302
149 + >=media-libs/libtgvoip-2.4.4_p20210302-r2
150 + media-libs/openal
151 + media-libs/opus:=
152 + media-libs/rnnoise
153 + ~media-libs/tg_owt-0_pre20210914[screencast=,X=]
154 + media-video/ffmpeg:=[opus]
155 + sys-libs/zlib:=[minizip]
156 + dbus? (
157 + dev-cpp/glibmm:2
158 + dev-qt/qtdbus:5
159 + dev-libs/libdbusmenu-qt[qt5(+)]
160 + )
161 + enchant? ( app-text/enchant:= )
162 + hunspell? ( >=app-text/hunspell-1.7:= )
163 + wayland? ( kde-frameworks/kwayland:= )
164 + webkit? ( net-libs/webkit-gtk:= )
165 + X? ( x11-libs/libxcb:= )
166 +"
167 +DEPEND="${RDEPEND}
168 + dev-cpp/range-v3
169 + =dev-cpp/ms-gsl-3*
170 +"
171 +BDEPEND="
172 + ${PYTHON_DEPS}
173 + >=dev-util/cmake-3.16
174 + virtual/pkgconfig
175 +"
176 +# dev-libs/jemalloc:=[-lazy-lock] -> https://bugs.gentoo.org/803233
177 +
178 +S="${WORKDIR}/${MY_P}"
179 +
180 +PATCHES=(
181 + "${FILESDIR}/tdesktop-3.1.0-jemalloc-only-telegram.patch"
182 + "${FILESDIR}/tdesktop-3.1.0-fix-openssl3.patch"
183 +)
184 +
185 +pkg_pretend() {
186 + if has ccache ${FEATURES}; then
187 + ewarn
188 + ewarn "ccache does not work with ${PN} out of the box"
189 + ewarn "due to usage of precompiled headers"
190 + ewarn "check bug https://bugs.gentoo.org/715114 for more info"
191 + ewarn
192 + fi
193 +}
194 +
195 +src_prepare() {
196 + # no explicit toggle, doesn't build with the system one #752417
197 + sed -i 's/DESKTOP_APP_USE_PACKAGED/NO_ONE_WILL_EVER_SET_THIS/' \
198 + cmake/external/rlottie/CMakeLists.txt || die
199 +
200 + cmake_src_prepare
201 +}
202 +
203 +src_configure() {
204 + # gtk is really needed for image copy-paste due to https://bugreports.qt.io/browse/QTBUG-56595
205 + local mycmakeargs=(
206 + -DTDESKTOP_LAUNCHER_BASENAME="${PN}"
207 + -DCMAKE_DISABLE_FIND_PACKAGE_tl-expected=ON # header only lib, some git version. prevents warnings.
208 +
209 + -DDESKTOP_APP_DISABLE_X11_INTEGRATION=$(usex X no yes)
210 + -DDESKTOP_APP_DISABLE_WAYLAND_INTEGRATION=$(usex wayland no yes)
211 + -DDESKTOP_APP_DISABLE_DBUS_INTEGRATION=$(usex dbus no yes)
212 + -DDESKTOP_APP_DISABLE_WEBKITGTK=$(usex webkit no yes)
213 + -DDESKTOP_APP_DISABLE_SPELLCHECK=$(usex spell no yes) # enables hunspell (recommended)
214 + -DDESKTOP_APP_USE_ENCHANT=$(usex enchant) # enables enchant and disables hunspell
215 + )
216 +
217 + if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
218 + einfo "Found custom API credentials"
219 + mycmakeargs+=(
220 + -DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
221 + -DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
222 + )
223 + else
224 + # https://github.com/telegramdesktop/tdesktop/blob/dev/snap/snapcraft.yaml
225 + # Building with snapcraft API credentials by default
226 + # Custom API credentials can be obtained here:
227 + # https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md
228 + # After getting credentials you can export variables:
229 + # export MY_TDESKTOP_API_ID="17349""
230 + # export MY_TDESKTOP_API_HASH="344583e45741c457fe1862106095a5eb"
231 + # and restart the build"
232 + # you can set above variables (without export) in /etc/portage/env/net-im/telegram-desktop
233 + # portage will use custom variable every build automatically
234 + mycmakeargs+=(
235 + -DTDESKTOP_API_ID="611335"
236 + -DTDESKTOP_API_HASH="d524b414d21f4d37f08684c1df41ac9c"
237 + )
238 + fi
239 +
240 + cmake_src_configure
241 +}
242 +
243 +pkg_postinst() {
244 + xdg_pkg_postinst
245 + if ! use X && ! use screencast; then
246 + elog "both the 'X' and 'screencast' useflags are disabled, screen sharing won't work!"
247 + fi
248 + if has_version '<dev-qt/qtcore-5.15.2-r10'; then
249 + ewarn "Versions of dev-qt/qtcore lower than 5.15.2-r10 might cause telegram"
250 + ewarn "to crash when pasting big images from the clipboard."
251 + fi
252 +}