commit:     0ae091b04171c3f9b2344db263765a1b7f1360d8
Author:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
AuthorDate: Mon Aug  9 15:40:44 2021 +0000
Commit:     Hans de Graaff <graaff <AT> gentoo <DOT> org>
CommitDate: Mon Aug  9 15:40:44 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0ae091b0

net-p2p/gtk-gnutella: fix compilation with glibc 2.34

Closes: https://bugs.gentoo.org/806947
Package-Manager: Portage-3.0.20, Repoman-3.0.2
Signed-off-by: Hans de Graaff <graaff <AT> gentoo.org>

 .../files/gtk-gnutella-1.2.1-glibc234.patch        | 53 +++++++++++++
 net-p2p/gtk-gnutella/gtk-gnutella-1.2.1-r1.ebuild  | 91 ++++++++++++++++++++++
 2 files changed, 144 insertions(+)

diff --git a/net-p2p/gtk-gnutella/files/gtk-gnutella-1.2.1-glibc234.patch 
b/net-p2p/gtk-gnutella/files/gtk-gnutella-1.2.1-glibc234.patch
new file mode 100644
index 00000000000..8d985b96670
--- /dev/null
+++ b/net-p2p/gtk-gnutella/files/gtk-gnutella-1.2.1-glibc234.patch
@@ -0,0 +1,53 @@
+From 31d06cecac572852c6e5e8d85cea641883cbe4c6 Mon Sep 17 00:00:00 2001
+From: Raphael Manfredi <[email protected]>
+Date: Mon, 9 Aug 2021 09:36:00 +0200
+Subject: [PATCH] Fix compilation with newest glibc.
+
+The PTHREAD_STACK_MIN value is no longer a constant but rather
+defined as sysconf(_SC_THREAD_STACK_MIN).
+
+Therefore, we must avoid using cpp computations on that value.
+---
+ src/lib/thread.c | 7 +------
+ src/lib/thread.h | 2 +-
+ 2 files changed, 2 insertions(+), 7 deletions(-)
+
+diff --git a/src/lib/thread.c b/src/lib/thread.c
+index 178c09794..e7a702029 100644
+--- a/src/lib/thread.c
++++ b/src/lib/thread.c
+@@ -9705,7 +9705,7 @@ thread_launch_trampoline(void *arg)
+  * In case PTHREAD_STACK_MIN is not defined by <pthread.h>.
+  */
+ #ifndef PTHREAD_STACK_MIN
+-#define PTHREAD_STACK_MIN 0
++#define PTHREAD_STACK_MIN 1024U
+ #endif
+ 
+ /**
+@@ -9737,12 +9737,7 @@ thread_launch(struct thread_element *te,
+       pthread_attr_init(&attr);
+ 
+       if (stack != 0) {
+-              /* Avoid compiler warning when PTHREAD_STACK_MIN == 0 */
+-#if PTHREAD_STACK_MIN != 0
+               stacksize = MAX(PTHREAD_STACK_MIN, stack);
+-#else
+-              stacksize = stack;
+-#endif
+               stacksize = MAX(stacksize, THREAD_STACK_MIN);
+       } else {
+               stacksize = MAX(THREAD_STACK_DFLT, PTHREAD_STACK_MIN);
+diff --git a/src/lib/thread.h b/src/lib/thread.h
+index 73e15fa36..740f3a6f9 100644
+--- a/src/lib/thread.h
++++ b/src/lib/thread.h
+@@ -63,7 +63,7 @@ typedef size_t thread_qid_t;         /* Quasi Thread ID */
+ typedef unsigned int thread_key_t;    /* Local thread storage key */
+ 
+ #define THREAD_MAX                    64              /**< Max amount of 
threads we can track */
+-#define THREAD_STACK_DFLT     (65536 * PTRSIZE)       /**< Default stack 
requested */
++#define THREAD_STACK_DFLT     (65536U * PTRSIZE)      /**< Default stack 
requested */
+ #define THREAD_LOCAL_MAX      1024    /**< Max amount of thread-local keys */
+ 
+ #define THREAD_SUSPEND_TIMEOUT        90      /**< secs: thread max 
suspension time */

diff --git a/net-p2p/gtk-gnutella/gtk-gnutella-1.2.1-r1.ebuild 
b/net-p2p/gtk-gnutella/gtk-gnutella-1.2.1-r1.ebuild
new file mode 100644
index 00000000000..46f39f6e369
--- /dev/null
+++ b/net-p2p/gtk-gnutella/gtk-gnutella-1.2.1-r1.ebuild
@@ -0,0 +1,91 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit flag-o-matic strip-linguas toolchain-funcs
+
+IUSE="nls dbus ssl +gtk"
+
+DESCRIPTION="A GTK+ Gnutella client"
+SRC_URI="https://github.com/gtk-gnutella/gtk-gnutella/archive/v${PV}.tar.gz -> 
${P}.tar.gz"
+HOMEPAGE="http://gtk-gnutella.sourceforge.net/";
+
+SLOT="0"
+LICENSE="CC-BY-SA-4.0 GPL-2"
+KEYWORDS="~amd64 ~ppc ~ppc64 ~x86"
+
+RDEPEND="
+       sys-libs/binutils-libs:=
+       dev-libs/glib:2
+       sys-libs/zlib
+       gtk? ( >=x11-libs/gtk+-2.2.1:2 )
+       dbus? ( >=sys-apps/dbus-0.35.2 )
+       ssl? ( >=net-libs/gnutls-2.2.5 )
+       nls? ( >=sys-devel/gettext-0.11.5 )"
+DEPEND="${RDEPEND}"
+BDEPEND="virtual/pkgconfig"
+
+PATCHES=( "${FILESDIR}/${P}-glibc234.patch" )
+
+src_prepare() {
+       filter-flags -flto
+       strip-linguas -i po
+
+       echo "# Gentoo-selected LINGUAS" > po/LINGUAS
+       for ling in ${LINGUAS}; do
+               echo $ling >> po/LINGUAS
+       done
+
+       default
+}
+
+src_configure() {
+       # There is no option to turn off optimization through the build.sh
+       # script.
+       sed -i -e "s/Configure -Oder/Configure -Oder -Doptimize=none/" build.sh 
|| die
+
+       # The build script does not support the equivalent --enable
+       # options so we must construct the configuration by hand.
+
+       local myconf
+
+       if ! use nls; then
+               myconf="${myconf} --disable-nls"
+       fi
+
+       if ! use dbus; then
+               myconf="${myconf} --disable-dbus"
+       fi
+
+       if ! use ssl; then
+               myconf="${myconf} --disable-gnutls"
+       fi
+
+       if use gtk; then
+               myconf="${myconf} --gtk2"
+       else
+               myconf="${myconf} --topless"
+       fi
+
+       ./build.sh \
+               --configure-only \
+               --prefix="/usr" \
+               --cc=$(tc-getCC) \
+               ${myconf}
+}
+
+src_compile() {
+       # Build system is not parallel-safe, bug 500760
+       emake -j1
+}
+
+src_install() {
+       dodir /usr/bin
+       emake INSTALL_PREFIX="${D}" install
+       dodoc AUTHORS ChangeLog README TODO
+
+       # Touch the symbols file into the future to avoid warnings from
+       # gtk-gnutella later on, since we will most likely strip the binary.
+       touch --date="next minute" "${D}/usr/lib/gtk-gnutella/gtk-gnutella.nm" 
|| die
+}

Reply via email to