summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoerg <joerg>2013-09-18 16:32:05 +0000
committerjoerg <joerg>2013-09-18 16:32:05 +0000
commit3d33d72ee41e0e8b765482f85b6f07d0dfb60f1f (patch)
tree1b24ddc34abaca9650e2ec29cf867ae750e7f328
parent633b212b303e28af5a5df00dc73c4a678005c192 (diff)
downloadpkgsrc-3d33d72ee41e0e8b765482f85b6f07d0dfb60f1f.tar.gz
Restore support for Clang with libc++11. Bump revision.
-rw-r--r--net/libtorrent/Makefile4
-rw-r--r--net/libtorrent/distinfo44
-rw-r--r--net/libtorrent/patches/patch-src_Makefile.am13
-rw-r--r--net/libtorrent/patches/patch-src_Makefile.in13
-rw-r--r--net/libtorrent/patches/patch-src_data_chunk__list.cpp29
-rw-r--r--net/libtorrent/patches/patch-src_data_chunk__list.h31
-rw-r--r--net/libtorrent/patches/patch-src_data_hash__check__queue.h27
-rw-r--r--net/libtorrent/patches/patch-src_data_hash__queue.cc45
-rw-r--r--net/libtorrent/patches/patch-src_data_hash__queue.h27
-rw-r--r--net/libtorrent/patches/patch-src_data_hash__queue__node.h27
-rw-r--r--net/libtorrent/patches/patch-src_data_memory__chunk.h53
-rw-r--r--net/libtorrent/patches/patch-src_dht_dht__router.cc35
-rw-r--r--net/libtorrent/patches/patch-src_dht_dht__server.cc26
-rw-r--r--net/libtorrent/patches/patch-src_download_download__main.cc53
-rw-r--r--net/libtorrent/patches/patch-src_download_download__wrapper.cc55
-rw-r--r--net/libtorrent/patches/patch-src_manager.cc36
-rw-r--r--net/libtorrent/patches/patch-src_net_socket__set.h20
-rw-r--r--net/libtorrent/patches/patch-src_net_throttle__internal.cc26
-rw-r--r--net/libtorrent/patches/patch-src_protocol_handshake.cc26
-rw-r--r--net/libtorrent/patches/patch-src_torrent_data_download__data.h27
-rw-r--r--net/libtorrent/patches/patch-src_torrent_data_file.h29
-rw-r--r--net/libtorrent/patches/patch-src_torrent_download__info.h67
-rw-r--r--net/libtorrent/patches/patch-src_torrent_download_choke__group.cc46
-rw-r--r--net/libtorrent/patches/patch-src_torrent_download_choke__queue.cc12
-rw-r--r--net/libtorrent/patches/patch-src_torrent_download_choke__queue.h31
-rw-r--r--net/libtorrent/patches/patch-src_torrent_download_group__entry.h58
-rw-r--r--net/libtorrent/patches/patch-src_torrent_download_resource__manager.cc50
-rw-r--r--net/libtorrent/patches/patch-src_torrent_http.h31
-rw-r--r--net/libtorrent/patches/patch-src_torrent_peer_client__list.cc29
-rw-r--r--net/libtorrent/patches/patch-src_torrent_peer_connection__list.h44
-rw-r--r--net/libtorrent/patches/patch-src_torrent_poll.h27
-rw-r--r--net/libtorrent/patches/patch-src_torrent_tracker__controller.cc28
-rw-r--r--net/libtorrent/patches/patch-src_torrent_tracker__controller.h33
-rw-r--r--net/libtorrent/patches/patch-src_torrent_tracker__list.cc30
-rw-r--r--net/libtorrent/patches/patch-src_torrent_tracker__list.h31
-rw-r--r--net/libtorrent/patches/patch-src_torrent_utils_extents.h46
-rw-r--r--net/libtorrent/patches/patch-src_torrent_utils_log.cc50
-rw-r--r--net/libtorrent/patches/patch-src_torrent_utils_log.h40
-rw-r--r--net/libtorrent/patches/patch-src_torrent_utils_log__buffer.cc20
-rw-r--r--net/libtorrent/patches/patch-src_torrent_utils_log__buffer.h27
-rw-r--r--net/libtorrent/patches/patch-src_torrent_utils_signal__bitfield.h27
-rw-r--r--net/libtorrent/patches/patch-src_torrent_utils_thread__base.h29
-rw-r--r--net/libtorrent/patches/patch-src_tracker_tracker__http.cc38
-rw-r--r--net/libtorrent/patches/patch-src_tracker_tracker__udp.cc26
44 files changed, 1463 insertions, 3 deletions
diff --git a/net/libtorrent/Makefile b/net/libtorrent/Makefile
index 7ff5aff43ef..e4a8e3338d4 100644
--- a/net/libtorrent/Makefile
+++ b/net/libtorrent/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.49 2013/06/02 22:52:14 tron Exp $
+# $NetBSD: Makefile,v 1.50 2013/09/18 16:32:05 joerg Exp $
DISTNAME= libtorrent-0.13.2
-PKGREVISION= 4
+PKGREVISION= 5
CATEGORIES= net
MASTER_SITES= ${HOMEPAGE:=downloads/}
diff --git a/net/libtorrent/distinfo b/net/libtorrent/distinfo
index 8eb6cdf1a9b..4bf07a1c15a 100644
--- a/net/libtorrent/distinfo
+++ b/net/libtorrent/distinfo
@@ -1,6 +1,48 @@
-$NetBSD: distinfo,v 1.32 2013/06/02 22:52:14 tron Exp $
+$NetBSD: distinfo,v 1.33 2013/09/18 16:32:05 joerg Exp $
SHA1 (libtorrent-0.13.2.tar.gz) = 4f34a744fbe10c54aaf53d34681fabc1a49d7257
RMD160 (libtorrent-0.13.2.tar.gz) = 090e6af9b4318a6176064159f6a8f70ab708c7fe
Size (libtorrent-0.13.2.tar.gz) = 725088 bytes
SHA1 (patch-rak_priority__queue__default.h) = 2eee25447516efd1ac13d1a35232c29a7457c0df
+SHA1 (patch-src_Makefile.am) = e69dd1da8a9736fa45af71cfc167c8b89a7fe648
+SHA1 (patch-src_Makefile.in) = 522fbdb8da913d351fd86aface86aa2d1d86b5cc
+SHA1 (patch-src_data_chunk__list.cpp) = 4b09b093ca5f2abdb7e4d3c1c0bdb9fdfcd4f981
+SHA1 (patch-src_data_chunk__list.h) = 124832de1fd5ccaa1f89ba8b6d26fd74373e619e
+SHA1 (patch-src_data_hash__check__queue.h) = a0f2118ca92309472e402e441fa6f37706a4e1b8
+SHA1 (patch-src_data_hash__queue.cc) = c0a7395f76df2db73315e4cae5b8729c4af29d67
+SHA1 (patch-src_data_hash__queue.h) = 273cdd39bf3f0a33f0f29fd38e11c43861a5fc35
+SHA1 (patch-src_data_hash__queue__node.h) = 9a08d707b264fd1a766dfb2838754aeccb9cce78
+SHA1 (patch-src_data_memory__chunk.h) = 56d8abd0ccb45a1ede73d419fbf719acf9032064
+SHA1 (patch-src_dht_dht__router.cc) = c93ca74a9ce0c967c0787729699ed7e83b869a1d
+SHA1 (patch-src_dht_dht__server.cc) = c68de65ab4fe70dfb9774b68a49481afd766bea0
+SHA1 (patch-src_download_download__main.cc) = 8db4a0cf50b9cf1653ebc4712f22089cad60da67
+SHA1 (patch-src_download_download__wrapper.cc) = 1b31c8a081bcd89cb2c808f94812e6a121a993ae
+SHA1 (patch-src_manager.cc) = 045b6400168f5b75e18a11385d9d2aa84e28b266
+SHA1 (patch-src_net_socket__set.h) = d605091efa57560177a647d18f29edd375b18663
+SHA1 (patch-src_net_throttle__internal.cc) = fc7517ec4e54298003d7bd6d07f3e6cc7a4e6e17
+SHA1 (patch-src_protocol_handshake.cc) = 55ae0d5e14b87a32de6acfc8c414efa8e2f65ce9
+SHA1 (patch-src_torrent_data_download__data.h) = 78146905e0e2c9889bab242364c6b9896c3bf6f5
+SHA1 (patch-src_torrent_data_file.h) = 905dde7e6319db95f378668180b7f34083dc0e85
+SHA1 (patch-src_torrent_download__info.h) = e8c2a4b4e473340f938526870abb32a6a0a3a002
+SHA1 (patch-src_torrent_download_choke__group.cc) = 53e0928681faaea968a6f7bb995d5a05b27cc8d8
+SHA1 (patch-src_torrent_download_choke__queue.cc) = 23c4ad6ae1fb69ff864e115a1b062df96ba0aedb
+SHA1 (patch-src_torrent_download_choke__queue.h) = b8c0aea053129e155cf789ab3822cd4911150ca1
+SHA1 (patch-src_torrent_download_group__entry.h) = b21eb5ac05f84131a73443cfee86bbf9414b8642
+SHA1 (patch-src_torrent_download_resource__manager.cc) = 9c89fba82dfc47c6f9c1fbc29b97a4bd74fc7331
+SHA1 (patch-src_torrent_http.h) = 576af4dd1c966f5292d0623bf258a7990c525e65
+SHA1 (patch-src_torrent_peer_client__list.cc) = c36735fff0e8f56c2b0b45652707250551e6fd4b
+SHA1 (patch-src_torrent_peer_connection__list.h) = f7e5a568476bbc9668757ffd1929773048d07c4e
+SHA1 (patch-src_torrent_poll.h) = cbe839e43820eb5af0e47c4231d79c6852d8b54c
+SHA1 (patch-src_torrent_tracker__controller.cc) = f0a3805da9c8639269c3e777e48b112849625280
+SHA1 (patch-src_torrent_tracker__controller.h) = 549006debffac8431567bae01b59f0c30fda54c9
+SHA1 (patch-src_torrent_tracker__list.cc) = 3c66814bf6bd4764b9c48bfc50571f94741e6662
+SHA1 (patch-src_torrent_tracker__list.h) = 5365b610fcebe333a9c71a088db950dd4148756f
+SHA1 (patch-src_torrent_utils_extents.h) = 37e69944bdb63e831ecf07a7a6316bf7d1bd7e24
+SHA1 (patch-src_torrent_utils_log.cc) = 80006a0bcd010d2870f6a3c90d35fa52d812a841
+SHA1 (patch-src_torrent_utils_log.h) = 6bf8633d1470a9577c320333051aa80bb6713cbf
+SHA1 (patch-src_torrent_utils_log__buffer.cc) = 091ad4d5dd054eff06f26a872478cedf5450c77d
+SHA1 (patch-src_torrent_utils_log__buffer.h) = b91d080d4be115bd957a7697cc9321c830796a87
+SHA1 (patch-src_torrent_utils_signal__bitfield.h) = f595be6dd9c5026cc895a40656f94dfe1976bfa5
+SHA1 (patch-src_torrent_utils_thread__base.h) = 01e3d26607bf14c27c56769ba7ed5b3fa2ff2da9
+SHA1 (patch-src_tracker_tracker__http.cc) = 913dc141d0a472dc1aa7b5bbceab6f60263b18fa
+SHA1 (patch-src_tracker_tracker__udp.cc) = 073dd75f224a23869b2fd33e513e8e12931814c0
diff --git a/net/libtorrent/patches/patch-src_Makefile.am b/net/libtorrent/patches/patch-src_Makefile.am
new file mode 100644
index 00000000000..f80435175ac
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_Makefile.am
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_Makefile.am,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/Makefile.am.orig 2012-02-14 03:39:45.000000000 +0000
++++ src/Makefile.am
+@@ -10,7 +10,7 @@ SUBDIRS = \
+
+ lib_LTLIBRARIES = libtorrent.la
+
+-libtorrent_la_LDFLAGS = -version-info $(LIBTORRENT_INTERFACE_VERSION_INFO)
++libtorrent_la_LDFLAGS = -version-info $(LIBTORRENT_INTERFACE_VERSION_INFO) -no-undefined -lcrypto
+ libtorrent_la_LIBADD = \
+ torrent/libsub_torrent.la \
+ torrent/data/libsub_torrentdata.la \
diff --git a/net/libtorrent/patches/patch-src_Makefile.in b/net/libtorrent/patches/patch-src_Makefile.in
new file mode 100644
index 00000000000..9cece5175a4
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_Makefile.in
@@ -0,0 +1,13 @@
+$NetBSD: patch-src_Makefile.in,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/Makefile.in.orig 2012-04-20 06:56:14.000000000 +0000
++++ src/Makefile.in
+@@ -309,7 +309,7 @@ SUBDIRS = \
+ utils
+
+ lib_LTLIBRARIES = libtorrent.la
+-libtorrent_la_LDFLAGS = -version-info $(LIBTORRENT_INTERFACE_VERSION_INFO)
++libtorrent_la_LDFLAGS = -version-info $(LIBTORRENT_INTERFACE_VERSION_INFO) -no-undefined -lcrypto
+ libtorrent_la_LIBADD = \
+ torrent/libsub_torrent.la \
+ torrent/data/libsub_torrentdata.la \
diff --git a/net/libtorrent/patches/patch-src_data_chunk__list.cpp b/net/libtorrent/patches/patch-src_data_chunk__list.cpp
new file mode 100644
index 00000000000..08a0c41c54a
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_data_chunk__list.cpp
@@ -0,0 +1,29 @@
+$NetBSD: patch-src_data_chunk__list.cpp,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/data/chunk_list.cc.orig 2012-02-22 07:50:27.000000000 +0000
++++ src/data/chunk_list.cc 2013-05-12 12:25:45.000000000 +0100
+@@ -368,19 +368,19 @@
+ if (flags & sync_force) {
+
+ if (flags & sync_safe)
+- return std::make_pair(MemoryChunk::sync_sync, true);
++ return std::make_pair((int)MemoryChunk::sync_sync, true);
+ else
+- return std::make_pair(MemoryChunk::sync_async, true);
++ return std::make_pair((int)MemoryChunk::sync_async, true);
+
+ } else if (flags & sync_safe) {
+
+ if (node->sync_triggered())
+- return std::make_pair(MemoryChunk::sync_sync, true);
++ return std::make_pair((int)MemoryChunk::sync_sync, true);
+ else
+- return std::make_pair(MemoryChunk::sync_async, false);
++ return std::make_pair((int)MemoryChunk::sync_async, false);
+
+ } else {
+- return std::make_pair(MemoryChunk::sync_async, true);
++ return std::make_pair((int)MemoryChunk::sync_async, true);
+ }
+ }
+
diff --git a/net/libtorrent/patches/patch-src_data_chunk__list.h b/net/libtorrent/patches/patch-src_data_chunk__list.h
new file mode 100644
index 00000000000..a39ae6a6e8b
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_data_chunk__list.h
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_data_chunk__list.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/data/chunk_list.h.orig 2012-02-19 09:28:55.000000000 +0000
++++ src/data/chunk_list.h
+@@ -39,7 +39,13 @@
+
+ #include <string>
+ #include <vector>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+
+ #include "chunk.h"
+ #include "chunk_handle.h"
+@@ -59,9 +65,9 @@ public:
+ typedef std::vector<ChunkListNode> base_type;
+ typedef std::vector<ChunkListNode*> Queue;
+
+- typedef std::tr1::function<Chunk* (uint32_t, int)> slot_chunk_index;
+- typedef std::tr1::function<uint64_t ()> slot_value;
+- typedef std::tr1::function<void (const std::string&)> slot_string;
++ typedef function<Chunk* (uint32_t, int)> slot_chunk_index;
++ typedef function<uint64_t ()> slot_value;
++ typedef function<void (const std::string&)> slot_string;
+
+ using base_type::value_type;
+ using base_type::reference;
diff --git a/net/libtorrent/patches/patch-src_data_hash__check__queue.h b/net/libtorrent/patches/patch-src_data_hash__check__queue.h
new file mode 100644
index 00000000000..2099e234f6e
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_data_hash__check__queue.h
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_data_hash__check__queue.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/data/hash_check_queue.h.orig 2012-02-14 03:15:27.000000000 +0000
++++ src/data/hash_check_queue.h
+@@ -39,7 +39,13 @@
+
+ #include <deque>
+ #include <pthread.h>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+
+ #include "rak/allocators.h"
+
+@@ -51,7 +57,7 @@ class HashChunk;
+ class lt_cacheline_aligned HashCheckQueue : private std::deque<HashChunk*, rak::cacheline_allocator<HashChunk*> > {
+ public:
+ typedef std::deque<HashChunk*, rak::cacheline_allocator<HashChunk*> > base_type;
+- typedef std::tr1::function<void (HashChunk*, const HashString&)> slot_chunk_handle;
++ typedef function<void (HashChunk*, const HashString&)> slot_chunk_handle;
+
+ using base_type::iterator;
+
diff --git a/net/libtorrent/patches/patch-src_data_hash__queue.cc b/net/libtorrent/patches/patch-src_data_hash__queue.cc
new file mode 100644
index 00000000000..59d9be3cccf
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_data_hash__queue.cc
@@ -0,0 +1,45 @@
+$NetBSD: patch-src_data_hash__queue.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/data/hash_queue.cc.orig 2012-04-02 07:04:22.000000000 +0000
++++ src/data/hash_queue.cc
+@@ -54,11 +54,17 @@
+ #include "globals.h"
+ #include "thread_disk.h"
+
++#if __cplusplus >= 201103L
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ #define LT_LOG_DATA(data, log_level, log_fmt, ...) \
+ lt_log_print_data(LOG_STORAGE_##log_level, data, "hash_queue", log_fmt, __VA_ARGS__);
+
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+
+ struct HashQueueEqual {
+@@ -87,7 +93,7 @@ HashQueue::HashQueue(thread_disk* thread
+ m_thread_disk(thread) {
+
+ pthread_mutex_init(&m_done_chunks_lock, NULL);
+- m_thread_disk->hash_queue()->slot_chunk_done() = tr1::bind(&HashQueue::chunk_done, this, tr1::placeholders::_1, tr1::placeholders::_2);
++ m_thread_disk->hash_queue()->slot_chunk_done() = bind(&HashQueue::chunk_done, this, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2);
+ }
+
+
+@@ -176,9 +182,9 @@ HashQueue::work() {
+ // TODO: This is not optimal as we jump around... Check for front
+ // of HashQueue in done_chunks instead.
+
+- iterator itr = std::find_if(begin(), end(), tr1::bind(std::equal_to<HashChunk*>(),
++ iterator itr = std::find_if(begin(), end(), bind(std::equal_to<HashChunk*>(),
+ hash_chunk,
+- tr1::bind(&HashQueueNode::get_chunk, tr1::placeholders::_1)));
++ bind(&HashQueueNode::get_chunk, STD_PLACEHOLDERS::_1)));
+
+ // TODO: Fix this...
+ if (itr == end())
diff --git a/net/libtorrent/patches/patch-src_data_hash__queue.h b/net/libtorrent/patches/patch-src_data_hash__queue.h
new file mode 100644
index 00000000000..dd046cae596
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_data_hash__queue.h
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_data_hash__queue.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/data/hash_queue.h.orig 2012-02-17 05:00:42.000000000 +0000
++++ src/data/hash_queue.h
+@@ -40,7 +40,13 @@
+ #include <deque>
+ #include <map>
+ #include <pthread.h>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+
+ #include "torrent/hash_string.h"
+ #include "hash_queue_node.h"
+@@ -63,7 +69,7 @@ public:
+ typedef std::map<HashChunk*, torrent::HashString> done_chunks_type;
+
+ typedef HashQueueNode::slot_done_type slot_done_type;
+- typedef std::tr1::function<void (bool)> slot_bool;
++ typedef function<void (bool)> slot_bool;
+
+ using base_type::iterator;
+
diff --git a/net/libtorrent/patches/patch-src_data_hash__queue__node.h b/net/libtorrent/patches/patch-src_data_hash__queue__node.h
new file mode 100644
index 00000000000..44c53eca4f9
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_data_hash__queue__node.h
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_data_hash__queue__node.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/data/hash_queue_node.h.orig 2012-03-20 15:10:16.000000000 +0000
++++ src/data/hash_queue_node.h
+@@ -38,7 +38,13 @@
+ #define LIBTORRENT_DATA_HASH_QUEUE_NODE_H
+
+ #include <string>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <inttypes.h>
+
+ #include "chunk_handle.h"
+@@ -50,7 +56,7 @@ class download_data;
+
+ class HashQueueNode {
+ public:
+- typedef std::tr1::function<void (ChunkHandle, const char*)> slot_done_type;
++ typedef function<void (ChunkHandle, const char*)> slot_done_type;
+ typedef download_data* id_type;
+
+ HashQueueNode(id_type id, HashChunk* c, slot_done_type d) :
diff --git a/net/libtorrent/patches/patch-src_data_memory__chunk.h b/net/libtorrent/patches/patch-src_data_memory__chunk.h
new file mode 100644
index 00000000000..8015a66e6e3
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_data_memory__chunk.h
@@ -0,0 +1,53 @@
+$NetBSD: patch-src_data_memory__chunk.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/data/memory_chunk.h.orig 2012-01-19 10:19:26.000000000 +0000
++++ src/data/memory_chunk.h
+@@ -49,28 +49,30 @@ class MemoryChunk {
+ // Consider information about whetever the memory maps to a file or
+ // not, since mincore etc can only be called on files.
+
+- static const int prot_exec = PROT_EXEC;
+- static const int prot_read = PROT_READ;
+- static const int prot_write = PROT_WRITE;
+- static const int prot_none = PROT_NONE;
+- static const int map_shared = MAP_SHARED;
++ enum {
++ prot_exec = PROT_EXEC,
++ prot_read = PROT_READ,
++ prot_write = PROT_WRITE,
++ prot_none = PROT_NONE,
++ map_shared = MAP_SHARED,
+
+ #ifdef USE_MADVISE
+- static const int advice_normal = MADV_NORMAL;
+- static const int advice_random = MADV_RANDOM;
+- static const int advice_sequential = MADV_SEQUENTIAL;
+- static const int advice_willneed = MADV_WILLNEED;
+- static const int advice_dontneed = MADV_DONTNEED;
++ advice_normal = MADV_NORMAL,
++ advice_random = MADV_RANDOM,
++ advice_sequential = MADV_SEQUENTIAL,
++ advice_willneed = MADV_WILLNEED,
++ advice_dontneed = MADV_DONTNEED,
+ #else
+- static const int advice_normal = 0;
+- static const int advice_random = 1;
+- static const int advice_sequential = 2;
+- static const int advice_willneed = 3;
+- static const int advice_dontneed = 4;
++ advice_normal = 0,
++ advice_random = 1,
++ advice_sequential = 2,
++ advice_willneed = 3,
++ advice_dontneed = 4,
+ #endif
+- static const int sync_sync = MS_SYNC;
+- static const int sync_async = MS_ASYNC;
+- static const int sync_invalidate = MS_INVALIDATE;
++ sync_sync = MS_SYNC,
++ sync_async = MS_ASYNC,
++ sync_invalidate = MS_INVALIDATE
++ };
+
+ MemoryChunk() { clear(); }
+ ~MemoryChunk() { clear(); }
diff --git a/net/libtorrent/patches/patch-src_dht_dht__router.cc b/net/libtorrent/patches/patch-src_dht_dht__router.cc
new file mode 100644
index 00000000000..8c42ce26207
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_dht_dht__router.cc
@@ -0,0 +1,35 @@
+$NetBSD: patch-src_dht_dht__router.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/dht/dht_router.cc.orig 2012-02-14 03:15:27.000000000 +0000
++++ src/dht/dht_router.cc
+@@ -51,6 +51,12 @@
+ #include "dht_tracker.h"
+ #include "dht_transaction.h"
+
++#if __cplusplus >= 201103L
++using std::bind;
++#else
++using std::tr1::bind;
++#endif
++
+ namespace torrent {
+
+ HashString DhtRouter::zero_id;
+@@ -131,7 +137,7 @@ DhtRouter::start(int port) {
+ m_server.start(port);
+
+ // Set timeout slot and schedule it to be called immediately for initial bootstrapping if necessary.
+- m_taskTimeout.slot() = std::tr1::bind(&DhtRouter::receive_timeout_bootstrap, this);
++ m_taskTimeout.slot() = bind(&DhtRouter::receive_timeout_bootstrap, this);
+ priority_queue_insert(&taskScheduler, &m_taskTimeout, (cachedTime + rak::timer::from_seconds(1)).round_seconds());
+ }
+
+@@ -410,7 +416,7 @@ DhtRouter::receive_timeout_bootstrap() {
+ delete m_contacts;
+ m_contacts = NULL;
+
+- m_taskTimeout.slot() = std::tr1::bind(&DhtRouter::receive_timeout, this);
++ m_taskTimeout.slot() = bind(&DhtRouter::receive_timeout, this);
+
+ if (!m_numRefresh) {
+ // If we're still in the startup, do the usual refreshing too.
diff --git a/net/libtorrent/patches/patch-src_dht_dht__server.cc b/net/libtorrent/patches/patch-src_dht_dht__server.cc
new file mode 100644
index 00000000000..2f7f0f309de
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_dht_dht__server.cc
@@ -0,0 +1,26 @@
+$NetBSD: patch-src_dht_dht__server.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/dht/dht_server.cc.orig 2012-02-14 03:15:27.000000000 +0000
++++ src/dht/dht_server.cc
+@@ -56,6 +56,12 @@
+
+ #include "manager.h"
+
++#if __cplusplus >= 201103L
++using std::bind;
++#else
++using std::tr1::bind;
++#endif
++
+ namespace torrent {
+
+ const char* DhtServer::queries[] = {
+@@ -154,7 +160,7 @@ DhtServer::start(int port) {
+ throw;
+ }
+
+- m_taskTimeout.slot() = std::tr1::bind(&DhtServer::receive_timeout, this);
++ m_taskTimeout.slot() = bind(&DhtServer::receive_timeout, this);
+
+ m_uploadNode.set_list_iterator(m_uploadThrottle->end());
+ m_uploadNode.slot_activate(rak::make_mem_fun(static_cast<SocketBase*>(this), &SocketBase::receive_throttle_up_activate));
diff --git a/net/libtorrent/patches/patch-src_download_download__main.cc b/net/libtorrent/patches/patch-src_download_download__main.cc
new file mode 100644
index 00000000000..3aa03baa0c0
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_download_download__main.cc
@@ -0,0 +1,53 @@
+$NetBSD: patch-src_download_download__main.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/download/download_main.cc.orig 2012-04-20 06:42:32.000000000 +0000
++++ src/download/download_main.cc
+@@ -64,7 +64,13 @@
+ #include "download_main.h"
+ #include "download_wrapper.h"
+
+-namespace tr1 { using namespace std::tr1; }
++#if __cplusplus >= 201103L
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
+
+ namespace torrent {
+
+@@ -103,11 +109,11 @@ DownloadMain::DownloadMain() :
+ m_tracker_list = new TrackerList();
+ m_tracker_controller = new TrackerController(m_tracker_list);
+
+- m_tracker_list->slot_success() = tr1::bind(&TrackerController::receive_success, m_tracker_controller, tr1::placeholders::_1, tr1::placeholders::_2);
+- m_tracker_list->slot_failure() = tr1::bind(&TrackerController::receive_failure, m_tracker_controller, tr1::placeholders::_1, tr1::placeholders::_2);
+- m_tracker_list->slot_scrape_success() = tr1::bind(&TrackerController::receive_scrape, m_tracker_controller, tr1::placeholders::_1);
+- m_tracker_list->slot_tracker_enabled() = tr1::bind(&TrackerController::receive_tracker_enabled, m_tracker_controller, tr1::placeholders::_1);
+- m_tracker_list->slot_tracker_disabled() = tr1::bind(&TrackerController::receive_tracker_disabled, m_tracker_controller, tr1::placeholders::_1);
++ m_tracker_list->slot_success() = bind(&TrackerController::receive_success, m_tracker_controller, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2);
++ m_tracker_list->slot_failure() = bind(&TrackerController::receive_failure, m_tracker_controller, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2);
++ m_tracker_list->slot_scrape_success() = bind(&TrackerController::receive_scrape, m_tracker_controller, STD_PLACEHOLDERS::_1);
++ m_tracker_list->slot_tracker_enabled() = bind(&TrackerController::receive_tracker_enabled, m_tracker_controller, STD_PLACEHOLDERS::_1);
++ m_tracker_list->slot_tracker_disabled() = bind(&TrackerController::receive_tracker_disabled, m_tracker_controller, STD_PLACEHOLDERS::_1);
+
+ m_connectionList = new ConnectionList(this);
+
+@@ -119,12 +125,12 @@ DownloadMain::DownloadMain() :
+ m_delegator.transfer_list()->slot_completed(std::bind1st(std::mem_fun(&DownloadMain::receive_chunk_done), this));
+ m_delegator.transfer_list()->slot_corrupt(std::bind1st(std::mem_fun(&DownloadMain::receive_corrupt_chunk), this));
+
+- m_delayDisconnectPeers.slot() = std::tr1::bind(&ConnectionList::disconnect_queued, m_connectionList);
+- m_taskTrackerRequest.slot() = std::tr1::bind(&DownloadMain::receive_tracker_request, this);
++ m_delayDisconnectPeers.slot() = bind(&ConnectionList::disconnect_queued, m_connectionList);
++ m_taskTrackerRequest.slot() = bind(&DownloadMain::receive_tracker_request, this);
+
+ m_chunkList->set_data(file_list()->mutable_data());
+- m_chunkList->slot_create_chunk() = tr1::bind(&FileList::create_chunk_index, file_list(), tr1::placeholders::_1, tr1::placeholders::_2);
+- m_chunkList->slot_free_diskspace() = tr1::bind(&FileList::free_diskspace, file_list());
++ m_chunkList->slot_create_chunk() = bind(&FileList::create_chunk_index, file_list(), STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2);
++ m_chunkList->slot_free_diskspace() = bind(&FileList::free_diskspace, file_list());
+ }
+
+ DownloadMain::~DownloadMain() {
diff --git a/net/libtorrent/patches/patch-src_download_download__wrapper.cc b/net/libtorrent/patches/patch-src_download_download__wrapper.cc
new file mode 100644
index 00000000000..07f594e5236
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_download_download__wrapper.cc
@@ -0,0 +1,55 @@
+$NetBSD: patch-src_download_download__wrapper.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/download/download_wrapper.cc.orig 2012-04-20 06:42:32.000000000 +0000
++++ src/download/download_wrapper.cc
+@@ -62,7 +62,13 @@
+
+ #include "download_wrapper.h"
+
+-namespace tr1 { using namespace std::tr1; }
++#if __cplusplus >= 201103L
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
+
+ namespace torrent {
+
+@@ -73,13 +79,13 @@ DownloadWrapper::DownloadWrapper() :
+ m_hashChecker(NULL),
+ m_connectionType(0) {
+
+- m_main->delay_download_done().slot() = std::tr1::bind(&download_data::call_download_done, data());
++ m_main->delay_download_done().slot() = bind(&download_data::call_download_done, data());
+
+ m_main->tracker_list()->set_info(info());
+- m_main->tracker_controller()->slot_success() = tr1::bind(&DownloadWrapper::receive_tracker_success, this, tr1::placeholders::_1);
+- m_main->tracker_controller()->slot_failure() = tr1::bind(&DownloadWrapper::receive_tracker_failed, this, tr1::placeholders::_1);
++ m_main->tracker_controller()->slot_success() = bind(&DownloadWrapper::receive_tracker_success, this, STD_PLACEHOLDERS::_1);
++ m_main->tracker_controller()->slot_failure() = bind(&DownloadWrapper::receive_tracker_failed, this, STD_PLACEHOLDERS::_1);
+
+- m_main->chunk_list()->slot_storage_error() = tr1::bind(&DownloadWrapper::receive_storage_error, this, tr1::placeholders::_1);
++ m_main->chunk_list()->slot_storage_error() = bind(&DownloadWrapper::receive_storage_error, this, STD_PLACEHOLDERS::_1);
+ }
+
+ DownloadWrapper::~DownloadWrapper() {
+@@ -122,7 +128,7 @@ DownloadWrapper::initialize(const std::s
+ m_hashChecker->slot_check(rak::make_mem_fun(this, &DownloadWrapper::check_chunk_hash));
+ // m_hashChecker->slot_storage_error(rak::make_mem_fun(this, &DownloadWrapper::receive_storage_error));
+
+- m_hashChecker->delay_checked().slot() = std::tr1::bind(&DownloadWrapper::receive_initial_hash, this);
++ m_hashChecker->delay_checked().slot() = bind(&DownloadWrapper::receive_initial_hash, this);
+ }
+
+ void
+@@ -241,7 +247,7 @@ DownloadWrapper::check_chunk_hash(ChunkH
+ ChunkHandle new_handle = m_main->chunk_list()->get(handle.index(), ChunkList::get_blocking);
+ m_main->chunk_list()->release(&handle);
+
+- hash_queue()->push_back(new_handle, data(), tr1::bind(&DownloadWrapper::receive_hash_done, this, tr1::placeholders::_1, tr1::placeholders::_2));
++ hash_queue()->push_back(new_handle, data(), bind(&DownloadWrapper::receive_hash_done, this, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+ }
+
+ void
diff --git a/net/libtorrent/patches/patch-src_manager.cc b/net/libtorrent/patches/patch-src_manager.cc
new file mode 100644
index 00000000000..a9aed7c3bb7
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_manager.cc
@@ -0,0 +1,36 @@
+$NetBSD: patch-src_manager.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/manager.cc.orig 2012-04-20 06:41:42.000000000 +0000
++++ src/manager.cc
+@@ -59,7 +59,13 @@
+
+ #include "manager.h"
+
+-namespace tr1 { using namespace std::tr1; }
++#if __cplusplus >= 201103L
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
+
+ namespace torrent {
+
+@@ -83,12 +89,12 @@ Manager::Manager() :
+
+ m_hashQueue = new HashQueue(&m_main_thread_disk);
+ m_hashQueue->slot_has_work() =
+- tr1::bind(&thread_base::send_event_signal,
++ bind(&thread_base::send_event_signal,
+ &m_main_thread_main,
+- m_main_thread_main.signal_bitfield()->add_signal(tr1::bind(&HashQueue::work, m_hashQueue)),
+- tr1::placeholders::_1);
++ m_main_thread_main.signal_bitfield()->add_signal(bind(&HashQueue::work, m_hashQueue)),
++ STD_PLACEHOLDERS::_1);
+
+- m_taskTick.slot() = std::tr1::bind(&Manager::receive_tick, this);
++ m_taskTick.slot() = bind(&Manager::receive_tick, this);
+
+ priority_queue_insert(&taskScheduler, &m_taskTick, cachedTime.round_seconds());
+
diff --git a/net/libtorrent/patches/patch-src_net_socket__set.h b/net/libtorrent/patches/patch-src_net_socket__set.h
new file mode 100644
index 00000000000..8561ae63111
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_net_socket__set.h
@@ -0,0 +1,20 @@
+$NetBSD: patch-src_net_socket__set.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/net/socket_set.h.orig 2012-01-19 10:19:26.000000000 +0000
++++ src/net/socket_set.h
+@@ -53,12 +53,12 @@ namespace torrent {
+
+ // Propably should rename to EventSet...
+
+-class SocketSet : private std::vector<Event*, rak::cacheline_allocator<> > {
++class SocketSet : private std::vector<Event*, rak::cacheline_allocator<Event *> > {
+ public:
+ typedef uint32_t size_type;
+
+- typedef std::vector<Event*, rak::cacheline_allocator<> > base_type;
+- typedef std::vector<size_type, rak::cacheline_allocator<> > Table;
++ typedef std::vector<Event*, rak::cacheline_allocator<Event *> > base_type;
++ typedef std::vector<size_type, rak::cacheline_allocator<size_type> > Table;
+
+ static const size_type npos = static_cast<size_type>(-1);
+
diff --git a/net/libtorrent/patches/patch-src_net_throttle__internal.cc b/net/libtorrent/patches/patch-src_net_throttle__internal.cc
new file mode 100644
index 00000000000..68096478541
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_net_throttle__internal.cc
@@ -0,0 +1,26 @@
+$NetBSD: patch-src_net_throttle__internal.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/net/throttle_internal.cc.orig 2012-02-14 03:15:27.000000000 +0000
++++ src/net/throttle_internal.cc
+@@ -47,6 +47,12 @@
+
+ #include "globals.h"
+
++#if __cplusplus >= 201103L
++using std::bind;
++#else
++using std::tr1::bind;
++#endif
++
+ namespace torrent {
+
+ // Plans:
+@@ -62,7 +68,7 @@ ThrottleInternal::ThrottleInternal(int f
+ m_timeLastTick(cachedTime) {
+
+ if (is_root())
+- m_taskTick.slot() = std::tr1::bind(&ThrottleInternal::receive_tick, this);
++ m_taskTick.slot() = bind(&ThrottleInternal::receive_tick, this);
+ }
+
+ ThrottleInternal::~ThrottleInternal() {
diff --git a/net/libtorrent/patches/patch-src_protocol_handshake.cc b/net/libtorrent/patches/patch-src_protocol_handshake.cc
new file mode 100644
index 00000000000..b5e98b3fdaf
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_protocol_handshake.cc
@@ -0,0 +1,26 @@
+$NetBSD: patch-src_protocol_handshake.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/protocol/handshake.cc.orig 2012-02-14 03:15:27.000000000 +0000
++++ src/protocol/handshake.cc
+@@ -55,6 +55,12 @@
+ #include "handshake.h"
+ #include "handshake_manager.h"
+
++#if __cplusplus >= 201103L
++using std::bind;
++#else
++using std::tr1::bind;
++#endif
++
+ namespace torrent {
+
+ const char* Handshake::m_protocol = "BitTorrent protocol";
+@@ -100,7 +106,7 @@ Handshake::Handshake(SocketFd fd, Handsh
+ m_writeBuffer.reset();
+
+ m_taskTimeout.clear_time();
+- m_taskTimeout.slot() = std::tr1::bind(&HandshakeManager::receive_timeout, m, this);
++ m_taskTimeout.slot() = bind(&HandshakeManager::receive_timeout, m, this);
+ }
+
+ Handshake::~Handshake() {
diff --git a/net/libtorrent/patches/patch-src_torrent_data_download__data.h b/net/libtorrent/patches/patch-src_torrent_data_download__data.h
new file mode 100644
index 00000000000..247650f86b0
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_data_download__data.h
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_torrent_data_download__data.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/data/download_data.h.orig 2012-02-19 09:28:55.000000000 +0000
++++ src/torrent/data/download_data.h
+@@ -37,7 +37,13 @@
+ #ifndef LIBTORRENT_DATA_DOWNLOAD_DATA_H
+ #define LIBTORRENT_DATA_DOWNLOAD_DATA_H
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+
+ #include <torrent/common.h>
+ #include <torrent/bitfield.h>
+@@ -57,7 +63,7 @@ public:
+
+ typedef void (function_void)(void);
+
+- typedef std::tr1::function<function_void> slot_void;
++ typedef function<function_void> slot_void;
+
+ download_data() : m_wanted_chunks(0) {}
+
diff --git a/net/libtorrent/patches/patch-src_torrent_data_file.h b/net/libtorrent/patches/patch-src_torrent_data_file.h
new file mode 100644
index 00000000000..5d140d5d0bc
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_data_file.h
@@ -0,0 +1,29 @@
+$NetBSD: patch-src_torrent_data_file.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/data/file.h.orig 2012-01-19 10:19:26.000000000 +0000
++++ src/torrent/data/file.h
+@@ -48,14 +48,16 @@ public:
+
+ typedef std::pair<uint32_t, uint32_t> range_type;
+
+- static const int flag_active = (1 << 0);
+- static const int flag_create_queued = (1 << 1);
+- static const int flag_resize_queued = (1 << 2);
+- static const int flag_fallocate = (1 << 3);
+- static const int flag_previously_created = (1 << 4);
+-
+- static const int flag_prioritize_first = (1 << 5);
+- static const int flag_prioritize_last = (1 << 6);
++ enum {
++ flag_active = (1 << 0),
++ flag_create_queued = (1 << 1),
++ flag_resize_queued = (1 << 2),
++ flag_fallocate = (1 << 3),
++ flag_previously_created = (1 << 4),
++
++ flag_prioritize_first = (1 << 5),
++ flag_prioritize_last = (1 << 6)
++ };
+
+ File();
+ ~File();
diff --git a/net/libtorrent/patches/patch-src_torrent_download__info.h b/net/libtorrent/patches/patch-src_torrent_download__info.h
new file mode 100644
index 00000000000..9c3380e131a
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_download__info.h
@@ -0,0 +1,67 @@
+$NetBSD: patch-src_torrent_download__info.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/download_info.h.orig 2012-04-09 06:38:58.000000000 +0000
++++ src/torrent/download_info.h
+@@ -40,7 +40,13 @@
+ #include <list>
+ #include <string>
+ #include <inttypes.h>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+
+ #include <torrent/rate.h>
+ #include <torrent/hash_string.h>
+@@ -54,13 +60,13 @@ class DownloadMain;
+
+ class DownloadInfo {
+ public:
+- typedef std::tr1::function<uint64_t ()> slot_stat_type;
+- typedef std::tr1::function<void (uint32_t)> slot_chunk_type;
++ typedef function<uint64_t ()> slot_stat_type;
++ typedef function<void (uint32_t)> slot_chunk_type;
+
+- typedef std::list<std::tr1::function<void ()> > signal_void_type;
+- typedef std::list<std::tr1::function<void (const std::string&)> > signal_string_type;
++ typedef std::list<function<void ()> > signal_void_type;
++ typedef std::list<function<void (const std::string&)> > signal_string_type;
+ typedef std::list<slot_chunk_type> signal_chunk_type;
+- typedef std::list<std::tr1::function<void (const std::string&, const char*, size_t)> > signal_dump_type;
++ typedef std::list<function<void (const std::string&, const char*, size_t)> > signal_dump_type;
+
+ enum State {
+ NONE,
+@@ -69,17 +75,19 @@ public:
+ STOPPED
+ };
+
+- static const int flag_open = (1 << 0);
+- static const int flag_active = (1 << 1);
+- static const int flag_compact = (1 << 2);
+- static const int flag_accepting_new_peers = (1 << 3);
+- static const int flag_accepting_seeders = (1 << 4); // Only used during leeching.
+- static const int flag_private = (1 << 5);
+- static const int flag_meta_download = (1 << 6);
+- static const int flag_pex_enabled = (1 << 7);
+- static const int flag_pex_active = (1 << 8);
++ enum {
++ flag_open = (1 << 0),
++ flag_active = (1 << 1),
++ flag_compact = (1 << 2),
++ flag_accepting_new_peers = (1 << 3),
++ flag_accepting_seeders = (1 << 4), // Only used during leeching.
++ flag_private = (1 << 5),
++ flag_meta_download = (1 << 6),
++ flag_pex_enabled = (1 << 7),
++ flag_pex_active = (1 << 8),
+
+- static const int public_flags = flag_accepting_seeders;
++ public_flags = flag_accepting_seeders
++ };
+
+ static const uint32_t unlimited = ~uint32_t();
+
diff --git a/net/libtorrent/patches/patch-src_torrent_download_choke__group.cc b/net/libtorrent/patches/patch-src_torrent_download_choke__group.cc
new file mode 100644
index 00000000000..1f5edd0bb0e
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_download_choke__group.cc
@@ -0,0 +1,46 @@
+$NetBSD: patch-src_torrent_download_choke__group.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/download/choke_group.cc.orig 2012-03-20 16:33:27.000000000 +0000
++++ src/torrent/download/choke_group.cc
+@@ -37,7 +37,15 @@
+ #include "config.h"
+
+ #include <algorithm>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
+ #include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
+
+ #include "choke_group.h"
+ #include "choke_queue.h"
+@@ -48,8 +56,6 @@
+ #include "torrent/exceptions.h"
+ #include "download/download_main.h"
+
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+
+ choke_group::choke_group() :
+@@ -61,14 +67,14 @@ uint64_t
+ choke_group::up_rate() const {
+ return
+ std::for_each(m_first, m_last,
+- rak::accumulate((uint64_t)0, tr1::bind(&Rate::rate, tr1::bind(&resource_manager_entry::up_rate, tr1::placeholders::_1)))).result;
++ rak::accumulate((uint64_t)0, bind(&Rate::rate, bind(&resource_manager_entry::up_rate, STD_PLACEHOLDERS::_1)))).result;
+ }
+
+ uint64_t
+ choke_group::down_rate() const {
+ return
+ std::for_each(m_first, m_last,
+- rak::accumulate((uint64_t)0, tr1::bind(&Rate::rate, tr1::bind(&resource_manager_entry::down_rate, tr1::placeholders::_1)))).result;
++ rak::accumulate((uint64_t)0, bind(&Rate::rate, bind(&resource_manager_entry::down_rate, STD_PLACEHOLDERS::_1)))).result;
+ }
+
+ }
diff --git a/net/libtorrent/patches/patch-src_torrent_download_choke__queue.cc b/net/libtorrent/patches/patch-src_torrent_download_choke__queue.cc
new file mode 100644
index 00000000000..68279fa7a71
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_download_choke__queue.cc
@@ -0,0 +1,12 @@
+$NetBSD: patch-src_torrent_download_choke__queue.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/download/choke_queue.cc.orig 2012-04-20 06:41:42.000000000 +0000
++++ src/torrent/download/choke_queue.cc
+@@ -40,7 +40,6 @@
+ #include <functional>
+ #include <numeric>
+ #include <cstdlib>
+-#include <tr1/functional>
+
+ #include "protocol/peer_connection_base.h"
+ #include "torrent/download/group_entry.h"
diff --git a/net/libtorrent/patches/patch-src_torrent_download_choke__queue.h b/net/libtorrent/patches/patch-src_torrent_download_choke__queue.h
new file mode 100644
index 00000000000..72181deb68d
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_download_choke__queue.h
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_torrent_download_choke__queue.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/download/choke_queue.h.orig 2012-04-20 06:41:42.000000000 +0000
++++ src/torrent/download/choke_queue.h
+@@ -42,7 +42,13 @@
+ #include <list>
+ #include <vector>
+ #include <inttypes.h>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <torrent/download/group_entry.h>
+
+ namespace torrent {
+@@ -66,9 +72,9 @@ struct group_stats {
+
+ class LIBTORRENT_EXPORT choke_queue {
+ public:
+- typedef std::tr1::function<void (int)> slot_unchoke;
+- typedef std::tr1::function<int ()> slot_can_unchoke;
+- typedef std::tr1::function<bool (PeerConnectionBase*, bool)> slot_connection;
++ typedef function<void (int)> slot_unchoke;
++ typedef function<int ()> slot_can_unchoke;
++ typedef function<bool (PeerConnectionBase*, bool)> slot_connection;
+
+ typedef std::vector<weighted_connection> container_type;
+ typedef container_type::value_type value_type;
diff --git a/net/libtorrent/patches/patch-src_torrent_download_group__entry.h b/net/libtorrent/patches/patch-src_torrent_download_group__entry.h
new file mode 100644
index 00000000000..37955903fb3
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_download_group__entry.h
@@ -0,0 +1,58 @@
+$NetBSD: patch-src_torrent_download_group__entry.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/download/group_entry.h.orig 2012-01-19 10:19:26.000000000 +0000
++++ src/torrent/download/group_entry.h
+@@ -39,7 +39,17 @@
+
+ #include <algorithm>
+ #include <vector>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
+ #include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++using std::tr1::function;
++#endif
+ #include <torrent/common.h>
+ #include <torrent/exceptions.h>
+
+@@ -104,7 +114,7 @@ private:
+
+ inline void group_entry::connection_unchoked(PeerConnectionBase* pcb) {
+ container_type::iterator itr = std::find_if(m_unchoked.begin(), m_unchoked.end(),
+- std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++ bind(&weighted_connection::operator==, STD_PLACEHOLDERS::_1, pcb));
+
+ if (itr != m_unchoked.end()) throw internal_error("group_entry::connection_unchoked(pcb) failed.");
+
+@@ -113,7 +123,7 @@ inline void group_entry::connection_unch
+
+ inline void group_entry::connection_queued(PeerConnectionBase* pcb) {
+ container_type::iterator itr = std::find_if(m_queued.begin(), m_queued.end(),
+- std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++ bind(&weighted_connection::operator==, STD_PLACEHOLDERS::_1, pcb));
+
+ if (itr != m_queued.end()) throw internal_error("group_entry::connection_queued(pcb) failed.");
+
+@@ -123,7 +133,7 @@ inline void group_entry::connection_queu
+ inline void
+ group_entry::connection_choked(PeerConnectionBase* pcb) {
+ container_type::iterator itr = std::find_if(m_unchoked.begin(), m_unchoked.end(),
+- std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++ bind(&weighted_connection::operator==, STD_PLACEHOLDERS::_1, pcb));
+
+ if (itr == m_unchoked.end()) throw internal_error("group_entry::connection_choked(pcb) failed.");
+
+@@ -134,7 +144,7 @@ group_entry::connection_choked(PeerConne
+ inline void
+ group_entry::connection_unqueued(PeerConnectionBase* pcb) {
+ container_type::iterator itr = std::find_if(m_queued.begin(), m_queued.end(),
+- std::tr1::bind(&weighted_connection::operator==, std::tr1::placeholders::_1, pcb));
++ bind(&weighted_connection::operator==, STD_PLACEHOLDERS::_1, pcb));
+
+ if (itr == m_queued.end()) throw internal_error("group_entry::connection_unqueued(pcb) failed.");
+
diff --git a/net/libtorrent/patches/patch-src_torrent_download_resource__manager.cc b/net/libtorrent/patches/patch-src_torrent_download_resource__manager.cc
new file mode 100644
index 00000000000..0fbb6fd7137
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_download_resource__manager.cc
@@ -0,0 +1,50 @@
+$NetBSD: patch-src_torrent_download_resource__manager.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/download/resource_manager.cc.orig 2012-04-20 06:41:43.000000000 +0000
++++ src/torrent/download/resource_manager.cc
+@@ -38,8 +38,16 @@
+
+ #include <algorithm>
+ #include <functional>
+-#include <tr1/functional>
+ #include <limits>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++#include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
+ #include <rak/functional.h>
+
+ #include "torrent/exceptions.h"
+@@ -51,8 +59,6 @@
+ #include "choke_queue.h"
+ #include "resource_manager.h"
+
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+
+ const Rate* resource_manager_entry::up_rate() const { return m_download->info()->up_rate(); }
+@@ -73,12 +79,12 @@ ResourceManager::ResourceManager() :
+ choke_base_type::back()->up_queue()->set_heuristics(choke_queue::HEURISTICS_UPLOAD_LEECH);
+ choke_base_type::back()->down_queue()->set_heuristics(choke_queue::HEURISTICS_DOWNLOAD_LEECH);
+
+- choke_base_type::back()->up_queue()->set_slot_unchoke(tr1::bind(&ResourceManager::receive_upload_unchoke, this, tr1::placeholders::_1));
+- choke_base_type::back()->down_queue()->set_slot_unchoke(tr1::bind(&ResourceManager::receive_download_unchoke, this, tr1::placeholders::_1));
+- choke_base_type::back()->up_queue()->set_slot_can_unchoke(tr1::bind(&ResourceManager::retrieve_upload_can_unchoke, this));
+- choke_base_type::back()->down_queue()->set_slot_can_unchoke(tr1::bind(&ResourceManager::retrieve_download_can_unchoke, this));
+- choke_base_type::back()->up_queue()->set_slot_connection(tr1::bind(&PeerConnectionBase::receive_upload_choke, tr1::placeholders::_1, tr1::placeholders::_2));
+- choke_base_type::back()->down_queue()->set_slot_connection(tr1::bind(&PeerConnectionBase::receive_download_choke, tr1::placeholders::_1, tr1::placeholders::_2));
++ choke_base_type::back()->up_queue()->set_slot_unchoke(bind(&ResourceManager::receive_upload_unchoke, this, STD_PLACEHOLDERS::_1));
++ choke_base_type::back()->down_queue()->set_slot_unchoke(bind(&ResourceManager::receive_download_unchoke, this, STD_PLACEHOLDERS::_1));
++ choke_base_type::back()->up_queue()->set_slot_can_unchoke(bind(&ResourceManager::retrieve_upload_can_unchoke, this));
++ choke_base_type::back()->down_queue()->set_slot_can_unchoke(bind(&ResourceManager::retrieve_download_can_unchoke, this));
++ choke_base_type::back()->up_queue()->set_slot_connection(bind(&PeerConnectionBase::receive_upload_choke, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
++ choke_base_type::back()->down_queue()->set_slot_connection(bind(&PeerConnectionBase::receive_download_choke, STD_PLACEHOLDERS::_1, STD_PLACEHOLDERS::_2));
+ }
+
+ ResourceManager::~ResourceManager() {
diff --git a/net/libtorrent/patches/patch-src_torrent_http.h b/net/libtorrent/patches/patch-src_torrent_http.h
new file mode 100644
index 00000000000..f3f4f21a106
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_http.h
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_torrent_http.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/http.h.orig 2012-02-14 03:15:27.000000000 +0000
++++ src/torrent/http.h
+@@ -40,7 +40,13 @@
+ #include <string>
+ #include <iosfwd>
+ #include <list>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -51,9 +57,9 @@ namespace torrent {
+ // Keep in mind that these objects get reused.
+ class LIBTORRENT_EXPORT Http {
+ public:
+- typedef std::tr1::function<void ()> slot_void;
+- typedef std::tr1::function<void (const std::string&)> slot_string;
+- typedef std::tr1::function<Http* (void)> slot_http;
++ typedef function<void ()> slot_void;
++ typedef function<void (const std::string&)> slot_string;
++ typedef function<Http* (void)> slot_http;
+
+ typedef std::list<slot_void> signal_void;
+ typedef std::list<slot_string> signal_string;
diff --git a/net/libtorrent/patches/patch-src_torrent_peer_client__list.cc b/net/libtorrent/patches/patch-src_torrent_peer_client__list.cc
new file mode 100644
index 00000000000..155911b4a00
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_peer_client__list.cc
@@ -0,0 +1,29 @@
+$NetBSD: patch-src_torrent_peer_client__list.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/peer/client_list.cc.orig 2012-02-14 03:15:27.000000000 +0000
++++ src/torrent/peer/client_list.cc
+@@ -38,7 +38,15 @@
+
+ #include <algorithm>
+ #include <rak/string_manip.h>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
+ #include <tr1/functional>
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
+
+ #include "client_list.h"
+ #include "exceptions.h"
+@@ -227,7 +235,7 @@ ClientList::retrieve_id(ClientInfo* dest
+ return false;
+ }
+
+- const_iterator itr = std::find_if(begin() + 1, end(), std::tr1::bind(&ClientInfo::intersects, *dest, std::tr1::placeholders::_1));
++ const_iterator itr = std::find_if(begin() + 1, end(), bind(&ClientInfo::intersects, *dest, STD_PLACEHOLDERS::_1));
+
+ if (itr == end())
+ dest->set_info(begin()->info());
diff --git a/net/libtorrent/patches/patch-src_torrent_peer_connection__list.h b/net/libtorrent/patches/patch-src_torrent_peer_connection__list.h
new file mode 100644
index 00000000000..38f162d28d7
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_peer_connection__list.h
@@ -0,0 +1,44 @@
+$NetBSD: patch-src_torrent_peer_connection__list.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/peer/connection_list.h.orig 2012-04-09 06:38:58.000000000 +0000
++++ src/torrent/peer/connection_list.h
+@@ -39,7 +39,13 @@
+
+ #include <list>
+ #include <vector>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <torrent/common.h>
+ #include <torrent/hash_string.h>
+
+@@ -66,7 +72,7 @@ public:
+ typedef std::vector<Peer*> base_type;
+ typedef std::vector<HashString> queue_type;
+ typedef uint32_t size_type;
+- typedef std::tr1::function<void (Peer*)> slot_peer_type;
++ typedef function<void (Peer*)> slot_peer_type;
+ typedef std::list<slot_peer_type> signal_peer_type;
+
+ typedef PeerConnectionBase* (*slot_new_conn_type)(bool encrypted);
+@@ -90,10 +96,12 @@ public:
+ using base_type::rend;
+
+ // Make sure any change here match PeerList's flags.
+- static const int disconnect_available = (1 << 0);
+- static const int disconnect_quick = (1 << 1);
+- static const int disconnect_unwanted = (1 << 2);
+- static const int disconnect_delayed = (1 << 3);
++ enum {
++ disconnect_available = (1 << 0),
++ disconnect_quick = (1 << 1),
++ disconnect_unwanted = (1 << 2),
++ disconnect_delayed = (1 << 3)
++ };
+
+ ConnectionList(DownloadMain* download);
+
diff --git a/net/libtorrent/patches/patch-src_torrent_poll.h b/net/libtorrent/patches/patch-src_torrent_poll.h
new file mode 100644
index 00000000000..c925cbe7483
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_poll.h
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_torrent_poll.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/poll.h.orig 2012-02-14 04:05:05.000000000 +0000
++++ src/torrent/poll.h
+@@ -37,7 +37,13 @@
+ #ifndef LIBTORRENT_TORRENT_POLL_H
+ #define LIBTORRENT_TORRENT_POLL_H
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -46,7 +52,7 @@ class Event;
+
+ class LIBTORRENT_EXPORT Poll {
+ public:
+- typedef std::tr1::function<Poll* ()> slot_poll;
++ typedef function<Poll* ()> slot_poll;
+
+ static const int poll_worker_thread = 0x1;
+ static const uint32_t flag_waive_global_lock = 0x1;
diff --git a/net/libtorrent/patches/patch-src_torrent_tracker__controller.cc b/net/libtorrent/patches/patch-src_torrent_tracker__controller.cc
new file mode 100644
index 00000000000..92db66ef193
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_tracker__controller.cc
@@ -0,0 +1,28 @@
+$NetBSD: patch-src_torrent_tracker__controller.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/tracker_controller.cc.orig 2012-04-10 12:46:33.000000000 +0000
++++ src/torrent/tracker_controller.cc
+@@ -50,7 +50,11 @@
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...) \
+ lt_log_print_info(LOG_TRACKER_##log_level, m_tracker_list->info(), "tracker_controller", log_fmt, __VA_ARGS__);
+
+-namespace tr1 { using namespace std::tr1; }
++#if __cplusplus >= 201103L
++using std::bind;
++#else
++using std::tr1::bind;
++#endif
+
+ namespace torrent {
+
+@@ -91,8 +95,8 @@ TrackerController::TrackerController(Tra
+ m_tracker_list(trackers),
+ m_private(new tracker_controller_private) {
+
+- m_private->task_timeout.slot() = std::tr1::bind(&TrackerController::do_timeout, this);
+- m_private->task_scrape.slot() = std::tr1::bind(&TrackerController::do_scrape, this);
++ m_private->task_timeout.slot() = bind(&TrackerController::do_timeout, this);
++ m_private->task_scrape.slot() = bind(&TrackerController::do_scrape, this);
+ }
+
+ TrackerController::~TrackerController() {
diff --git a/net/libtorrent/patches/patch-src_torrent_tracker__controller.h b/net/libtorrent/patches/patch-src_torrent_tracker__controller.h
new file mode 100644
index 00000000000..3c96fdba06e
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_tracker__controller.h
@@ -0,0 +1,33 @@
+$NetBSD: patch-src_torrent_tracker__controller.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/tracker_controller.h.orig 2012-03-19 11:36:45.000000000 +0000
++++ src/torrent/tracker_controller.h
+@@ -38,7 +38,13 @@
+ #define LIBTORRENT_TRACKER_CONTROLLER_H
+
+ #include <string>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <torrent/common.h>
+ #include <torrent/tracker.h>
+
+@@ -55,10 +61,10 @@ class LIBTORRENT_EXPORT TrackerControlle
+ public:
+ typedef AddressList address_list;
+
+- typedef std::tr1::function<void (void)> slot_void;
+- typedef std::tr1::function<void (const std::string&)> slot_string;
+- typedef std::tr1::function<uint32_t (AddressList*)> slot_address_list;
+- typedef std::tr1::function<void (Tracker*)> slot_tracker;
++ typedef function<void (void)> slot_void;
++ typedef function<void (const std::string&)> slot_string;
++ typedef function<uint32_t (AddressList*)> slot_address_list;
++ typedef function<void (Tracker*)> slot_tracker;
+
+ static const int flag_send_update = 0x1;
+ static const int flag_send_completed = 0x2;
diff --git a/net/libtorrent/patches/patch-src_torrent_tracker__list.cc b/net/libtorrent/patches/patch-src_torrent_tracker__list.cc
new file mode 100644
index 00000000000..1d33d50a817
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_tracker__list.cc
@@ -0,0 +1,30 @@
+$NetBSD: patch-src_torrent_tracker__list.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/tracker_list.cc.orig 2012-04-09 06:38:58.000000000 +0000
++++ src/torrent/tracker_list.cc
+@@ -56,7 +56,13 @@
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...) \
+ lt_log_print_info(LOG_TRACKER_##log_level, info(), "tracker_list", log_fmt, __VA_ARGS__);
+
+-namespace tr1 { using namespace std::tr1; }
++#if __cplusplus >= 201103L
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
+
+ namespace torrent {
+
+@@ -221,8 +227,8 @@ TrackerList::insert_url(unsigned int gro
+
+ TrackerList::iterator
+ TrackerList::find_url(const std::string& url) {
+- return std::find_if(begin(), end(), tr1::bind(std::equal_to<std::string>(), url,
+- tr1::bind(&Tracker::url, tr1::placeholders::_1)));
++ return std::find_if(begin(), end(), bind(std::equal_to<std::string>(), url,
++ bind(&Tracker::url, STD_PLACEHOLDERS::_1)));
+ }
+
+ TrackerList::iterator
diff --git a/net/libtorrent/patches/patch-src_torrent_tracker__list.h b/net/libtorrent/patches/patch-src_torrent_tracker__list.h
new file mode 100644
index 00000000000..53d7320b20b
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_tracker__list.h
@@ -0,0 +1,31 @@
+$NetBSD: patch-src_torrent_tracker__list.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/tracker_list.h.orig 2012-04-09 06:38:58.000000000 +0000
++++ src/torrent/tracker_list.h
+@@ -41,7 +41,13 @@
+ #include <string>
+ #include <vector>
+ #include <torrent/common.h>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+
+ namespace torrent {
+
+@@ -64,9 +70,9 @@ public:
+ typedef std::vector<Tracker*> base_type;
+ typedef AddressList address_list;
+
+- typedef std::tr1::function<void (Tracker*)> slot_tracker;
+- typedef std::tr1::function<void (Tracker*, const std::string&)> slot_string;
+- typedef std::tr1::function<uint32_t (Tracker*, AddressList*)> slot_address_list;
++ typedef function<void (Tracker*)> slot_tracker;
++ typedef function<void (Tracker*, const std::string&)> slot_string;
++ typedef function<uint32_t (Tracker*, AddressList*)> slot_address_list;
+
+ using base_type::value_type;
+
diff --git a/net/libtorrent/patches/patch-src_torrent_utils_extents.h b/net/libtorrent/patches/patch-src_torrent_utils_extents.h
new file mode 100644
index 00000000000..4a13867c7b9
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_utils_extents.h
@@ -0,0 +1,46 @@
+$NetBSD: patch-src_torrent_utils_extents.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/utils/extents.h.orig 2012-02-24 06:24:02.000000000 +0000
++++ src/torrent/utils/extents.h
+@@ -37,7 +37,13 @@
+ #ifndef LIBTORRENT_UTILS_EXTENTS_H
+ #define LIBTORRENT_UTILS_EXTENTS_H
+
++#if __cplusplus >= 201103L
++#include <array>
++using std::array;
++#else
+ #include <tr1/array>
++using std::tr1::array;
++#endif
+
+ namespace torrent {
+
+@@ -48,12 +54,24 @@ struct extents_base {
+ typedef std::pair<extents_base*, Tp> mapped_type;
+ typedef Tp mapped_value_type;
+
+- typedef std::tr1::array<mapped_type, TableSize> table_type;
++ typedef array<mapped_type, TableSize> table_type;
+
+ extents_base(key_type pos, unsigned int mb, mapped_value_type val) :
+- mask_bits(mb), position(pos) { table.assign(mapped_type(NULL, mapped_value_type())); }
++ mask_bits(mb), position(pos) {
++#if __cplusplus >= 201103L
++ table.fill(mapped_type(NULL, mapped_value_type()));
++#else
++ table.assign(mapped_type(NULL, mapped_value_type()));
++#endif
++ }
+ extents_base(extents_base* parent, typename table_type::const_iterator itr) :
+- mask_bits(parent->mask_bits - TableBits), position(parent->partition_pos(itr)) { table.assign(mapped_type(NULL, itr->second)); }
++ mask_bits(parent->mask_bits - TableBits), position(parent->partition_pos(itr)) {
++#if __cplusplus >= 201103L
++ table.fill(mapped_type(NULL, itr->second));
++#else
++ table.assign(mapped_type(NULL, itr->second));
++#endif
++ }
+ ~extents_base();
+
+ bool is_divisible(key_type key) const { return key % mask_bits == 0; }
diff --git a/net/libtorrent/patches/patch-src_torrent_utils_log.cc b/net/libtorrent/patches/patch-src_torrent_utils_log.cc
new file mode 100644
index 00000000000..c231cef8fa9
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_utils_log.cc
@@ -0,0 +1,50 @@
+$NetBSD: patch-src_torrent_utils_log.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/utils/log.cc.orig 2012-03-20 15:10:16.000000000 +0000
++++ src/torrent/utils/log.cc
+@@ -54,10 +54,15 @@
+ #include <fstream>
+ #include <functional>
+ #include <memory>
++#if __cplusplus >= 201103L
++#include <memory>
++#include <functional>
++namespace tr1 { using namespace std; }
++#else
+ #include <tr1/functional>
+ #include <tr1/memory>
+-
+ namespace tr1 { using namespace std::tr1; }
++#endif
+
+ namespace torrent {
+
+@@ -158,6 +163,7 @@ log_group::internal_print(const HashStri
+ va_list ap;
+ unsigned int buffer_size = 4096;
+ char buffer[buffer_size];
++ char *bufp = buffer;
+ char* first = buffer;
+
+ if (hash != NULL && subsystem != NULL) {
+@@ -176,7 +182,7 @@ log_group::internal_print(const HashStri
+ pthread_mutex_lock(&log_mutex);
+ std::for_each(m_first, m_last, tr1::bind(&log_slot::operator(),
+ tr1::placeholders::_1,
+- buffer,
++ bufp,
+ std::distance(buffer, first),
+ std::distance(log_groups.begin(), this)));
+ if (dump_data != NULL)
+@@ -238,7 +244,11 @@ void
+ log_cleanup() {
+ pthread_mutex_lock(&log_mutex);
+
++#if __cplusplus >= 201103L
++ log_groups.fill(log_group());
++#else
+ log_groups.assign(log_group());
++#endif
+ log_outputs.clear();
+ log_children.clear();
+
diff --git a/net/libtorrent/patches/patch-src_torrent_utils_log.h b/net/libtorrent/patches/patch-src_torrent_utils_log.h
new file mode 100644
index 00000000000..9bf534b51c8
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_utils_log.h
@@ -0,0 +1,40 @@
+$NetBSD: patch-src_torrent_utils_log.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/utils/log.h.orig 2012-04-20 06:41:43.000000000 +0000
++++ src/torrent/utils/log.h
+@@ -39,8 +39,17 @@
+
+ #include <string>
+ #include <vector>
++#if __cplusplus >= 201103L
++#include <array>
++#include <functional>
++using std::array;
++using std::function;
++#else
+ #include <tr1/array>
+ #include <tr1/functional>
++using std::tr1::array;
++using std::tr1::function;
++#endif
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -147,7 +156,7 @@ class DownloadInfo;
+ class download_data;
+ class log_buffer;
+
+-typedef std::tr1::function<void (const char*, unsigned int, int)> log_slot;
++typedef function<void (const char*, unsigned int, int)> log_slot;
+ typedef std::vector<std::pair<std::string, log_slot> > log_output_list;
+
+ class LIBTORRENT_EXPORT log_group {
+@@ -185,7 +194,7 @@ private:
+ log_slot* m_last;
+ };
+
+-typedef std::tr1::array<log_group, LOG_GROUP_MAX_SIZE> log_group_list;
++typedef array<log_group, LOG_GROUP_MAX_SIZE> log_group_list;
+
+ extern log_group_list log_groups LIBTORRENT_EXPORT;
+ extern log_output_list log_outputs LIBTORRENT_EXPORT;
diff --git a/net/libtorrent/patches/patch-src_torrent_utils_log__buffer.cc b/net/libtorrent/patches/patch-src_torrent_utils_log__buffer.cc
new file mode 100644
index 00000000000..57deb8a471b
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_utils_log__buffer.cc
@@ -0,0 +1,20 @@
+$NetBSD: patch-src_torrent_utils_log__buffer.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/utils/log_buffer.cc.orig 2012-03-13 12:09:16.000000000 +0000
++++ src/torrent/utils/log_buffer.cc
+@@ -39,11 +39,14 @@
+ #include "log_buffer.h"
+
+ #include <functional>
+-#include <tr1/functional>
+
+ #include "globals.h"
+
++#if __cplusplus >= 201103L
++namespace tr1 { using namespace std; }
++#else
+ namespace tr1 { using namespace std::tr1; }
++#endif
+
+ namespace torrent {
+
diff --git a/net/libtorrent/patches/patch-src_torrent_utils_log__buffer.h b/net/libtorrent/patches/patch-src_torrent_utils_log__buffer.h
new file mode 100644
index 00000000000..4c5d6e96cd8
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_utils_log__buffer.h
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_torrent_utils_log__buffer.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/utils/log_buffer.h.orig 2012-03-13 12:09:16.000000000 +0000
++++ src/torrent/utils/log_buffer.h
+@@ -40,7 +40,13 @@
+ #include <string>
+ #include <deque>
+ #include <pthread.h>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -60,7 +66,7 @@ struct log_entry {
+ class LIBTORRENT_EXPORT log_buffer : private std::deque<log_entry> {
+ public:
+ typedef std::deque<log_entry> base_type;
+- typedef std::tr1::function<void ()> slot_void;
++ typedef function<void ()> slot_void;
+
+ using base_type::iterator;
+ using base_type::const_iterator;
diff --git a/net/libtorrent/patches/patch-src_torrent_utils_signal__bitfield.h b/net/libtorrent/patches/patch-src_torrent_utils_signal__bitfield.h
new file mode 100644
index 00000000000..3324f275e2b
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_utils_signal__bitfield.h
@@ -0,0 +1,27 @@
+$NetBSD: patch-src_torrent_utils_signal__bitfield.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/utils/signal_bitfield.h.orig 2012-04-20 06:41:43.000000000 +0000
++++ src/torrent/utils/signal_bitfield.h
+@@ -37,7 +37,13 @@
+ #ifndef LIBTORRENT_UTILS_SIGNAL_BITFIELD_H
+ #define LIBTORRENT_UTILS_SIGNAL_BITFIELD_H
+
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+ #include <torrent/common.h>
+
+ namespace torrent {
+@@ -45,7 +51,7 @@ namespace torrent {
+ class LIBTORRENT_EXPORT lt_cacheline_aligned signal_bitfield {
+ public:
+ typedef uint32_t bitfield_type;
+- typedef std::tr1::function<void ()> slot_type;
++ typedef function<void ()> slot_type;
+
+ static const unsigned int max_size = 32;
+
diff --git a/net/libtorrent/patches/patch-src_torrent_utils_thread__base.h b/net/libtorrent/patches/patch-src_torrent_utils_thread__base.h
new file mode 100644
index 00000000000..e6ef50fa952
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_torrent_utils_thread__base.h
@@ -0,0 +1,29 @@
+$NetBSD: patch-src_torrent_utils_thread__base.h,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/torrent/utils/thread_base.h.orig 2012-03-05 12:18:18.000000000 +0000
++++ src/torrent/utils/thread_base.h
+@@ -41,7 +41,13 @@
+ #include <sys/types.h>
+ #include <torrent/common.h>
+ #include <torrent/utils/signal_bitfield.h>
++#if __cplusplus >= 201103L
++#include <functional>
++using std::function;
++#else
+ #include <tr1/functional>
++using std::tr1::function;
++#endif
+
+ namespace torrent {
+
+@@ -50,8 +56,8 @@ class Poll;
+ class LIBTORRENT_EXPORT lt_cacheline_aligned thread_base {
+ public:
+ typedef void* (*pthread_func)(void*);
+- typedef std::tr1::function<void ()> slot_void;
+- typedef std::tr1::function<uint64_t ()> slot_timer;
++ typedef function<void ()> slot_void;
++ typedef function<uint64_t ()> slot_timer;
+ typedef class signal_bitfield signal_type;
+
+ enum state_type {
diff --git a/net/libtorrent/patches/patch-src_tracker_tracker__http.cc b/net/libtorrent/patches/patch-src_tracker_tracker__http.cc
new file mode 100644
index 00000000000..24e027010a5
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_tracker_tracker__http.cc
@@ -0,0 +1,38 @@
+$NetBSD: patch-src_tracker_tracker__http.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/tracker/tracker_http.cc.orig 2012-03-19 11:36:45.000000000 +0000
++++ src/tracker/tracker_http.cc
+@@ -58,14 +58,20 @@
+ #include "globals.h"
+ #include "manager.h"
+
++#if __cplusplus >= 201103L
++using std::bind;
++#define STD_PLACEHOLDERS std::placeholders
++#else
++using std::tr1::bind;
++#define STD_PLACEHOLDERS std::tr1::placeholders
++#endif
++
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...) \
+ lt_log_print_info(LOG_TRACKER_##log_level, m_parent->info(), "tracker", "[%u] " log_fmt, group(), __VA_ARGS__);
+
+ #define LT_LOG_TRACKER_DUMP(log_level, log_dump_data, log_dump_size, log_fmt, ...) \
+ lt_log_print_info_dump(LOG_TRACKER_##log_level, log_dump_data, log_dump_size, m_parent->info(), "tracker", "[%u] " log_fmt, group(), __VA_ARGS__);
+
+-namespace tr1 { using namespace std::tr1; }
+-
+ namespace torrent {
+
+ TrackerHttp::TrackerHttp(TrackerList* parent, const std::string& url, int flags) :
+@@ -74,8 +80,8 @@ TrackerHttp::TrackerHttp(TrackerList* pa
+ m_get(Http::slot_factory()()),
+ m_data(NULL) {
+
+- m_get->signal_done().push_back(tr1::bind(&TrackerHttp::receive_done, this));
+- m_get->signal_failed().push_back(tr1::bind(&TrackerHttp::receive_failed, this, tr1::placeholders::_1));
++ m_get->signal_done().push_back(bind(&TrackerHttp::receive_done, this));
++ m_get->signal_failed().push_back(bind(&TrackerHttp::receive_failed, this, STD_PLACEHOLDERS::_1));
+
+ // Haven't considered if this needs any stronger error detection,
+ // can dropping the '?' be used for malicious purposes?
diff --git a/net/libtorrent/patches/patch-src_tracker_tracker__udp.cc b/net/libtorrent/patches/patch-src_tracker_tracker__udp.cc
new file mode 100644
index 00000000000..49029c611c3
--- /dev/null
+++ b/net/libtorrent/patches/patch-src_tracker_tracker__udp.cc
@@ -0,0 +1,26 @@
+$NetBSD: patch-src_tracker_tracker__udp.cc,v 1.3 2013/09/18 16:32:05 joerg Exp $
+
+--- src/tracker/tracker_udp.cc.orig 2012-04-20 06:42:32.000000000 +0000
++++ src/tracker/tracker_udp.cc
+@@ -56,6 +56,12 @@
+ #include "tracker_udp.h"
+ #include "manager.h"
+
++#if __cplusplus >= 201103L
++using std::bind;
++#else
++using std::tr1::bind;
++#endif
++
+ #define LT_LOG_TRACKER(log_level, log_fmt, ...) \
+ lt_log_print_info(LOG_TRACKER_##log_level, m_parent->info(), "tracker", "[%u] " log_fmt, group(), __VA_ARGS__);
+
+@@ -71,7 +77,7 @@ TrackerUdp::TrackerUdp(TrackerList* pare
+ m_readBuffer(NULL),
+ m_writeBuffer(NULL) {
+
+- m_taskTimeout.slot() = std::tr1::bind(&TrackerUdp::receive_timeout, this);
++ m_taskTimeout.slot() = bind(&TrackerUdp::receive_timeout, this);
+ }
+
+ TrackerUdp::~TrackerUdp() {