summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authortron <tron@pkgsrc.org>2009-06-04 19:15:46 +0000
committertron <tron@pkgsrc.org>2009-06-04 19:15:46 +0000
commit535f97bbf12be081f05cfe0cf52822da3438dd5d (patch)
treede9a0baeee91f76de60a75da82035baee5dab1b8 /net
parent47814dd5a6546b55afe8f5141be193a4fe1110f0 (diff)
downloadpkgsrc-535f97bbf12be081f05cfe0cf52822da3438dd5d.tar.gz
Add patch by Joerg Sonnenberger with small modification by myself that
addresses the API difference in kqueue(2) between NetBSD and FreeBSD. Turn on kqueue(2) support now that it actually works under NetBSD.
Diffstat (limited to 'net')
-rw-r--r--net/libtorrent/Makefile6
-rw-r--r--net/libtorrent/distinfo3
-rw-r--r--net/libtorrent/patches/patch-ab57
3 files changed, 62 insertions, 4 deletions
diff --git a/net/libtorrent/Makefile b/net/libtorrent/Makefile
index e7863143a32..0be1acaefbe 100644
--- a/net/libtorrent/Makefile
+++ b/net/libtorrent/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.32 2009/06/04 14:04:08 tron Exp $
+# $NetBSD: Makefile,v 1.33 2009/06/04 19:15:46 tron Exp $
DISTNAME= libtorrent-0.12.2
-PKGREVISION= 1
+PKGREVISION= 2
CATEGORIES= net
MASTER_SITES= ${HOMEPAGE:=downloads/}
@@ -21,7 +21,7 @@ GCC_REQD+= 3.3
.include "../../mk/bsd.prefs.mk"
-.if ${OPSYS} == "DragonFly" || ${OPSYS} == "FreeBSD" || ${OPSYS} == "OpenBSD"
+.if !empty(OPSYS:M*BSD) || ${OPSYS} == "DragonFly"
CONFIGURE_ARGS+= --with-kqueue
.endif
diff --git a/net/libtorrent/distinfo b/net/libtorrent/distinfo
index 82bbf401f32..fe5a7602d16 100644
--- a/net/libtorrent/distinfo
+++ b/net/libtorrent/distinfo
@@ -1,6 +1,7 @@
-$NetBSD: distinfo,v 1.22 2009/04/10 09:06:20 tron Exp $
+$NetBSD: distinfo,v 1.23 2009/06/04 19:15:46 tron Exp $
SHA1 (libtorrent-0.12.2.tar.gz) = a53d2c671e9f2dd971d0622d5b3672da91c46ef9
RMD160 (libtorrent-0.12.2.tar.gz) = 88cdc415f98afd8b87fa6d7330906737c3e434fa
Size (libtorrent-0.12.2.tar.gz) = 585374 bytes
SHA1 (patch-aa) = d864808b9e9524b3a7f72bcc1b465d4e6b2d4f4a
+SHA1 (patch-ab) = 161a2b0d354ba326a82a2747050b8f323ea420a6
diff --git a/net/libtorrent/patches/patch-ab b/net/libtorrent/patches/patch-ab
new file mode 100644
index 00000000000..6e44851d20e
--- /dev/null
+++ b/net/libtorrent/patches/patch-ab
@@ -0,0 +1,57 @@
+$NetBSD: patch-ab,v 1.9 2009/06/04 19:15:47 tron Exp $
+
+Deal with the kqueue(2) API differences between NetBSD and the other BSDs.
+
+--- src/torrent/poll_kqueue.cc.orig 2008-05-07 13:19:13.000000000 +0100
++++ src/torrent/poll_kqueue.cc 2009-06-04 18:10:50.000000000 +0100
+@@ -57,6 +57,12 @@
+
+ #ifdef USE_KQUEUE
+
++#ifdef __NetBSD__
++typedef uintptr_t kevent_udata_t;
++#else
++typedef void *kevent_udata_t;
++#endif
++
+ inline uint32_t
+ PollKQueue::event_mask(Event* e) {
+ return m_table[e->file_descriptor()];
+@@ -83,7 +89,7 @@
+
+ struct kevent* itr = m_changes + (m_changedEvents++);
+
+- EV_SET(itr, event->file_descriptor(), mask, op, 0, 0, event);
++ EV_SET(itr, event->file_descriptor(), mask, op, 0, 0, (kevent_udata_t)event);
+ }
+
+ PollKQueue*
+@@ -146,10 +152,10 @@
+
+ // Also check current mask.
+
+- if (itr->filter == EVFILT_READ && itr->udata != NULL && event_mask((Event*)itr->udata) & flag_read)
++ if (itr->filter == EVFILT_READ && itr->udata != (kevent_udata_t)NULL && event_mask((Event*)itr->udata) & flag_read)
+ ((Event*)itr->udata)->event_read();
+
+- if (itr->filter == EVFILT_WRITE && itr->udata != NULL && event_mask((Event*)itr->udata) & flag_write)
++ if (itr->filter == EVFILT_WRITE && itr->udata != (kevent_udata_t)NULL && event_mask((Event*)itr->udata) & flag_write)
+ ((Event*)itr->udata)->event_write();
+ }
+
+@@ -173,10 +179,12 @@
+ throw internal_error("PollKQueue::close(...) called but the file descriptor is active");
+
+ for (struct kevent *itr = m_events, *last = m_events + m_waitingEvents; itr != last; ++itr)
+- if (itr->udata == event)
+- itr->udata = NULL;
++ if (itr->udata == (kevent_udata_t)event)
++ itr->udata = (kevent_udata_t)NULL;
++
++ struct kevent *oitr = m_changes;
+
+- m_changedEvents = std::remove_if(m_changes, m_changes + m_changedEvents, rak::equal(event, rak::mem_ref(&kevent::udata))) - m_changes;
++ m_changedEvents = std::remove_if(m_changes, m_changes + m_changedEvents, rak::equal((kevent_udata_t)event, rak::mem_ref(&kevent::udata))) - m_changes;
+ }
+
+ // Use custom defines for EPOLL* to make the below code compile with