summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Lisov <dennis.lissov@gmail.com>2019-04-09 00:27:09 +0300
committerMichał Górny <mgorny@gentoo.org>2019-04-30 18:49:35 +0200
commit378f1d8be411fc8f8a6dba202813c8f565a9dca0 (patch)
treef9b6c1c1874739a0f22cefe756ddccbbbe9acf87
parentmedia-sound/umurmur: Fixed build with USE="libressl" (diff)
downloadgentoo-378f1d8be411fc8f8a6dba202813c8f565a9dca0.tar.gz
gentoo-378f1d8be411fc8f8a6dba202813c8f565a9dca0.tar.bz2
gentoo-378f1d8be411fc8f8a6dba202813c8f565a9dca0.zip
media-sound/teamspeak-client: add workaround for Qt 5.12
QtWebEngine versions before 5.12 used to reexport a few symbols like calloc with version Qt_5 that were exported by mistake once. These are no longer exported in 5.12 (probably a Qt bug), and teamspeak-client does not officially support it (only the bundled QtWebEngine 5.6.1 is supported). Add a `overrides.so` shared library that reexports them by taking this code from Qt under (L)GPL and preload it using LD_PRELOAD to make the symbols available. Closes: https://bugs.gentoo.org/675874 Signed-off-by: Denis Lisov <dennis.lissov@gmail.com> Signed-off-by: Michał Górny <mgorny@gentoo.org>
-rw-r--r--media-sound/teamspeak-client/files/teamspeak-client-3.2.3-qt-5.12-symbol-reexports.patch141
-rw-r--r--media-sound/teamspeak-client/files/ts3client-bin-r113
-rw-r--r--media-sound/teamspeak-client/teamspeak-client-3.2.3-r2.ebuild102
3 files changed, 256 insertions, 0 deletions
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
new file mode 100644
index 00000000000..ee5f78914d0
--- /dev/null
+++ b/media-sound/teamspeak-client/files/teamspeak-client-3.2.3-qt-5.12-symbol-reexports.patch
@@ -0,0 +1,141 @@
+diff --git a/Makefile b/Makefile
+new file mode 100644
+index 0000000..c036d5f
+--- /dev/null
++++ b/Makefile
+@@ -0,0 +1,2 @@
++overrides.so: qt-5.12-overrides.o override-version.map
++ $(CXX) $(LDFLAGS) -shared -o $@ -Wl,--version-script override-version.map qt-5.12-overrides.o
+diff --git a/override-version.map b/override-version.map
+new file mode 100644
+index 0000000..991d98e
+--- /dev/null
++++ b/override-version.map
+@@ -0,0 +1 @@
++Qt_5 {};
+diff --git a/qt-5.12-overrides.cpp b/qt-5.12-overrides.cpp
+new file mode 100644
+index 0000000..002a1af
+--- /dev/null
++++ b/qt-5.12-overrides.cpp
+@@ -0,0 +1,120 @@
++/****************************************************************************
++**
++** Copyright (C) 2017 The Qt Company Ltd.
++** Contact: https://www.qt.io/licensing/
++**
++** This file is part of the QtWebEngine module of the Qt Toolkit.
++**
++** $QT_BEGIN_LICENSE:LGPL$
++** Commercial License Usage
++** Licensees holding valid commercial Qt licenses may use this file in
++** accordance with the commercial license agreement provided with the
++** Software or, alternatively, in accordance with the terms contained in
++** a written agreement between you and The Qt Company. For licensing terms
++** and conditions see https://www.qt.io/terms-conditions. For further
++** information use the contact form at https://www.qt.io/contact-us.
++**
++** GNU Lesser General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU Lesser
++** General Public License version 3 as published by the Free Software
++** Foundation and appearing in the file LICENSE.LGPL3 included in the
++** packaging of this file. Please review the following information to
++** ensure the GNU Lesser General Public License version 3 requirements
++** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
++**
++** GNU General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU
++** General Public License version 2.0 or (at your option) the GNU General
++** Public license version 3 or any later version approved by the KDE Free
++** Qt Foundation. The licenses are as published by the Free Software
++** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
++** included in the packaging of this file. Please review the following
++** information to ensure the GNU General Public License requirements will
++** be met: https://www.gnu.org/licenses/gpl-2.0.html and
++** https://www.gnu.org/licenses/gpl-3.0.html.
++**
++** $QT_END_LICENSE$
++**
++****************************************************************************/
++
++#include <stdlib.h>
++#include <malloc.h>
++
++#define SHIM_ALIAS_SYMBOL(fn) __attribute__((weak, alias(#fn)))
++#define SHIM_SYMBOL_VERSION(fn) __asm__(".symver __" #fn "," #fn "@Qt_5")
++#define SHIM_HIDDEN __attribute__ ((visibility ("hidden")))
++
++extern "C" {
++
++SHIM_SYMBOL_VERSION(malloc);
++void* __malloc(size_t size)
++ SHIM_ALIAS_SYMBOL(ShimMalloc);
++
++SHIM_SYMBOL_VERSION(free);
++void __free(void* ptr)
++ SHIM_ALIAS_SYMBOL(ShimFree);
++
++SHIM_SYMBOL_VERSION(realloc);
++void* __realloc(void* ptr, size_t size)
++ SHIM_ALIAS_SYMBOL(ShimRealloc);
++
++SHIM_SYMBOL_VERSION(calloc);
++void* __calloc(size_t n, size_t size)
++ SHIM_ALIAS_SYMBOL(ShimCalloc);
++
++SHIM_SYMBOL_VERSION(cfree);
++void __cfree(void* ptr)
++ SHIM_ALIAS_SYMBOL(ShimCFree);
++
++SHIM_SYMBOL_VERSION(memalign);
++void* __memalign(size_t align, size_t s)
++ SHIM_ALIAS_SYMBOL(ShimMemalign);
++
++SHIM_SYMBOL_VERSION(valloc);
++void* __valloc(size_t size)
++ SHIM_ALIAS_SYMBOL(ShimValloc);
++
++SHIM_SYMBOL_VERSION(pvalloc);
++void* __pvalloc(size_t size)
++ SHIM_ALIAS_SYMBOL(ShimPvalloc);
++
++SHIM_SYMBOL_VERSION(posix_memalign);
++int __posix_memalign(void** r, size_t a, size_t s)
++ SHIM_ALIAS_SYMBOL(ShimPosixMemalign);
++
++SHIM_HIDDEN void* ShimMalloc(size_t size) {
++ return malloc(size);
++}
++
++SHIM_HIDDEN void ShimFree(void* ptr) {
++ free(ptr);
++}
++
++SHIM_HIDDEN void* ShimRealloc(void* ptr, size_t size) {
++ return realloc(ptr,size);
++}
++
++SHIM_HIDDEN void* ShimCalloc(size_t n, size_t size) {
++ return calloc(n,size);
++}
++
++SHIM_HIDDEN void ShimCFree(void* ptr) {
++ free(ptr);
++}
++
++SHIM_HIDDEN void* ShimMemalign(size_t align, size_t s) {
++ return memalign(align,s);
++}
++
++SHIM_HIDDEN void* ShimValloc(size_t size) {
++ return valloc(size);
++}
++
++SHIM_HIDDEN void* ShimPvalloc(size_t size) {
++ return pvalloc(size);
++}
++
++SHIM_HIDDEN int ShimPosixMemalign(void** r, size_t a, size_t s) {
++ return posix_memalign(r,a,s);
++}
++} // extern "C"
diff --git a/media-sound/teamspeak-client/files/ts3client-bin-r1 b/media-sound/teamspeak-client/files/ts3client-bin-r1
new file mode 100644
index 00000000000..3edbc2e7907
--- /dev/null
+++ b/media-sound/teamspeak-client/files/ts3client-bin-r1
@@ -0,0 +1,13 @@
+#!/bin/bash
+
+# Sets BASEDIR for teamspeak3-client
+BASEDIR="/opt/teamspeak3-client"
+
+# Work around DT_RPATH (.) security issue by chdir'ing into expected $LD_LIBRARY_PATH
+export LD_LIBRARY_PATH="${BASEDIR}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}"
+
+# Preload the library that provides calloc@Qt_5 and such (gentoo bug 675874)
+export LD_PRELOAD="${BASEDIR}/overrides.so${LD_PRELOAD:+:}${LD_PRELOAD}"
+
+# Launch teamspeak3-client
+cd "${BASEDIR}" && exec "${BASEDIR}/ts3client" $*
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
new file mode 100644
index 00000000000..17758f24d50
--- /dev/null
+++ b/media-sound/teamspeak-client/teamspeak-client-3.2.3-r2.ebuild
@@ -0,0 +1,102 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit desktop toolchain-funcs unpacker xdg-utils
+
+MY_PV="${PV/_/-}"
+
+DESCRIPTION="A client software for quality voice communication via the internet"
+HOMEPAGE="https://www.teamspeak.com/"
+SRC_URI="amd64? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_amd64-${MY_PV}.run )
+ x86? ( http://ftp.4players.de/pub/hosted/ts3/releases/${PV}/TeamSpeak3-Client-linux_x86-${MY_PV}.run )"
+
+KEYWORDS="-* ~amd64 ~x86"
+LICENSE="teamspeak3 || ( GPL-2 GPL-3 LGPL-3 )"
+SLOT="0"
+IUSE="alsa pulseaudio"
+REQUIRED_USE="|| ( alsa pulseaudio )"
+
+RDEPEND="
+ app-arch/snappy:0/1
+ =dev-libs/openssl-1.0*:*
+ dev-libs/quazip
+ dev-qt/qtcore:5
+ dev-qt/qtgui:5[accessibility,dbus,xcb]
+ dev-qt/qtnetwork:5
+ dev-qt/qtsql:5[sqlite]
+ dev-qt/qtsvg:5
+ dev-qt/qtwebchannel:5
+ dev-qt/qtwebengine:5[geolocation,widgets]
+ dev-qt/qtwidgets:5
+ net-libs/libsrtp:0
+ sys-libs/libcxx[libcxxabi]
+ sys-libs/zlib:0/1
+ virtual/udev
+ alsa? ( media-libs/alsa-lib )
+ pulseaudio? ( media-sound/pulseaudio )
+"
+
+RESTRICT="mirror"
+
+S="${WORKDIR}"
+
+QA_PREBUILT="
+ opt/teamspeak3-client/error_report
+ opt/teamspeak3-client/package_inst
+ opt/teamspeak3-client/soundbackends/libalsa_linux_*.so
+ opt/teamspeak3-client/soundbackends/libpulseaudio_linux_*.so
+ opt/teamspeak3-client/ts3client
+ opt/teamspeak3-client/update
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-qt-5.12-symbol-reexports.patch"
+)
+
+src_prepare() {
+ default
+
+ if ! use alsa; then
+ rm -f soundbackends/libalsa_linux_*.so || die
+ fi
+ if ! use pulseaudio ; then
+ rm -f soundbackends/libpulseaudio_linux_*.so || die
+ fi
+
+ mv ts3client_linux_* ts3client || die
+
+ tc-export CXX
+}
+
+src_install() {
+ exeinto /opt/teamspeak3-client
+ doexe error_report package_inst ts3client update overrides.so
+ newexe "${FILESDIR}"/ts3client-bin-r1 ts3client-bin
+
+ exeinto /opt/teamspeak3-client/soundbackends
+ doexe soundbackends/*.so
+
+ insinto /opt/teamspeak3-client
+ doins -r gfx html resources sound styles translations
+
+ dosym ../../usr/$(get_libdir)/qt5/libexec/QtWebEngineProcess /opt/teamspeak3-client/QtWebEngineProcess
+
+ dodir /opt/bin
+ dosym ../teamspeak3-client/ts3client-bin /opt/bin/ts3client
+
+ make_desktop_entry /opt/bin/ts3client "Teamspeak 3 Client" /opt/teamspeak3-client/styles/default/logo-128x128.png "Audio;AudioVideo;Network"
+
+ einstalldocs
+}
+
+pkg_postinst() {
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+}
+
+pkg_postrm() {
+ xdg_desktop_database_update
+ xdg_mimeinfo_database_update
+}