From 60565ae967f6de84b8dcc008dc0102ffc04b4737 Mon Sep 17 00:00:00 2001 From: Jesse Miller Date: Fri, 16 Jun 2017 21:26:46 +0000 Subject: [PATCH 1/7] Remove libsigc++ dependency. Enable interrupt-socket on SunOS. --- net/libtorrent/Makefile | 11 +++++++---- net/libtorrent/buildlink3.mk | 1 - 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/net/libtorrent/Makefile b/net/libtorrent/Makefile index e4bc807e034a..32875223b7f1 100644 --- a/net/libtorrent/Makefile +++ b/net/libtorrent/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.57 2017/05/03 08:38:44 jperkin Exp $ DISTNAME= libtorrent-0.13.6 -PKGREVISION= 1 +PKGREVISION= 2 CATEGORIES= net MASTER_SITES= http://rtorrent.net/downloads/ @@ -36,10 +36,14 @@ CONFIGURE_ARGS+= --enable-aligned CONFIGURE_ARGS+= --with-kqueue .endif +.if ${OPSYS} == "SunOS" +CONFIGURE_ARGS+= --enable-interrupt-socket +.endif + .include "../../mk/compiler.mk" -# See http://libtorrent.rakshasa.no/ticket/96 -.if !empty(CC_VERSION:Mgcc-[45].*) + See http://libtorrent.rakshasa.no/ticket/96 +.if !empty(CC_VERSION:Mgcc-4.0.*) CXXFLAGS+= -fpermissive -fno-strength-reduce -fno-thread-jumps \ -fno-inline -fforce-addr .endif @@ -59,5 +63,4 @@ CONFIGURE_ENV+= OPENSSL_LIBS=${OPENSSL_LIBS:Q} .endif .include "../../devel/zlib/buildlink3.mk" -.include "../../devel/libsigc++/buildlink3.mk" .include "../../mk/bsd.pkg.mk" diff --git a/net/libtorrent/buildlink3.mk b/net/libtorrent/buildlink3.mk index 0808dc55b4d8..549fd24650be 100644 --- a/net/libtorrent/buildlink3.mk +++ b/net/libtorrent/buildlink3.mk @@ -9,7 +9,6 @@ BUILDLINK_API_DEPENDS.libtorrent+= libtorrent>=0.13.6 BUILDLINK_ABI_DEPENDS.libtorrent+= libtorrent>=0.13.6nb1 BUILDLINK_PKGSRCDIR.libtorrent?= ../../net/libtorrent -.include "../../devel/libsigc++/buildlink3.mk" .include "../../security/openssl/buildlink3.mk" .endif # LIBTORRENT_BUILDLINK3_MK From 394a4bcea43d51b6e47302373e258baf9c5b2614 Mon Sep 17 00:00:00 2001 From: Jesse Miller Date: Fri, 16 Jun 2017 21:27:23 +0000 Subject: [PATCH 2/7] stricter error checking for select() interface https://github.com/rakshasa/libtorrent/pull/40 --- net/libtorrent/distinfo | 1 + .../patches/patch-src_net_listen.cc | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 net/libtorrent/patches/patch-src_net_listen.cc diff --git a/net/libtorrent/distinfo b/net/libtorrent/distinfo index a0e9e382fb2c..b6740190dc70 100644 --- a/net/libtorrent/distinfo +++ b/net/libtorrent/distinfo @@ -7,3 +7,4 @@ Size (libtorrent-0.13.6.tar.gz) = 781253 bytes SHA1 (patch-src_Makefile.am) = e69dd1da8a9736fa45af71cfc167c8b89a7fe648 SHA1 (patch-src_Makefile.in) = 522fbdb8da913d351fd86aface86aa2d1d86b5cc SHA1 (patch-src_data_chunk__list.cpp) = 4b09b093ca5f2abdb7e4d3c1c0bdb9fdfcd4f981 +SHA1 (patch-src_net_listen.cc) = 5e28fcc5fd5494f2b1e0a46f8af8a95f3948e983 diff --git a/net/libtorrent/patches/patch-src_net_listen.cc b/net/libtorrent/patches/patch-src_net_listen.cc new file mode 100644 index 000000000000..f41843f50961 --- /dev/null +++ b/net/libtorrent/patches/patch-src_net_listen.cc @@ -0,0 +1,22 @@ +stricter error checking for select() interface + +https://github.com/rakshasa/libtorrent/pull/40 + +--- src/net/listen.cc ++++ src/net/listen.cc +@@ -125,7 +125,14 @@ Listen::event_write() { + + void + Listen::event_error() { +- throw internal_error("Listener port received an error event."); ++ int socket = get_fd().get_fd(); ++ int error = 0; ++ socklen_t errorLen = sizeof(error); ++ ++ if (getsockopt(socket, SOL_SOCKET, SO_ERROR, &error, &errorLen) != -1 && error != 0) { ++ std::string errorMsg = std::string("Listener port received an error event: ") + strerror(error); ++ throw internal_error(errorMsg.c_str()); ++ } + } + + } From 3a85427bf9ca1773d4810b38e78af54be7c56d9b Mon Sep 17 00:00:00 2001 From: Jesse Miller Date: Fri, 16 Jun 2017 21:33:08 +0000 Subject: [PATCH 3/7] Fix last line when not enough room to display. --- ...atch-src_display_window__download__list.cc | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 net/rtorrent/patches/patch-src_display_window__download__list.cc diff --git a/net/rtorrent/patches/patch-src_display_window__download__list.cc b/net/rtorrent/patches/patch-src_display_window__download__list.cc new file mode 100644 index 000000000000..b612f01c5d00 --- /dev/null +++ b/net/rtorrent/patches/patch-src_display_window__download__list.cc @@ -0,0 +1,21 @@ +--- src/display/window_download_list.cc ++++ src/display/window_download_list.cc +@@ -90,7 +90,7 @@ WindowDownloadList::redraw() { + Range range = rak::advance_bidirectional(m_view->begin_visible(), + m_view->focus() != m_view->end_visible() ? m_view->focus() : m_view->begin_visible(), + m_view->end_visible(), +- m_canvas->height() / 3); ++ (m_canvas->height() - 1) / 3); + + // Make sure we properly fill out the last lines so it looks like + // there are more torrents, yet don't hide it if we got the last one +@@ -104,6 +104,9 @@ WindowDownloadList::redraw() { + char buffer[m_canvas->width() + 1]; + char* last = buffer + m_canvas->width() - 2 + 1; + ++ if (pos + 3 > m_canvas->height()) ++ break; ++ + print_download_title(buffer, last, *range.first); + m_canvas->print(0, pos++, "%c %s", range.first == m_view->focus() ? '*' : ' ', buffer); + From 0d119ef54323c5931bdb22338ce37b7440afdb59 Mon Sep 17 00:00:00 2001 From: Jesse Miller Date: Fri, 16 Jun 2017 21:34:41 +0000 Subject: [PATCH 4/7] Portability fix to ncurses include. --- .../patches/patch-src_input_input__event.cc | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 net/rtorrent/patches/patch-src_input_input__event.cc diff --git a/net/rtorrent/patches/patch-src_input_input__event.cc b/net/rtorrent/patches/patch-src_input_input__event.cc new file mode 100644 index 000000000000..7e070114b664 --- /dev/null +++ b/net/rtorrent/patches/patch-src_input_input__event.cc @@ -0,0 +1,22 @@ +--- src/input/input_event.cc ++++ src/input/input_event.cc +@@ -39,7 +39,19 @@ + #include "input_event.h" + + //ncurses.h must be included last since sys/mman.h on Solaris munges ERR. ++#if defined(HAVE_NCURSESW_CURSES_H) ++#include ++#elif defined(HAVE_NCURSESW_H) ++#include ++#elif defined(HAVE_NCURSES_CURSES_H) ++#include ++#elif defined(HAVE_NCURSES_H) + #include ++#elif defined(HAVE_CURSES_H) ++#include ++#else ++#error "SysV or X/Open-compatible Curses header file required" ++#endif + + namespace input { + From f9614fe2462e60f2beb02786d154fb2530a9c3a8 Mon Sep 17 00:00:00 2001 From: Jesse Miller Date: Fri, 16 Jun 2017 21:40:47 +0000 Subject: [PATCH 5/7] not all dirent have d_type --- .../patches/patch-src_input_path__input.cc | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 net/rtorrent/patches/patch-src_input_path__input.cc diff --git a/net/rtorrent/patches/patch-src_input_path__input.cc b/net/rtorrent/patches/patch-src_input_path__input.cc new file mode 100644 index 000000000000..4078fae7ae9b --- /dev/null +++ b/net/rtorrent/patches/patch-src_input_path__input.cc @@ -0,0 +1,14 @@ +--- src/input/path_input.cc ++++ src/input/path_input.cc +@@ -75,8 +75,10 @@ PathInput::pressed(int key) { + + struct _transform_filename { + void operator () (utils::directory_entry& entry) { +- if (entry.d_type == DT_DIR) +- entry.d_name += '/'; ++ struct stat s; ++ if (stat(entry.d_name.c_str(), &s) == 0) ++ if (S_ISDIR(s.st_mode)) ++ entry.d_name += '/'; + } + }; From 322657b18a7a0076d937e34078ad3d36b073942e Mon Sep 17 00:00:00 2001 From: Jesse Miller Date: Fri, 16 Jun 2017 21:43:20 +0000 Subject: [PATCH 6/7] replace signal() call with sigaction() for better portability https://github.com/rakshasa/rtorrent/pull/127 --- .../patches/patch-src_signal__handler.cc | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/net/rtorrent/patches/patch-src_signal__handler.cc b/net/rtorrent/patches/patch-src_signal__handler.cc index 02dca545ad9f..9b1d1e1fcf14 100644 --- a/net/rtorrent/patches/patch-src_signal__handler.cc +++ b/net/rtorrent/patches/patch-src_signal__handler.cc @@ -1,6 +1,4 @@ -$NetBSD: patch-src_signal__handler.cc,v 1.3 2013/09/18 16:33:09 joerg Exp $ - ---- src/signal_handler.cc.orig 2012-03-29 13:06:11.000000000 +0000 +--- src/signal_handler.cc +++ src/signal_handler.cc @@ -38,6 +38,7 @@ @@ -9,4 +7,22 @@ +#include #include "rak/error_number.h" #include "signal_handler.h" - + +@@ -74,8 +74,15 @@ SignalHandler::set_handler(unsigned int signum, slot_void slot) { + if (!slot) + throw std::logic_error("SignalHandler::set_handler(...) received an empty slot."); + +- signal(signum, &SignalHandler::caught); +- m_handlers[signum] = slot; ++ struct sigaction sa; ++ sigemptyset(&sa.sa_mask); ++ sa.sa_flags = SA_RESTART; ++ sa.sa_handler = &SignalHandler::caught; ++ ++ if (sigaction(signum, &sa, NULL) == -1) ++ throw std::logic_error("Could not set sigaction: " + std::string(rak::error_number::current().c_str())); ++ else ++ m_handlers[signum] = slot; + } + + void From 9ff6276cca550a1e01459f6f8cd557f57e25b9a2 Mon Sep 17 00:00:00 2001 From: Jesse Miller Date: Fri, 16 Jun 2017 21:46:29 +0000 Subject: [PATCH 7/7] Bump pkgversion, include new patches. --- net/rtorrent/Makefile | 2 +- net/rtorrent/distinfo | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/net/rtorrent/Makefile b/net/rtorrent/Makefile index ad935f3c3ce0..6382796334b0 100644 --- a/net/rtorrent/Makefile +++ b/net/rtorrent/Makefile @@ -1,7 +1,7 @@ # $NetBSD: Makefile,v 1.67 2017/08/24 20:03:36 adam Exp $ DISTNAME= rtorrent-0.9.6 -PKGREVISION= 5 +PKGREVISION= 6 CATEGORIES= net MASTER_SITES= http://rtorrent.net/downloads/ diff --git a/net/rtorrent/distinfo b/net/rtorrent/distinfo index e8598f8c3e3a..fe02a467f3a2 100644 --- a/net/rtorrent/distinfo +++ b/net/rtorrent/distinfo @@ -8,5 +8,8 @@ SHA1 (patch-ad) = b3b38e1d9d0887711ac54433e948bfc28112b985 SHA1 (patch-ae) = a370881bfdd8534eb25fcbcff8d258b19797941f SHA1 (patch-af) = 842a01cbc75e61092b4d33fe9155a728e7c502e6 SHA1 (patch-ag) = c0278f1d1ce7f635c5d10542026fc565dcff1927 +SHA1 (patch-src_display_window__download__list.cc) = cd2bc228ea1ab6f2843c8a3d333d8e15c8d1fa19 SHA1 (patch-src_display_window__file__list.cc) = ba005aa1a12317f190a6ec47277e7545b37f2a1c -SHA1 (patch-src_signal__handler.cc) = a79d2dcd9a14de1e221ab94d2a14fe70b9b9ce36 +SHA1 (patch-src_input_input__event.cc) = a30e8079eb4624e94c5d9724946443996bee45dd +SHA1 (patch-src_input_path__input.cc) = cf918d9e82db535949d2360c9d108c0ec50052ac +SHA1 (patch-src_signal__handler.cc) = a1581673d705ca3855c0a5a221e252806e5c044c