diff options
author | Sergei Trofimovich <slyfox@gentoo.org> | 2011-06-09 20:31:45 +0000 |
---|---|---|
committer | Sergei Trofimovich <slyfox@gentoo.org> | 2011-06-09 20:31:45 +0000 |
commit | 5cd5ab23dc2509775fcaf5564da4e8de6f11f481 (patch) | |
tree | b248d09ce22897a083ddcb9ffdaaf21ffa547fd5 /net-libs/libtorrent | |
parent | Fix prefix and multilibness. (diff) | |
download | gentoo-2-5cd5ab23dc2509775fcaf5564da4e8de6f11f481.tar.gz gentoo-2-5cd5ab23dc2509775fcaf5564da4e8de6f11f481.tar.bz2 gentoo-2-5cd5ab23dc2509775fcaf5564da4e8de6f11f481.zip |
Fixed unaligned access on platforms not supporting one (http://libtorrent.rakshasa.no/ticket/1263).
(Portage version: 2.1.9.50/cvs/Linux x86_64)
Diffstat (limited to 'net-libs/libtorrent')
-rw-r--r-- | net-libs/libtorrent/ChangeLog | 10 | ||||
-rw-r--r-- | net-libs/libtorrent/files/libtorrent-0.12.7-DHT-unaligned-access.patch | 61 | ||||
-rw-r--r-- | net-libs/libtorrent/libtorrent-0.12.7-r1.ebuild | 54 |
3 files changed, 124 insertions, 1 deletions
diff --git a/net-libs/libtorrent/ChangeLog b/net-libs/libtorrent/ChangeLog index 695b3f0d0f47..277039983a87 100644 --- a/net-libs/libtorrent/ChangeLog +++ b/net-libs/libtorrent/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for net-libs/libtorrent # Copyright 1999-2011 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-libs/libtorrent/ChangeLog,v 1.157 2011/04/13 21:30:46 sochotnicky Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-libs/libtorrent/ChangeLog,v 1.158 2011/06/09 20:31:45 slyfox Exp $ + +*libtorrent-0.12.7-r1 (09 Jun 2011) + + 09 Jun 2011; Sergei Trofimovich <slyfox@gentoo.org> + +libtorrent-0.12.7-r1.ebuild, + +files/libtorrent-0.12.7-DHT-unaligned-access.patch: + Fixed unaligned access on platforms not supporting one + (http://libtorrent.rakshasa.no/ticket/1263). 13 Apr 2011; Stanislav Ochotnicky <sochotnicky@gentoo.org> libtorrent-0.12.7.ebuild, +files/libtorrent-0.12.7-gcc-4.6.0.patch: diff --git a/net-libs/libtorrent/files/libtorrent-0.12.7-DHT-unaligned-access.patch b/net-libs/libtorrent/files/libtorrent-0.12.7-DHT-unaligned-access.patch new file mode 100644 index 000000000000..aa562607b8d0 --- /dev/null +++ b/net-libs/libtorrent/files/libtorrent-0.12.7-DHT-unaligned-access.patch @@ -0,0 +1,61 @@ +Upstream: http://libtorrent.rakshasa.no/ticket/1263 + +From 6679a23244579f1a5a9930b8ba02e0df9a2a6622 Mon Sep 17 00:00:00 2001 +From: rakshasa <rakshasa@e378c898-3ddf-0310-93e7-cc216c733640> +Date: Tue, 7 Jun 2011 11:37:15 +0000 +Subject: [PATCH] * fixed an issue where DHT's hashing function for TR1 unordered_map was casting unaligned size_t pointers. + +git-svn-id: svn://rakshasa.no/libtorrent/trunk/libtorrent@1235 e378c898-3ddf-0310-93e7-cc216c733640 +--- + src/dht/dht_hash_map.h | 32 ++++++++++++++++++++++++++++---- + 1 files changed, 28 insertions(+), 4 deletions(-) + +diff --git a/src/dht/dht_hash_map.h b/src/dht/dht_hash_map.h +index a8bed6c..04c4991 100644 +--- a/src/dht/dht_hash_map.h ++++ b/src/dht/dht_hash_map.h +@@ -65,13 +65,37 @@ namespace torrent { + static const unsigned int hashstring_hash_ofs = 8; + + struct hashstring_ptr_hash : public std::unary_function<const HashString*, size_t> { +- size_t operator () (const HashString* n) const +- { return *(size_t*)(n->data() + hashstring_hash_ofs); } ++ size_t operator () (const HashString* n) const { ++#if USE_ALIGNED ++ size_t result = 0; ++ const char *first = n->data() + hashstring_hash_ofs; ++ const char *last = first + sizeof(size_t); ++ ++ while (first != last) ++ result = (result << 8) + *first++; ++ ++ return result; ++#else ++ return *(size_t*)(n->data() + hashstring_hash_ofs); ++#endif ++ } + }; + + struct hashstring_hash : public std::unary_function<HashString, size_t> { +- size_t operator () (const HashString& n) const +- { return *(size_t*)(n.data() + hashstring_hash_ofs); } ++ size_t operator () (const HashString& n) const { ++#if USE_ALIGNED ++ size_t result = 0; ++ const char *first = n.data() + hashstring_hash_ofs; ++ const char *last = first + sizeof(size_t); ++ ++ while (first != last) ++ result = (result << 8) + *first++; ++ ++ return result; ++#else ++ return *(size_t*)(n.data() + hashstring_hash_ofs); ++#endif ++ } + }; + + // Compare HashString pointers by dereferencing them. +-- +1.7.3.4 + diff --git a/net-libs/libtorrent/libtorrent-0.12.7-r1.ebuild b/net-libs/libtorrent/libtorrent-0.12.7-r1.ebuild new file mode 100644 index 000000000000..03e44a77f904 --- /dev/null +++ b/net-libs/libtorrent/libtorrent-0.12.7-r1.ebuild @@ -0,0 +1,54 @@ +# Copyright 1999-2011 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/net-libs/libtorrent/libtorrent-0.12.7-r1.ebuild,v 1.1 2011/06/09 20:31:45 slyfox Exp $ + +EAPI=2 +inherit eutils libtool toolchain-funcs + +DESCRIPTION="BitTorrent library written in C++ for *nix" +HOMEPAGE="http://libtorrent.rakshasa.no/" +SRC_URI="http://libtorrent.rakshasa.no/downloads/${P}.tar.gz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd" +IUSE="debug ipv6 ssl" + +RDEPEND=">=dev-libs/libsigc++-2.2.2:2 + ssl? ( dev-libs/openssl )" +DEPEND="${RDEPEND} + dev-util/pkgconfig" + +src_prepare() { + epatch "${FILESDIR}"/${PN}-0.12.6-gcc44.patch + epatch "${FILESDIR}"/${P}-test.patch + epatch "${FILESDIR}"/${P}-gcc-4.6.0.patch + epatch "${FILESDIR}"/download_constructor.diff + epatch "${FILESDIR}"/${P}-DHT-unaligned-access.patch + elibtoolize +} + +src_configure() { + # the configure check for posix_fallocate is wrong. + # reported upstream as Ticket 2416. + local myconf + echo "int main(){return posix_fallocate();}" > "${T}"/posix_fallocate.c + if $(tc-getCC) ${CFLAGS} ${LDFLAGS} "${T}"/posix_fallocate.c -o /dev/null 2>/dev/null ; then + myconf="--with-posix-fallocate" + else + myconf="--without-posix-fallocate" + fi + + econf \ + --disable-dependency-tracking \ + --enable-aligned \ + $(use_enable debug) \ + $(use_enable ipv6) \ + $(use_enable ssl openssl) \ + ${myconf} +} + +src_install() { + emake DESTDIR="${D}" install || die + dodoc AUTHORS NEWS README +} |