logo

overlay

My (experimental) gentoo overlay
commit: a834c776f0806d7660d023d03a004033e612e1a1
parent: 5b36269c2b60e5525b5cafaf272c5a658098c1bb
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Fri, 27 Apr 2018 17:02:21 +0200

net-libs/libtorrent: New from ::gentoo but with fixes for compiling with clang

Diffstat:

Anet-libs/libtorrent/Manifest1+
Anet-libs/libtorrent/files/libtorrent-0.13.6-clangpatch-src_utils_queue_buckets_h.patch15+++++++++++++++
Anet-libs/libtorrent/files/libtorrent-0.13.6-configure.ac_cppunit_use_pkg-config.patch27+++++++++++++++++++++++++++
Anet-libs/libtorrent/files/libtorrent-0.13.6-patch-src_utils_instrumentation_h.patch15+++++++++++++++
Anet-libs/libtorrent/files/libtorrent-0.13.6-src_dht_dht_transaction_cc.patch28++++++++++++++++++++++++++++
Anet-libs/libtorrent/files/libtorrent-0.13.6-src_net_socket_set_h.patch20++++++++++++++++++++
Anet-libs/libtorrent/files/libtorrent-0.13.6-src_torrent_utils_extents_h.patch45+++++++++++++++++++++++++++++++++++++++++++++
Anet-libs/libtorrent/files/libtorrent-0.13.6-src_torrent_utils_log_cc.patch38++++++++++++++++++++++++++++++++++++++
Anet-libs/libtorrent/libtorrent-0.13.6-r1.ebuild70++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Anet-libs/libtorrent/metadata.xml8++++++++
10 files changed, 267 insertions(+), 0 deletions(-)

