Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rtorrent/libtorrent portability fixes for smartos #40

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions net/libtorrent/Makefile
Original file line number Diff line number Diff line change
@@ -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/

Expand Down Expand Up @@ -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
Expand All @@ -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"
1 change: 0 additions & 1 deletion net/libtorrent/buildlink3.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions net/libtorrent/distinfo
Original file line number Diff line number Diff line change
Expand Up @@ -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
22 changes: 22 additions & 0 deletions net/libtorrent/patches/patch-src_net_listen.cc
Original file line number Diff line number Diff line change
@@ -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());
+ }
}

}
2 changes: 1 addition & 1 deletion net/rtorrent/Makefile
Original file line number Diff line number Diff line change
@@ -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/

Expand Down
5 changes: 4 additions & 1 deletion net/rtorrent/distinfo
Original file line number Diff line number Diff line change
Expand Up @@ -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
21 changes: 21 additions & 0 deletions net/rtorrent/patches/patch-src_display_window__download__list.cc
Original file line number Diff line number Diff line change
@@ -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);

22 changes: 22 additions & 0 deletions net/rtorrent/patches/patch-src_input_input__event.cc
Original file line number Diff line number Diff line change
@@ -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 <ncursesw/curses.h>
+#elif defined(HAVE_NCURSESW_H)
+#include <ncursesw.h>
+#elif defined(HAVE_NCURSES_CURSES_H)
+#include <ncurses/curses.h>
+#elif defined(HAVE_NCURSES_H)
#include <ncurses.h>
+#elif defined(HAVE_CURSES_H)
+#include <curses.h>
+#else
+#error "SysV or X/Open-compatible Curses header file required"
+#endif

namespace input {

14 changes: 14 additions & 0 deletions net/rtorrent/patches/patch-src_input_path__input.cc
Original file line number Diff line number Diff line change
@@ -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 += '/';
}
};
24 changes: 20 additions & 4 deletions net/rtorrent/patches/patch-src_signal__handler.cc
Original file line number Diff line number Diff line change
@@ -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 @@

Expand All @@ -9,4 +7,22 @@
+#include <string>
#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