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: Sat, 25 Jan 2020 10:32:59
Message-Id: 1579948328.4cf52650cf5f437a1c845283e1121a251b7083e4.gyakovlev@gentoo
1 commit: 4cf52650cf5f437a1c845283e1121a251b7083e4
2 Author: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jan 25 10:05:41 2020 +0000
4 Commit: Georgy Yakovlev <gyakovlev <AT> gentoo <DOT> org>
5 CommitDate: Sat Jan 25 10:32:08 2020 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4cf52650
7
8 net-im/telegram-desktop: new package, source version
9
10 should work on musl as well
11
12 Package-Manager: Portage-2.3.85, Repoman-2.3.20
13 Signed-off-by: Georgy Yakovlev <gyakovlev <AT> gentoo.org>
14
15 net-im/telegram-desktop/Manifest | 1 +
16 .../files/0002-PPC-big-endian.patch | 25 ++++
17 .../telegram-desktop/files/0003-PPC-config.patch | 28 ++++
18 net-im/telegram-desktop/files/musl.patch | 12 ++
19 net-im/telegram-desktop/metadata.xml | 11 ++
20 .../telegram-desktop/telegram-desktop-1.9.8.ebuild | 142 +++++++++++++++++++++
21 6 files changed, 219 insertions(+)
22
23 diff --git a/net-im/telegram-desktop/Manifest b/net-im/telegram-desktop/Manifest
24 new file mode 100644
25 index 00000000000..33d52dd8916
26 --- /dev/null
27 +++ b/net-im/telegram-desktop/Manifest
28 @@ -0,0 +1 @@
29 +DIST tdesktop-1.9.8-full.tar.gz 25225784 BLAKE2B d938dc5d82740f93c575f621697e4bae430dc045c18437957bead6cc949ad0643b0422d8fd2a1695af921ea7f259ca323094a4a7821855d842edfaf4f328c840 SHA512 5562eb99812a8faec74fe073323d6e04e36311c1e4ce984035212ecfed8bd5d12df92cd0f0022401201136315fb5556971b267b4bf47edf4eeddc9926c7969dc
30
31 diff --git a/net-im/telegram-desktop/files/0002-PPC-big-endian.patch b/net-im/telegram-desktop/files/0002-PPC-big-endian.patch
32 new file mode 100644
33 index 00000000000..b1af3deb587
34 --- /dev/null
35 +++ b/net-im/telegram-desktop/files/0002-PPC-big-endian.patch
36 @@ -0,0 +1,25 @@
37 +From d4c11502175e2a7821dbd92e029a90d54498e3e8 Mon Sep 17 00:00:00 2001
38 +From: John Zimmermann <johnz@××××××.net>
39 +Date: Thu, 2 Jan 2020 12:57:33 +0100
40 +Subject: [PATCH] PPC big endian
41 +
42 +---
43 + Telegram/SourceFiles/config.h | 2 +-
44 + 1 file changed, 1 insertion(+), 1 deletion(-)
45 +
46 +diff --git Telegram/SourceFiles/config.h Telegram/SourceFiles/config.h
47 +index fb7b54e4d..6a873fbd7 100644
48 +--- a/Telegram/SourceFiles/config.h
49 ++++ b/Telegram/SourceFiles/config.h
50 +@@ -177,7 +177,7 @@ constexpr auto ApiHash = "344583e45741c457fe1862106095a5eb";
51 + #endif // TDESKTOP_API_ID && TDESKTOP_API_HASH
52 +
53 + #if Q_BYTE_ORDER == Q_BIG_ENDIAN
54 +-#error "Only little endian is supported!"
55 ++#warning "Only little endian is supported!"
56 + #endif // Q_BYTE_ORDER == Q_BIG_ENDIAN
57 +
58 + #if (TDESKTOP_ALPHA_VERSION != 0)
59 +--
60 +2.24.1
61 +
62
63 diff --git a/net-im/telegram-desktop/files/0003-PPC-config.patch b/net-im/telegram-desktop/files/0003-PPC-config.patch
64 new file mode 100644
65 index 00000000000..95b7b639d58
66 --- /dev/null
67 +++ b/net-im/telegram-desktop/files/0003-PPC-config.patch
68 @@ -0,0 +1,28 @@
69 +From af5f8d19f0fdded987beee4568f02cc8dcbd20f4 Mon Sep 17 00:00:00 2001
70 +From: John Zimmermann <johnz@××××××.net>
71 +Date: Thu, 2 Jan 2020 12:58:45 +0100
72 +Subject: [PATCH] PPC config
73 +
74 +---
75 + base/build_config.h | 4 ++--
76 + 1 file changed, 2 insertions(+), 2 deletions(-)
77 +
78 +diff --git Telegram/lib_base/base/build_config.h Telegram/lib_base/base/build_config.h
79 +index a02c9b0..b3f4860 100644
80 +--- a/Telegram/lib_base/base/build_config.h
81 ++++ b/Telegram/lib_base/base/build_config.h
82 +@@ -46,9 +46,9 @@
83 + #define ARCH_CPU_X86_FAMILY 1
84 + #define ARCH_CPU_X86 1
85 + #define ARCH_CPU_32_BITS 1
86 +-#elif defined(__aarch64__)
87 ++#elif defined(__aarch64__) || defined(__powerpc64__)
88 + #define ARCH_CPU_64_BITS 1
89 +-#elif defined(_M_ARM) || defined(__arm__)
90 ++#elif defined(_M_ARM) || defined(__arm__) || defined(__powerpc__)
91 + #define ARCH_CPU_32_BITS 1
92 + #else
93 + #error Please add support for your architecture in base/build_config.h
94 +--
95 +2.24.1
96 +
97
98 diff --git a/net-im/telegram-desktop/files/musl.patch b/net-im/telegram-desktop/files/musl.patch
99 new file mode 100644
100 index 00000000000..dece8ec216f
101 --- /dev/null
102 +++ b/net-im/telegram-desktop/files/musl.patch
103 @@ -0,0 +1,12 @@
104 +Should send this one upstream; it would work with glibc as well.
105 +
106 +--- tdesktop-1.9.6-full/Telegram/ThirdParty/libtgvoip/os/linux/AudioPulse.cpp.old 2020-01-21 12:16:27.000000000 +0000
107 ++++ tdesktop-1.9.6-full/Telegram/ThirdParty/libtgvoip/os/linux/AudioPulse.cpp 2020-01-22 17:44:42.185530350 +0000
108 +@@ -6,6 +6,7 @@
109 +
110 + #include "AudioPulse.h"
111 + #include <dlfcn.h>
112 ++#include <libgen.h>
113 + #include "../../logging.h"
114 +
115 + #define DECLARE_DL_FUNCTION(name) typeof(name)* AudioPulse::_import_##name=NULL
116
117 diff --git a/net-im/telegram-desktop/metadata.xml b/net-im/telegram-desktop/metadata.xml
118 new file mode 100644
119 index 00000000000..36b8a035d4c
120 --- /dev/null
121 +++ b/net-im/telegram-desktop/metadata.xml
122 @@ -0,0 +1,11 @@
123 +<?xml version="1.0" encoding="UTF-8"?>
124 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
125 +<pkgmetadata>
126 + <maintainer type="person">
127 + <email>gyakovlev@g.o</email>
128 + <name>Georgy Yakovlev</name>
129 + </maintainer>
130 + <use>
131 + <flag name="gtk3">Enable GTK3 integration (tray, theme, filepicker, etc)</flag>
132 + </use>
133 +</pkgmetadata>
134
135 diff --git a/net-im/telegram-desktop/telegram-desktop-1.9.8.ebuild b/net-im/telegram-desktop/telegram-desktop-1.9.8.ebuild
136 new file mode 100644
137 index 00000000000..a5baf8e9c57
138 --- /dev/null
139 +++ b/net-im/telegram-desktop/telegram-desktop-1.9.8.ebuild
140 @@ -0,0 +1,142 @@
141 +# Copyright 2020 Gentoo Authors
142 +# Distributed under the terms of the GNU General Public License v2
143 +
144 +EAPI=7
145 +
146 +PYTHON_COMPAT=( python3_{6,7} )
147 +
148 +inherit cmake desktop flag-o-matic python-any-r1 xdg-utils
149 +
150 +MY_P="tdesktop-${PV}-full"
151 +
152 +DESCRIPTION="Official desktop client for Telegram"
153 +HOMEPAGE="https://desktop.telegram.org"
154 +SRC_URI="https://github.com/telegramdesktop/tdesktop/releases/download/v${PV}/${MY_P}.tar.gz"
155 +
156 +LICENSE="GPL-3-with-openssl-exception Unlicense"
157 +SLOT="0"
158 +KEYWORDS="~amd64 ~ppc64"
159 +IUSE="dbus gtk3 spell"
160 +
161 +RDEPEND="!net-im/telegram-desktop-bin
162 + app-arch/lz4
163 + app-arch/xz-utils
164 + dev-libs/openssl:0
165 + dev-libs/xxhash
166 + dev-qt/qtcore:5
167 + dev-qt/qtgui:5[png,X(-)]
168 + dev-qt/qtimageformats:5
169 + dev-qt/qtnetwork:5
170 + dev-qt/qtwidgets:5[png,X(-)]
171 + media-libs/openal[pulseaudio]
172 + media-libs/opus
173 + media-sound/pulseaudio
174 + sys-libs/zlib[minizip]
175 + virtual/ffmpeg
176 + x11-libs/libva[X,drm]
177 + x11-libs/libX11
178 + dbus? ( dev-qt/qtdbus:5 )
179 + gtk3? (
180 + dev-libs/libappindicator:3
181 + x11-libs/gtk+:3
182 + )
183 + spell? ( app-text/enchant )
184 +"
185 +
186 +DEPEND="${RDEPEND}
187 + ${PYTHON_DEPS}"
188 +
189 +BDEPEND="
190 + >=dev-util/cmake-3.16
191 + virtual/pkgconfig
192 +"
193 +
194 +PATCHES=(
195 + "${FILESDIR}/0002-PPC-big-endian.patch"
196 + "${FILESDIR}/0003-PPC-config.patch"
197 + "${FILESDIR}/musl.patch"
198 +)
199 +
200 +S="${WORKDIR}/${MY_P}"
201 +
202 +src_configure() {
203 + local mycxxflags=(
204 + -Wno-deprecated-declarations
205 + -Wno-error=deprecated-declarations
206 + -Wno-switch
207 + )
208 +
209 + append-cxxflags "${mycxxflags[@]}"
210 +
211 + local mycmakeargs=(
212 + -Ddisable_autoupdate=1
213 + -DDESKTOP_APP_DISABLE_CRASH_REPORTS=ON
214 + -DDESKTOP_APP_USE_GLIBC_WRAPS=OFF
215 + -DDESKTOP_APP_USE_PACKAGED=ON
216 + -DDESKTOP_APP_USE_PACKAGED_RLOTTIE=OFF
217 + -DTDESKTOP_DISABLE_DESKTOP_FILE_GENERATION=ON
218 + -DTDESKTOP_LAUNCHER_BASENAME="${PN}"
219 + -DTDESKTOP_USE_PACKAGED_TGVOIP=OFF
220 + -DDESKTOP_APP_DISABLE_SPELLCHECK="$(usex spell OFF ON)"
221 + -DTDESKTOP_DISABLE_GTK_INTEGRATION="$(usex gtk3 OFF ON)"
222 + -DTDESKTOP_DISABLE_DBUS_INTEGRATION="$(usex dbus OFF ON)"
223 + -DTDESKTOP_FORCE_GTK_FILE_DIALOG="$(usex gtk3)"
224 + )
225 +
226 + if [[ -n ${MY_TDESKTOP_API_ID} && -n ${MY_TDESKTOP_API_HASH} ]]; then
227 + einfo "Found custom API credentials"
228 + mycmakeargs+=(
229 + -DTDESKTOP_API_ID="${MY_TDESKTOP_API_ID}"
230 + -DTDESKTOP_API_HASH="${MY_TDESKTOP_API_HASH}"
231 + )
232 + else
233 + mycmakeargs+=( -DTDESKTOP_API_TEST=ON )
234 + ewarn
235 + ewarn "Building ${PN} with test API credentials."
236 + ewarn "Connectivity to API servers will be throttled."
237 + ewarn "To build ${PN} custom API credentials cancel build now and obtain"
238 + ewarn "credentials here: https://github.com/telegramdesktop/tdesktop/blob/dev/docs/api_credentials.md"
239 + ewarn "After getting credentials you can export variables:"
240 + ewarn "export MY_TDESKTOP_API_ID=\"17349\""
241 + ewarn "export MY_TDESKTOP_API_HASH=\"344583e45741c457fe1862106095a5eb\""
242 + ewarn "and restart the build"
243 + ewarn "you can save variables in /etc/portage/env/${CATEGORY}/${PN}"
244 + ewarn "portage will use the file every build automatically"
245 + ewarn
246 + fi
247 +
248 + cmake_src_configure
249 +}
250 +
251 +src_install() {
252 + dobin "${BUILD_DIR}/bin/${PN}"
253 +
254 + newmenu lib/xdg/telegramdesktop.desktop "${PN}.desktop"
255 +
256 + local icon_size
257 + for icon_size in 16 32 48 64 128 256 512
258 + do
259 + newicon -s ${icon_size} \
260 + Telegram/Resources/art/icon${icon_size}.png telegram.png
261 + done
262 +
263 + insinto /usr/share/appdata
264 + doins lib/xdg/telegramdesktop.appdata.xml
265 +
266 + insinto /usr/share/kservices5
267 + doins lib/xdg/tg.protocol
268 +
269 + einstalldocs
270 +}
271 +
272 +pkg_postinst() {
273 + xdg_desktop_database_update
274 + xdg_icon_cache_update
275 + xdg_mimeinfo_database_update
276 +}
277 +
278 +pkg_postrm() {
279 + xdg_desktop_database_update
280 + xdg_icon_cache_update
281 + xdg_mimeinfo_database_update
282 +}