diff --git a/net-libs/libtorrent/Manifest b/net-libs/libtorrent/Manifest @@ -0,0 +1 @@ +DIST libtorrent-0.13.6.tar.gz 781253 BLAKE2B f5293309b0e6b64a3659ea839528f94b346e1698f6892383b11f30b6d10d161d88582159ac9f4b1864d47e5f8c84cb3830376dde531d84c47327e7c342c75bbb SHA512 b8aea4060357a8a40d15d42f1f698ef6f3ebdc885000bfbfa5bf9c81af8c88b5503a107e05c214e3e8489126928d336356c5e7e0eaf836b6b84a3cf74633b050 diff --git a/net-libs/libtorrent/files/libtorrent-0.13.6-clangpatch-src_utils_queue_buckets_h.patch b/net-libs/libtorrent/files/libtorrent-0.13.6-clangpatch-src_utils_queue_buckets_h.patch @@ -0,0 +1,15 @@ +$OpenBSD: clangpatch-src_utils_queue_buckets_h,v 1.1 2017/05/19 12:26:43 espie Exp $ +proper typing, from FreeBSD + +Index: src/utils/queue_buckets.h +--- src/utils/queue_buckets.h.orig ++++ src/utils/queue_buckets.h +@@ -251,7 +251,7 @@ queue_buckets<Type, Constants>::destroy(int idx, itera + instrumentation_update(constants::instrumentation_total[idx], -difference); + + // Consider moving these to a temporary dequeue before releasing: +- std::for_each(begin, end, std::function<void (value_type)>(&constants::template destroy<value_type>)); ++ std::for_each(begin, end, std::function<void (value_type&)>(&constants::template destroy<value_type>)); + queue_at(idx).erase(begin, end); + } + diff --git a/net-libs/libtorrent/files/libtorrent-0.13.6-configure.ac_cppunit_use_pkg-config.patch b/net-libs/libtorrent/files/libtorrent-0.13.6-configure.ac_cppunit_use_pkg-config.patch @@ -0,0 +1,27 @@ +diff --git a/configure.ac b/configure.ac +index ba994ee..9920186 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -19,7 +19,6 @@ AC_SUBST(LIBTORRENT_INTERFACE_VERSION_NO) + + AM_INIT_AUTOMAKE + AC_CONFIG_HEADERS(config.h) +-AM_PATH_CPPUNIT(1.9.6) + + AC_PROG_CXX + +@@ -58,9 +57,11 @@ CC_ATTRIBUTE_VISIBILITY + AX_PTHREAD + AX_CHECK_ZLIB + +-CFLAGS="$PTHREAD_CFLAGS $CFLAGS" +-CXXFLAGS="$PTHREAD_CFLAGS $CXXFLAGS" +-LIBS="$PTHREAD_LIBS $LIBS" ++PKG_CHECK_MODULES([CPPUNIT], [cppunit],, [no_cppunit="yes"]) ++ ++CFLAGS="$PTHREAD_CFLAGS $CPPUNIT_CFLAGS $CFLAGS" ++CXXFLAGS="$PTHREAD_CFLAGS $CPPUNIT_CFLAGS $CXXFLAGS" ++LIBS="$PTHREAD_LIBS $CPPUNIT_LIBS $LIBS" + + AC_ARG_ENABLE(openssl, + [ --disable-openssl Don't use OpenSSL's SHA1 implementation.], diff --git a/net-libs/libtorrent/files/libtorrent-0.13.6-patch-src_utils_instrumentation_h.patch b/net-libs/libtorrent/files/libtorrent-0.13.6-patch-src_utils_instrumentation_h.patch @@ -0,0 +1,15 @@ +$OpenBSD: patch-src_utils_instrumentation_h,v 1.2 2017/05/19 22:25:53 espie Exp $ +tr1/std difference, see header + +Index: src/utils/instrumentation.h +--- src/utils/instrumentation.h.orig ++++ src/utils/instrumentation.h +@@ -118,7 +118,7 @@ void instrumentation_reset(); + + inline void + instrumentation_initialize() { +- instrumentation_values.assign(int64_t()); ++ std::fill(instrumentation_values.begin(), instrumentation_values.end(), int64_t()); + } + + inline void diff --git a/net-libs/libtorrent/files/libtorrent-0.13.6-src_dht_dht_transaction_cc.patch b/net-libs/libtorrent/files/libtorrent-0.13.6-src_dht_dht_transaction_cc.patch @@ -0,0 +1,28 @@ +commit 620a70311df192d52957d635a9f2753b265ff61e +Author: rakshasa <sundell.software@gmail.com> +Date: Thu Mar 10 02:44:24 2016 +0900 + + Fixed minor C++ standard compliance issue. + +diff --git a/src/dht/dht_transaction.cc b/src/dht/dht_transaction.cc +index f876e70d..84ffc175 100644 +--- a/src/dht/dht_transaction.cc ++++ b/src/dht/dht_transaction.cc +@@ -46,14 +46,15 @@ + namespace torrent { + + DhtSearch::DhtSearch(const HashString& target, const DhtBucket& contacts) +- : base_type(dht_compare_closer(m_target = target)), ++ : base_type(dht_compare_closer(target)), + m_pending(0), + m_contacted(0), + m_replied(0), + m_concurrency(3), + m_restart(false), + m_started(false), +- m_next(end()) { ++ m_next(end()), ++ m_target(target) { + + add_contacts(contacts); + } diff --git a/net-libs/libtorrent/files/libtorrent-0.13.6-src_net_socket_set_h.patch b/net-libs/libtorrent/files/libtorrent-0.13.6-src_net_socket_set_h.patch @@ -0,0 +1,20 @@ +diff --git a/var/tmp/portage/net-libs/libtorrent-0.13.6-r1/work/libtorrent-0.13.6/./src/net/socket_set.h b/./src/net/socket_set.h +index 6581f26d..9264edf7 100644 +--- a/var/tmp/portage/net-libs/libtorrent-0.13.6-r1/work/libtorrent-0.13.6/./src/net/socket_set.h ++++ b/./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-libs/libtorrent/files/libtorrent-0.13.6-src_torrent_utils_extents_h.patch b/net-libs/libtorrent/files/libtorrent-0.13.6-src_torrent_utils_extents_h.patch @@ -0,0 +1,45 @@ +diff --git a/var/tmp/portage/net-libs/libtorrent-0.13.6-r1/work/libtorrent-0.13.6/src/torrent/utils/extents.h b/src/torrent/utils/extents.h +index 9fe8b0c2..8ec1e600 100644 +--- a/var/tmp/portage/net-libs/libtorrent-0.13.6-r1/work/libtorrent-0.13.6/src/torrent/utils/extents.h ++++ b/src/torrent/utils/extents.h +@@ -37,7 +37,8 @@ + #ifndef LIBTORRENT_UTILS_EXTENTS_H + #define LIBTORRENT_UTILS_EXTENTS_H + + #include <array> ++#include <algorithm> + + namespace torrent { + +@@ -50,10 +52,8 @@ struct extents_base { + + typedef std::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())); } +- 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)); } ++ extents_base(key_type pos, unsigned int mb, mapped_value_type val); ++ extents_base(extents_base* parent, typename table_type::const_iterator itr); + ~extents_base(); + + bool is_divisible(key_type key) const { return key % mask_bits == 0; } +@@ -106,6 +106,18 @@ public: + base_type* data() { return this; } + }; + ++template <typename Key, typename Tp, unsigned int TableSize, unsigned int TableBits> ++extents_base<Key, Tp, TableSize, TableBits>::extents_base(key_type pos, unsigned int mb, mapped_value_type val) : ++ mask_bits(mb), position(pos) { ++ std::fill(table.begin(), table.end(), mapped_type(NULL, mapped_value_type())); ++} ++ ++template <typename Key, typename Tp, unsigned int TableSize, unsigned int TableBits> ++extents_base<Key, Tp, TableSize, TableBits>::extents_base(extents_base* parent, typename table_type::const_iterator itr) : ++ mask_bits(parent->mask_bits - TableBits), position(parent->partition_pos(itr)) { ++ std::fill(table.begin(), table.end(), mapped_type(NULL, itr->second)); ++} ++ + template <typename Key, typename Tp, unsigned int MaskBits, unsigned int TableSize, unsigned int TableBits> + extents<Key, Tp, MaskBits, TableSize, TableBits>::extents() : + base_type(key_type(), mask_bits - table_bits, mapped_value_type()) diff --git a/net-libs/libtorrent/files/libtorrent-0.13.6-src_torrent_utils_log_cc.patch b/net-libs/libtorrent/files/libtorrent-0.13.6-src_torrent_utils_log_cc.patch @@ -0,0 +1,38 @@ +diff --git a/src/torrent/utils/log.cc b/src/torrent/utils/log.cc +index a97b6064..0549e3ca 100644 +--- a/src/torrent/utils/log.cc ++++ b/src/torrent/utils/log.cc +@@ -187,17 +187,14 @@ log_group::internal_print(const HashString* hash, cons + return; + + pthread_mutex_lock(&log_mutex); +- std::for_each(m_first, m_last, std::bind(&log_slot::operator(), +- std::placeholders::_1, +- buffer, +- std::distance(buffer, first), +- std::distance(log_groups.begin(), this))); ++ ++ for (log_slot *it = m_first; it != m_last; ++it) ++ (*it)(buffer, std::distance(buffer, first), ++ std::distance(log_groups.begin(), this)); ++ + if (dump_data != NULL) +- std::for_each(m_first, m_last, std::bind(&log_slot::operator(), +- std::placeholders::_1, +- (const char*)dump_data, +- dump_size, +- -1)); ++ for (log_slot *it = m_first; it != m_last; ++it) ++ (*it)((const char*)dump_data, dump_size, -1); + pthread_mutex_unlock(&log_mutex); + } + +@@ -250,7 +246,7 @@ void + log_cleanup() { + pthread_mutex_lock(&log_mutex); + +- log_groups.assign(log_group()); ++ std::fill(log_groups.begin(), log_groups.end(), log_group()); + log_outputs.clear(); + log_children.clear(); + diff --git a/net-libs/libtorrent/libtorrent-0.13.6-r1.ebuild b/net-libs/libtorrent/libtorrent-0.13.6-r1.ebuild @@ -0,0 +1,70 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 + +inherit eutils libtool toolchain-funcs autotools flag-o-matic + +DESCRIPTION="BitTorrent library written in C++ for *nix" +HOMEPAGE="https://rakshasa.github.io/rtorrent/" +SRC_URI="http://rtorrent.net/downloads/${P}.tar.gz" + +# OpenBSD patches may be under the ISC +LICENSE="GPL-2 ISC" + +# The README says that the library ABI is not yet stable and dependencies on +# the library should be an explicit, syncronized version until the library +# has had more time to mature. Until it matures we should not include a soname +# subslot. +SLOT="0" + +KEYWORDS="~amd64 ~x86" +IUSE="debug ipv6 libressl ssl test" + +RDEPEND=" + sys-libs/zlib + >=dev-libs/libsigc++-2.2.2:2 + ssl? ( + !libressl? ( dev-libs/openssl:0= ) + libressl? ( dev-libs/libressl:= ) + )" +DEPEND="${RDEPEND} + virtual/pkgconfig + test? ( dev-util/cppunit )" + +src_prepare() { + # I should probably move it to a PATCHES variable + + # 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' + epatch "${FILESDIR}/libtorrent-0.13.6-clangpatch-src_utils_queue_buckets_h.patch" + epatch "${FILESDIR}/libtorrent-0.13.6-configure.ac_cppunit_use_pkg-config.patch" + epatch "${FILESDIR}/libtorrent-0.13.6-patch-src_utils_instrumentation_h.patch" + epatch "${FILESDIR}/libtorrent-0.13.6-src_torrent_utils_extents_h.patch" + epatch "${FILESDIR}/libtorrent-0.13.6-src_torrent_utils_log_cc.patch" + epatch "${FILESDIR}/libtorrent-0.13.6-src_net_socket_set_h.patch" + + # Fixes a unassigned warning for a happy QA + epatch "${FILESDIR}/libtorrent-0.13.6-src_dht_dht_transaction_cc.patch" + + eautoreconf + default +} + +src_configure() { + # configure needs bash or script bombs out on some null shift, bug #291229 + CONFIG_SHELL=${BASH} econf \ + --enable-aligned \ + $(use_enable debug) \ + $(use_enable ipv6) \ + $(use_enable ssl openssl) \ + --disable-instrumentation \ + --with-posix-fallocate +} + +src_install() { + default + + prune_libtool_files --all +} diff --git a/net-libs/libtorrent/metadata.xml b/net-libs/libtorrent/metadata.xml @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> +<maintainer type="person"> + <email>contact@hacktivis.me</email> + <name>Haelwenn (lanodan) Monnier</name> +</maintainer> +</pkgmetadata>