commit: 14f97366f8fe3aa3faaa681d59822eadeaf492c2
parent: 1285c1562682b919421103baba5c91018c968dad
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date: Mon, 30 Apr 2018 05:44:44 +0200
net-libs/libtorrent: Fix linking
Few test are failing tho…
Diffstat:
4 files changed, 145 insertions(+), 32 deletions(-)
diff --git a/net-libs/libtorrent/files/libtorrent-0.13.6-462f358f_fixed_c++11_issues.patch b/net-libs/libtorrent/files/libtorrent-0.13.6-462f358f_fixed_c++11_issues.patch
@@ -0,0 +1,142 @@
+commit 462f358f8fb3f842c2086b96d396c7d27736add9
+Author: rakshasa <sundell.software@gmail.com>
+Date: Tue May 13 21:40:48 2014 +0900
+
+ Fixed C++11 issues.
+
+ Note: Backported to librtorrent-0.13.5-r1 by Haelwenn (lanodan) Monnier
+
+diff --git a/src/data/memory_chunk.cc b/src/data/memory_chunk.cc
+index 1c31fb08..b30a4035 100644
+--- a/src/data/memory_chunk.cc
++++ b/src/data/memory_chunk.cc
+@@ -56,6 +56,22 @@ namespace torrent {
+
+ uint32_t MemoryChunk::m_pagesize = getpagesize();
+
++const int MemoryChunk::sync_sync;
++const int MemoryChunk::sync_async;
++const int MemoryChunk::sync_invalidate;
++
++const int MemoryChunk::prot_exec;
++const int MemoryChunk::prot_read;
++const int MemoryChunk::prot_write;
++const int MemoryChunk::prot_none;
++const int MemoryChunk::map_shared;
++
++const int MemoryChunk::advice_normal;
++const int MemoryChunk::advice_random;
++const int MemoryChunk::advice_sequential;
++const int MemoryChunk::advice_willneed;
++const int MemoryChunk::advice_dontneed;
++
+ inline void
+ MemoryChunk::align_pair(uint32_t* offset, uint32_t* length) const {
+ *offset += page_align();
+diff --git a/src/protocol/request_list.cc b/src/protocol/request_list.cc
+index e963f9f2..a4338bcb 100644
+--- a/src/protocol/request_list.cc
++++ b/src/protocol/request_list.cc
+@@ -52,6 +52,8 @@
+
+ namespace torrent {
+
++const int request_list_constants::bucket_count;
++
+ const instrumentation_enum request_list_constants::instrumentation_added[bucket_count] = {
+ INSTRUMENTATION_TRANSFER_REQUESTS_QUEUED_ADDED,
+ INSTRUMENTATION_TRANSFER_REQUESTS_UNORDERED_ADDED,
+diff --git a/src/torrent/utils/signal_bitfield.cc b/src/torrent/utils/signal_bitfield.cc
+index 44029496..82f81e7c 100644
+--- a/src/torrent/utils/signal_bitfield.cc
++++ b/src/torrent/utils/signal_bitfield.cc
+@@ -42,6 +42,8 @@
+
+ namespace torrent {
+
++const unsigned int signal_bitfield::max_size;
++
+ // Only the thread owning this signal bitfield should add signals.
+ unsigned int
+ signal_bitfield::add_signal(slot_type slot) {
+diff --git a/test/torrent/tracker_list_test.cc b/test/torrent/tracker_list_test.cc
+index a23bbde6..55e141af 100644
+--- a/test/torrent/tracker_list_test.cc
++++ b/test/torrent/tracker_list_test.cc
+@@ -101,8 +101,8 @@ tracker_list_test::test_enable() {
+ int enabled_counter = 0;
+ int disabled_counter = 0;
+
+- tracker_list.slot_tracker_enabled() = std::bind(&increment_value, &enabled_counter);
+- tracker_list.slot_tracker_disabled() = std::bind(&increment_value, &disabled_counter);
++ tracker_list.slot_tracker_enabled() = std::bind(&increment_value, &enabled_counter);
++ tracker_list.slot_tracker_disabled() = std::bind(&increment_value, &disabled_counter);
+
+ TRACKER_INSERT(0, tracker_0);
+ TRACKER_INSERT(1, tracker_1);
+diff --git a/test/torrent/tracker_list_test.h b/test/torrent/tracker_list_test.h
+index cd5bda88..39fc7c19 100644
+--- a/test/torrent/tracker_list_test.h
++++ b/test/torrent/tracker_list_test.h
+@@ -110,10 +110,10 @@ bool check_has_active_in_group(const torrent::TrackerList* tracker_list, const c
+ int failure_counter = 0; \
+ int scrape_success_counter = 0; \
+ int scrape_failure_counter = 0; \
+- tracker_list.slot_success() = std::bind(&increment_value, &success_counter); \
+- tracker_list.slot_failure() = std::bind(&increment_value, &failure_counter); \
+- tracker_list.slot_scrape_success() = std::bind(&increment_value, &scrape_success_counter); \
+- tracker_list.slot_scrape_failure() = std::bind(&increment_value, &scrape_failure_counter);
++ tracker_list.slot_success() = std::bind(&increment_value, &success_counter); \
++ tracker_list.slot_failure() = std::bind(&increment_value, &failure_counter); \
++ tracker_list.slot_scrape_success() = std::bind(&increment_value, &scrape_success_counter); \
++ tracker_list.slot_scrape_failure() = std::bind(&increment_value, &scrape_failure_counter);
+
+ #define TRACKER_INSERT(group, name) \
+ TrackerTest* name = new TrackerTest(&tracker_list, ""); \
+diff --git a/test/torrent/utils/signal_bitfield_test.cc b/test/torrent/utils/signal_bitfield_test.cc
+index f91d8640..32e2caaa 100644
+--- a/test/torrent/utils/signal_bitfield_test.cc
++++ b/test/torrent/utils/signal_bitfield_test.cc
+@@ -32,7 +32,7 @@ utils_signal_bitfield_test::tearDown() {
+ }
+
+ static bool
+-verify_did_internal_error(tr1::function<void ()> func, bool should_throw) {
++verify_did_internal_error(std::function<unsigned int ()> func, bool should_throw) {
+ bool did_throw = false;
+
+ try {
+diff --git a/test/torrent/utils/test_queue_buckets.cc b/test/torrent/utils/test_queue_buckets.cc
+index 0f5da728..a32d17e7 100644
+--- a/test/torrent/utils/test_queue_buckets.cc
++++ b/test/torrent/utils/test_queue_buckets.cc
+@@ -19,6 +19,8 @@ struct test_constants {
+ static void destroy(Type& obj);
+ };
+
++const int test_constants::bucket_count;
++
+ const torrent::instrumentation_enum test_constants::instrumentation_added[bucket_count] = {
+ torrent::INSTRUMENTATION_TRANSFER_REQUESTS_QUEUED_ADDED,
+ torrent::INSTRUMENTATION_TRANSFER_REQUESTS_UNORDERED_ADDED
+diff --git a/test/torrent/utils/thread_base_test.cc b/test/torrent/utils/thread_base_test.cc
+index b731c2dc..5cb7553f 100644
+--- a/test/torrent/utils/thread_base_test.cc
++++ b/test/torrent/utils/thread_base_test.cc
+@@ -10,7 +10,15 @@
+
+ CPPUNIT_TEST_SUITE_REGISTRATION(utils_thread_base_test);
+
+-namespace tr1 { using namespace std; }
++const int thread_test::test_flag_pre_stop;
++const int thread_test::test_flag_long_timeout;
++
++const int thread_test::test_flag_acquire_global;
++const int thread_test::test_flag_has_global;
++
++const int thread_test::test_flag_do_work;
++const int thread_test::test_flag_pre_poke;
++const int thread_test::test_flag_post_poke;
+
+ void throw_shutdown_exception() { throw torrent::shutdown_exception(); }
+
diff --git a/net-libs/libtorrent/files/libtorrent-0.13.6-patch-src_data_memory_chunk_cc.patch b/net-libs/libtorrent/files/libtorrent-0.13.6-patch-src_data_memory_chunk_cc.patch
@@ -1,16 +0,0 @@
-$OpenBSD: patch-src_data_memory_chunk_cc,v 1.1 2017/05/19 22:25:53 espie Exp $
-
-Index: src/data/memory_chunk.cc
---- src/data/memory_chunk.cc.orig
-+++ src/data/memory_chunk.cc
-@@ -54,6 +54,10 @@ extern "C" int madvise(void *, size_t, int);
-
- namespace torrent {
-
-+const int MemoryChunk::sync_sync;
-+const int MemoryChunk::sync_async;
-+const int MemoryChunk::sync_invalidate;
-+
- uint32_t MemoryChunk::m_pagesize = getpagesize();
-
- inline void
diff --git a/net-libs/libtorrent/files/libtorrent-0.13.6-patch-src_protocol_request_list_cc.patch b/net-libs/libtorrent/files/libtorrent-0.13.6-patch-src_protocol_request_list_cc.patch
@@ -1,13 +0,0 @@
-$OpenBSD: patch-src_protocol_request_list_cc,v 1.1 2017/05/19 22:25:53 espie Exp $
-
-Index: src/protocol/request_list.cc
---- src/protocol/request_list.cc.orig
-+++ src/protocol/request_list.cc
-@@ -52,6 +52,7 @@
-
- namespace torrent {
-
-+const int request_list_constants::bucket_count;
- const instrumentation_enum request_list_constants::instrumentation_added[bucket_count] = {
- INSTRUMENTATION_TRANSFER_REQUESTS_QUEUED_ADDED,
- INSTRUMENTATION_TRANSFER_REQUESTS_UNORDERED_ADDED,
diff --git a/net-libs/libtorrent/libtorrent-0.13.6-r1.ebuild b/net-libs/libtorrent/libtorrent-0.13.6-r1.ebuild
@@ -37,7 +37,7 @@ src_prepare() {
# Fix compiling with Clang by being C++11
append-cxxflags "-std=c++11"
- find "${WORKDIR}" -type f|xargs fgrep -lw tr1|xargs sed -i -e 's,<tr1/,<,' -e 's/std::tr1/std/g'
+ find "${WORKDIR}" -type f|xargs fgrep -lw tr1|xargs sed -i -e 's,<tr1/,<,' -e 's/std::tr1/std/g' -e 's/tr1::bind/std::bind/g'
epatch "${FILESDIR}/libtorrent-0.13.6-clangpatch-src_utils_queue_buckets_h.patch"
epatch "${FILESDIR}/libtorrent-0.13.6-clangpatch-src_torrent_utils_log_cc.patch"
epatch "${FILESDIR}/libtorrent-0.13.6-configure.ac_cppunit_use_pkg-config.patch"
@@ -45,10 +45,10 @@ src_prepare() {
epatch "${FILESDIR}/libtorrent-0.13.6-patch-src_torrent_utils_extents_h.patch"
epatch "${FILESDIR}/libtorrent-0.13.6-patch-src_net_socket_set_h.patch"
+ epatch "${FILESDIR}/libtorrent-0.13.6-462f358f_fixed_c++11_issues.patch"
+
# static members must exist, even have external linkage for some, so that rtorrent can work
epatch \
- "${FILESDIR}/libtorrent-0.13.6-patch-src_data_memory_chunk_cc.patch" \
- "${FILESDIR}/libtorrent-0.13.6-patch-src_protocol_request_list_cc.patch" \
"${FILESDIR}/libtorrent-0.13.6-patch-src_torrent_common_h.patch" \
"${FILESDIR}/libtorrent-0.13.6-patch-src_torrent_data_block_failed_h.patch" \
"${FILESDIR}/libtorrent-0.13.6-patch-src_torrent_data_file_cc.patch" \