Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: media-sound/teamspeak-client/, media-sound/teamspeak-client/files/
Date: Tue, 30 Apr 2019 16:49:58
Message-Id: 1556642975.378f1d8be411fc8f8a6dba202813c8f565a9dca0.mgorny@gentoo
1 commit: 378f1d8be411fc8f8a6dba202813c8f565a9dca0
2 Author: Denis Lisov <dennis.lissov <AT> gmail <DOT> com>
3 AuthorDate: Mon Apr 8 21:27:09 2019 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Apr 30 16:49:35 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=378f1d8b
7
8 media-sound/teamspeak-client: add workaround for Qt 5.12
9
10 QtWebEngine versions before 5.12 used to reexport a few symbols like
11 calloc with version Qt_5 that were exported by mistake once. These are
12 no longer exported in 5.12 (probably a Qt bug), and teamspeak-client
13 does not officially support it (only the bundled QtWebEngine 5.6.1 is
14 supported).
15
16 Add a `overrides.so` shared library that reexports them by taking this
17 code from Qt under (L)GPL and preload it using LD_PRELOAD to make the
18 symbols available.
19
20 Closes: https://bugs.gentoo.org/675874
21 Signed-off-by: Denis Lisov <dennis.lissov <AT> gmail.com>
22 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
23
24 ...eak-client-3.2.3-qt-5.12-symbol-reexports.patch | 141 +++++++++++++++++++++
25 .../teamspeak-client/files/ts3client-bin-r1 | 13 ++
26 .../teamspeak-client-3.2.3-r2.ebuild | 102 +++++++++++++++
27 3 files changed, 256 insertions(+)
28
29 diff --git a/media-sound/teamspeak-client/files/teamspeak-client-3.2.3-qt-5.12-symbol-reexports.patch b/media-sound/teamspeak-client/files/teamspeak-client-3.2.3-qt-5.12-symbol-reexports.patch
30 new file mode 100644
31 index 00000000000..ee5f78914d0
32 --- /dev/null
33 +++ b/media-sound/teamspeak-client/files/teamspeak-client-3.2.3-qt-5.12-symbol-reexports.patch
34 @@ -0,0 +1,141 @@
35 +diff --git a/Makefile b/Makefile
36 +new file mode 100644
37 +index 0000000..c036d5f
38 +--- /dev/null
39 ++++ b/Makefile
40 +@@ -0,0 +1,2 @@
41 ++overrides.so: qt-5.12-overrides.o override-version.map
42 ++ $(CXX) $(LDFLAGS) -shared -o $@ -Wl,--version-script override-version.map qt-5.12-overrides.o
43 +diff --git a/override-version.map b/override-version.map
44 +new file mode 100644
45 +index 0000000..991d98e
46 +--- /dev/null
47 ++++ b/override-version.map
48 +@@ -0,0 +1 @@
49 ++Qt_5 {};
50 +diff --git a/qt-5.12-overrides.cpp b/qt-5.12-overrides.cpp
51 +new file mode 100644
52 +index 0000000..002a1af
53 +--- /dev/null
54 ++++ b/qt-5.12-overrides.cpp
55 +@@ -0,0 +1,120 @@
56 ++/****************************************************************************
57 ++**
58 ++** Copyright (C) 2017 The Qt Company Ltd.
59 ++** Contact: https://www.qt.io/licensing/
60 ++**
61 ++** This file is part of the QtWebEngine module of the Qt Toolkit.
62 ++**
63 ++** $QT_BEGIN_LICENSE:LGPL$
64 ++** Commercial License Usage
65 ++** Licensees holding valid commercial Qt licenses may use this file in
66 ++** accordance with the commercial license agreement provided with the
67 ++** Software or, alternatively, in accordance with the terms contained in
68 ++** a written agreement between you and The Qt Company. For licensing terms
69 ++** and conditions see https://www.qt.io/terms-conditions. For further
70 ++** information use the contact form at https://www.qt.io/contact-us.
71 ++**
72 ++** GNU Lesser General Public License Usage
73 ++** Alternatively, this file may be used under the terms of the GNU Lesser
74 ++** General Public License version 3 as published by the Free Software
75 ++** Foundation and appearing in the file LICENSE.LGPL3 included in the
76 ++** packaging of this file. Please review the following information to
77 ++** ensure the GNU Lesser General Public License version 3 requirements
78 ++** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
79 ++**
80 ++** GNU General Public License Usage
81 ++** Alternatively, this file may be used under the terms of the GNU
82 ++** General Public License version 2.0 or (at your option) the GNU General
83 ++** Public license version 3 or any later version approved by the KDE Free
84 ++** Qt Foundation. The licenses are as published by the Free Software
85 ++** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
86 ++** included in the packaging of this file. Please review the following
87 ++** information to ensure the GNU General Public License requirements will
88 ++** be met: https://www.gnu.org/licenses/gpl-2.0.html and
89 ++** https://www.gnu.org/licenses/gpl-3.0.html.
90 ++**
91 ++** $QT_END_LICENSE$
92 ++**
93 ++****************************************************************************/
94 ++
95 ++#include <stdlib.h>
96 ++#include <malloc.h>
97 ++
98 ++#define SHIM_ALIAS_SYMBOL(fn) __attribute__((weak, alias(#fn)))
99 ++#define SHIM_SYMBOL_VERSION(fn) __asm__(".symver __" #fn "," #fn "@Qt_5")
100 ++#define SHIM_HIDDEN __attribute__ ((visibility ("hidden")))
101 ++
102 ++extern "C" {
103 ++
104 ++SHIM_SYMBOL_VERSION(malloc);
105 ++void* __malloc(size_t size)
106 ++ SHIM_ALIAS_SYMBOL(ShimMalloc);
107 ++
108 ++SHIM_SYMBOL_VERSION(free);
109 ++void __free(void* ptr)
110 ++ SHIM_ALIAS_SYMBOL(ShimFree);
111 ++
112 ++SHIM_SYMBOL_VERSION(realloc);
113 ++void* __realloc(void* ptr, size_t size)
114 ++ SHIM_ALIAS_SYMBOL(ShimRealloc);
115 ++
116 ++SHIM_SYMBOL_VERSION(calloc);
117 ++void* __calloc(size_t n, size_t size)
118 ++ SHIM_ALIAS_SYMBOL(ShimCalloc);
119 ++
120 ++SHIM_SYMBOL_VERSION(cfree);
121 ++void __cfree(void* ptr)
122 ++ SHIM_ALIAS_SYMBOL(ShimCFree);
123 ++
124 ++SHIM_SYMBOL_VERSION(memalign);
125 ++void* __memalign(size_t align, size_t s)
126 ++ SHIM_ALIAS_SYMBOL(ShimMemalign);
127 ++
128 ++SHIM_SYMBOL_VERSION(valloc);
129 ++void* __valloc(size_t size)
130 ++ SHIM_ALIAS_SYMBOL(ShimValloc);
131 ++
132 ++SHIM_SYMBOL_VERSION(pvalloc);
133 ++void* __pvalloc(size_t size)
134 ++ SHIM_ALIAS_SYMBOL(ShimPvalloc);
135 ++
136 ++SHIM_SYMBOL_VERSION(posix_memalign);
137 ++int __posix_memalign(void** r, size_t a, size_t s)
138 ++ SHIM_ALIAS_SYMBOL(ShimPosixMemalign);
139 ++
140 ++SHIM_HIDDEN void* ShimMalloc(size_t size) {
141 ++ return malloc(size);
142 ++}
143 ++
144 ++SHIM_HIDDEN void ShimFree(void* ptr) {
145 ++ free(ptr);
146 ++}
147 ++
148 ++SHIM_HIDDEN void* ShimRealloc(void* ptr, size_t size) {
149 ++ return realloc(ptr,size);
150 ++}
151 ++
152 ++SHIM_HIDDEN void* ShimCalloc(size_t n, size_t size) {
153 ++ return calloc(n,size);
154 ++}
155 ++
156 ++SHIM_HIDDEN void ShimCFree(void* ptr) {
157 ++ free(ptr);
158 ++}
159 ++
160 ++SHIM_HIDDEN void* ShimMemalign(size_t align, size_t s) {
161 ++ return memalign(align,s);
162 ++}
163 ++
164 ++SHIM_HIDDEN void* ShimValloc(size_t size) {
165 ++ return valloc(size);
166 ++}
167 ++
168 ++SHIM_HIDDEN void* ShimPvalloc(size_t size) {
169 ++ return pvalloc(size);
170 ++}
171 ++
172 ++SHIM_HIDDEN int ShimPosixMemalign(void** r, size_t a, size_t s) {
173 ++ return posix_memalign(r,a,s);
174 ++}
175 ++} // extern "C"
176
177 diff --git a/media-sound/teamspeak-client/files/ts3client-bin-r1 b/media-sound/teamspeak-client/files/ts3client-bin-r1
178 new file mode 100644
179 index 00000000000..3edbc2e7907
180 --- /dev/null
181 +++ b/media-sound/teamspeak-client/files/ts3client-bin-r1
182 @@ -0,0 +1,13 @@
183 +#!/bin/bash
184 +
185 +# Sets BASEDIR for teamspeak3-client
186 +BASEDIR="/opt/teamspeak3-client"
187 +
188 +# Work around DT_RPATH (.) security issue by chdir'ing into expected $LD_LIBRARY_PATH
189 +export LD_LIBRARY_PATH="${BASEDIR}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
190 +
191 +# Preload the library that provides calloc@Qt_5 and such (gentoo bug 675874)
192 +export LD_PRELOAD="${BASEDIR}/overrides.so${LD_PRELOAD:+:}${LD_PRELOAD}"
193 +
194 +# Launch teamspeak3-client
195 +cd "${BASEDIR}" && exec "${BASEDIR}/ts3client" $*
196
197 diff --git a/media-sound/teamspeak-client/teamspeak-client-3.2.3-r2.ebuild b/media-sound/teamspeak-client/teamspeak-client-3.2.3-r2.ebuild
198 new file mode 100644
199 index 00000000000..17758f24d50
200 --- /dev/null
201 +++ b/media-sound/teamspeak-client/teamspeak-client-3.2.3-r2.ebuild
202 @@ -0,0 +1,102 @@
203 +# Copyright 1999-2019 Gentoo Authors
204 +# Distributed under the terms of the GNU General Public License v2
205 +
206 +EAPI=7
207 +
208 +inherit desktop toolchain-funcs unpacker xdg-utils
209 +
210 +MY_PV="${PV/_/-}"
211 +
212 +DESCRIPTION="A client software for quality voice communication via the internet"
213 +HOMEPAGE="https://www.teamspeak.com/"
214 +SRC_URI="amd64? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_amd64-${MY_PV}.run )
215 + x86? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_x86-${MY_PV}.run )"
216 +
217 +KEYWORDS="-* ~amd64 ~x86"
218 +LICENSE="teamspeak3 || ( GPL-2 GPL-3 LGPL-3 )"
219 +SLOT="0"
220 +IUSE="alsa pulseaudio"
221 +REQUIRED_USE="|| ( alsa pulseaudio )"
222 +
223 +RDEPEND="
224 + app-arch/snappy:0/1
225 + =dev-libs/openssl-1.0*:*
226 + dev-libs/quazip
227 + dev-qt/qtcore:5
228 + dev-qt/qtgui:5[accessibility,dbus,xcb]
229 + dev-qt/qtnetwork:5
230 + dev-qt/qtsql:5[sqlite]
231 + dev-qt/qtsvg:5
232 + dev-qt/qtwebchannel:5
233 + dev-qt/qtwebengine:5[geolocation,widgets]
234 + dev-qt/qtwidgets:5
235 + net-libs/libsrtp:0
236 + sys-libs/libcxx[libcxxabi]
237 + sys-libs/zlib:0/1
238 + virtual/udev
239 + alsa? ( media-libs/alsa-lib )
240 + pulseaudio? ( media-sound/pulseaudio )
241 +"
242 +
243 +RESTRICT="mirror"
244 +
245 +S="${WORKDIR}"
246 +
247 +QA_PREBUILT="
248 + opt/teamspeak3-client/error_report
249 + opt/teamspeak3-client/package_inst
250 + opt/teamspeak3-client/soundbackends/libalsa_linux_*.so
251 + opt/teamspeak3-client/soundbackends/libpulseaudio_linux_*.so
252 + opt/teamspeak3-client/ts3client
253 + opt/teamspeak3-client/update
254 +"
255 +
256 +PATCHES=(
257 + "${FILESDIR}/${P}-qt-5.12-symbol-reexports.patch"
258 +)
259 +
260 +src_prepare() {
261 + default
262 +
263 + if ! use alsa; then
264 + rm -f soundbackends/libalsa_linux_*.so || die
265 + fi
266 + if ! use pulseaudio ; then
267 + rm -f soundbackends/libpulseaudio_linux_*.so || die
268 + fi
269 +
270 + mv ts3client_linux_* ts3client || die
271 +
272 + tc-export CXX
273 +}
274 +
275 +src_install() {
276 + exeinto /opt/teamspeak3-client
277 + doexe error_report package_inst ts3client update overrides.so
278 + newexe "${FILESDIR}"/ts3client-bin-r1 ts3client-bin
279 +
280 + exeinto /opt/teamspeak3-client/soundbackends
281 + doexe soundbackends/*.so
282 +
283 + insinto /opt/teamspeak3-client
284 + doins -r gfx html resources sound styles translations
285 +
286 + dosym ../../usr/$(get_libdir)/qt5/libexec/QtWebEngineProcess /opt/teamspeak3-client/QtWebEngineProcess
287 +
288 + dodir /opt/bin
289 + dosym ../teamspeak3-client/ts3client-bin /opt/bin/ts3client
290 +
291 + make_desktop_entry /opt/bin/ts3client "Teamspeak 3 Client" /opt/teamspeak3-client/styles/default/logo-128x128.png "Audio;AudioVideo;Network"
292 +
293 + einstalldocs
294 +}
295 +
296 +pkg_postinst() {
297 + xdg_desktop_database_update
298 + xdg_mimeinfo_database_update
299 +}
300 +
301 +pkg_postrm() {
302 + xdg_desktop_database_update
303 + xdg_mimeinfo_database_update
304 +}