commit:     4de5a51b48af8c5de3d3ade1a1adf77c7801c0a7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Sat Dec  9 17:02:21 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sat Dec  9 18:06:01 2023 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4de5a51b

net-p2p/rtorrent: fix modern C issue in configure

Also, stop calling econf twice.

Signed-off-by: Sam James <sam <AT> gentoo.org>

 .../files/rtorrent-0.9.8-configure-c99.patch       | 79 ++++++++++++++++++++++
 net-p2p/rtorrent/rtorrent-0.9.8-r3.ebuild          | 73 ++++++++++++++++++++
 2 files changed, 152 insertions(+)

diff --git a/net-p2p/rtorrent/files/rtorrent-0.9.8-configure-c99.patch 
b/net-p2p/rtorrent/files/rtorrent-0.9.8-configure-c99.patch
new file mode 100644
index 000000000000..a2fa67799b8e
--- /dev/null
+++ b/net-p2p/rtorrent/files/rtorrent-0.9.8-configure-c99.patch
@@ -0,0 +1,79 @@
+https://github.com/rakshasa/rtorrent/commit/3f72e2760305936b27904d0080a5fb5600948bd5
+
+From 3f72e2760305936b27904d0080a5fb5600948bd5 Mon Sep 17 00:00:00 2001
+From: rakshasa <[email protected]>
+Date: Sat, 27 Feb 2021 22:13:01 +0900
+Subject: [PATCH] Replaced custom execinfo autoconf test.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -20,8 +20,6 @@ TORRENT_DISABLE_IPV6
+ 
+ AC_SYS_LARGEFILE
+ 
+-TORRENT_CHECK_EXECINFO
+-
+ TORRENT_ENABLE_ARCH
+ TORRENT_WITH_SYSROOT
+ 
+@@ -29,6 +27,7 @@ TORRENT_WITHOUT_VARIABLE_FDSET
+ TORRENT_WITHOUT_STATVFS
+ TORRENT_WITHOUT_STATFS
+ 
++AX_EXECINFO
+ AX_PTHREAD([], AC_MSG_ERROR([requires pthread]))
+ AX_WITH_CURSES
+ 
+--- a/scripts/common.m4
++++ b/scripts/common.m4
+@@ -150,21 +150,6 @@ dnl   Need to fix this so that it uses the stuff defined 
by the system.
+   ])
+ ])
+ 
+-AC_DEFUN([TORRENT_CHECK_EXECINFO], [
+-  AC_MSG_CHECKING(for execinfo.h)
+-
+-  AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+-      #include <execinfo.h>
+-      int main() { backtrace((void**)0, 0); backtrace_symbols((char**)0, 0); 
return 0;}
+-      ])],
+-    [
+-      AC_MSG_RESULT(yes)
+-      AC_DEFINE(USE_EXECINFO, 1, Use execinfo.h)
+-    ], [
+-      AC_MSG_RESULT(no)
+-  ])
+-])
+-
+ AC_DEFUN([TORRENT_CHECK_ALIGNED], [
+   AC_MSG_CHECKING(the byte alignment)
+ 
+--- a/src/main.cc
++++ b/src/main.cc
+@@ -53,7 +53,7 @@
+ #include <rak/functional.h>
+ #include <rak/error_number.h>
+ 
+-#ifdef USE_EXECINFO
++#ifdef HAVE_BACKTRACE
+ #include <execinfo.h>
+ #endif
+ 
+@@ -533,7 +533,7 @@ handle_sigbus(int signum, siginfo_t* sa, void* ptr) {
+   std::stringstream output;
+   output << "Caught SIGBUS, dumping stack:" << std::endl;
+ 
+-#ifdef USE_EXECINFO
++#ifdef HAVE_BACKTRACE
+   void* stackPtrs[20];
+ 
+   // Print the stack and exit.
+@@ -604,7 +604,7 @@ do_panic(int signum) {
+ 
+   output << "Caught " << SignalHandler::as_string(signum) << ", dumping 
stack:" << std::endl;
+   
+-#ifdef USE_EXECINFO
++#ifdef HAVE_BACKTRACE
+   void* stackPtrs[20];
+ 
+   // Print the stack and exit.

diff --git a/net-p2p/rtorrent/rtorrent-0.9.8-r3.ebuild 
b/net-p2p/rtorrent/rtorrent-0.9.8-r3.ebuild
new file mode 100644
index 000000000000..f2faf7732600
--- /dev/null
+++ b/net-p2p/rtorrent/rtorrent-0.9.8-r3.ebuild
@@ -0,0 +1,73 @@
+# Copyright 1999-2023 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit autotools linux-info systemd
+
+DESCRIPTION="BitTorrent Client using libtorrent"
+HOMEPAGE="https://rakshasa.github.io/rtorrent/";
+SRC_URI="http://rtorrent.net/downloads/${P}.tar.gz";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~riscv ~sparc ~x86 
~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x64-solaris"
+IUSE="debug selinux test xmlrpc"
+RESTRICT="!test? ( test )"
+
+COMMON_DEPEND="~net-libs/libtorrent-0.13.${PV##*.}
+       >=net-misc/curl-7.19.1
+       sys-libs/ncurses:0=
+       xmlrpc? ( dev-libs/xmlrpc-c:= )"
+RDEPEND="${COMMON_DEPEND}
+       selinux? ( sec-policy/selinux-rtorrent )
+"
+DEPEND="${COMMON_DEPEND}
+       dev-util/cppunit
+       virtual/pkgconfig"
+
+DOCS=( doc/rtorrent.rc )
+
+PATCHES=(
+       "${FILESDIR}/${P}-bgo891995.patch"
+       "${FILESDIR}/${PN}-0.9.8-configure-c99.patch"
+)
+
+pkg_setup() {
+       if ! linux_config_exists || ! linux_chkconfig_present IPV6; then
+               ewarn "rtorrent will not start without IPv6 support in your 
kernel"
+               ewarn "without further configuration. Please set bind=0.0.0.0 
or"
+               ewarn "similar in your rtorrent.rc"
+               ewarn "Upstream bug: 
https://github.com/rakshasa/rtorrent/issues/732";
+       fi
+}
+
+src_prepare() {
+       default
+
+       # https://github.com/rakshasa/rtorrent/issues/332
+       cp "${FILESDIR}"/rtorrent.1 "${S}"/doc/ || die
+
+       if [[ ${CHOST} != *-darwin* ]]; then
+               # syslibroot is only for macos, change to sysroot for others
+               sed -i 's/Wl,-syslibroot,/Wl,--sysroot,/' 
"${S}/scripts/common.m4" || die
+       fi
+
+       eautoreconf
+}
+
+src_configure() {
+       # configure needs bash or script bombs out on some null shift, bug 
#291229
+       CONFIG_SHELL=${BASH} econf \
+               $(use_enable debug) \
+               $(use_with xmlrpc xmlrpc-c)
+}
+
+src_install() {
+       default
+       doman doc/rtorrent.1
+
+       newinitd "${FILESDIR}/rtorrent-r1.init" rtorrent
+       newconfd "${FILESDIR}/rtorrentd.conf" rtorrent
+       systemd_newunit "${FILESDIR}/rtorrentd_at-r1.service" 
"[email protected]"
+}

Reply via email to