1 # Copyright 1999-2017 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
6 inherit bash-completion-r1
8 DESCRIPTION="A download utility with segmented downloading with BitTorrent support"
9 HOMEPAGE="https://aria2.github.io/"
10 SRC_URI="https://github.com/aria2/${PN}/releases/download/release-${PV}/${P}.tar.xz"
13 KEYWORDS="~amd64 ~arm ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
15 IUSE="adns bittorrent +gnutls jemalloc libuv +libxml2 metalink +nettle nls sqlite scripts ssh ssl tcmalloc test xmlrpc"
17 CDEPEND="sys-libs/zlib:0=
19 app-misc/ca-certificates
20 gnutls? ( >=net-libs/gnutls-1.2.9:0= )
21 !gnutls? ( dev-libs/openssl:0= ) )
22 adns? ( >=net-dns/c-ares-1.5.0:0= )
26 nettle? ( >=dev-libs/nettle-2.4:0=[gmp] >=dev-libs/gmp-6:0= )
27 !nettle? ( >=dev-libs/libgcrypt-1.2.2:0= ) ) )
29 nettle? ( >=dev-libs/nettle-2.4:0=[gmp] >=dev-libs/gmp-6:0= )
30 !nettle? ( >=dev-libs/libgcrypt-1.2.2:0= ) ) )
31 jemalloc? ( dev-libs/jemalloc )
32 libuv? ( dev-libs/libuv:0= )
34 libxml2? ( >=dev-libs/libxml2-2.6.26:2= )
35 !libxml2? ( dev-libs/expat:0= ) )
36 sqlite? ( dev-db/sqlite:3= )
37 ssh? ( net-libs/libssh2:= )
38 tcmalloc? ( dev-util/google-perftools )
40 libxml2? ( >=dev-libs/libxml2-2.6.26:2= )
41 !libxml2? ( dev-libs/expat:0= ) )"
46 nls? ( sys-devel/gettext )
47 test? ( >=dev-util/cppunit-1.12.0:0 )"
49 nls? ( virtual/libiconv virtual/libintl )
50 scripts? ( dev-lang/ruby )"
52 # xmlrpc has no explicit switch, it's turned out by any XML library
53 # so metalink implicitly forces it on
54 REQUIRED_USE="?? ( jemalloc tcmalloc )
56 RESTRICT="!test? ( test )"
59 if use scripts && ! use xmlrpc; then
60 ewarn "Please note that you may need to enable USE=xmlrpc to run the aria2rpc"
61 ewarn "and aria2mon scripts against the local aria2."
67 sed -i -e "s|/tmp|${T}|" test/*.cc test/*.txt || die "sed failed"
72 # threads, epoll: check for best portability
74 # do not try to compile and run a test LIBXML program
76 # enable the shared library
78 # zlib should always be available anyway
80 --with-ca-bundle="${EPREFIX}/etc/ssl/certs/ca-certificates.crt"
83 $(use_enable bittorrent)
84 $(use_enable metalink)
86 $(use_with adns libcares)
89 $(use_with sqlite sqlite3)
90 $(use_with ssh libssh2)
94 # SSL := gnutls / openssl
96 # + USE=gnutls -> gnutls
97 # + USE=-gnutls -> openssl
100 myconf+=( $(use_with gnutls) $(use_with !gnutls openssl) )
102 myconf+=( --without-gnutls --without-openssl )
105 # message-digest := nettle / gcrypt / openssl
106 # bignum := nettle+gmp / gcrypt / openssl
107 # bittorrent := message-digest + bignum
109 # + USE=(ssl -gnutls) -> openssl
110 # + USE=nettle -> nettle+gmp
111 # + USE=-nettle -> gcrypt
113 if use !bittorrent || use ssl && use !gnutls; then
114 myconf+=( --without-libgcrypt --without-libnettle --without-libgmp )
116 myconf+=( $(use_with !nettle libgcrypt)
117 $(use_with nettle libnettle) $(use_with nettle libgmp) )
120 # metalink+xmlrpc := libxml2 / expat
121 # USE=(metalink || xmlrpc)
122 # + USE=libxml2 -> libxml2
123 # + USE=-libxml2 -> expat
125 if use metalink || use xmlrpc; then
126 myconf+=( $(use_with !libxml2 libexpat) $(use_with libxml2) )
128 myconf+=( --without-libexpat --without-libxml2 )
132 # - always enable gzip/http compression since zlib should always be available anyway
133 # - always enable epoll since we can assume kernel 2.6.x
134 # - other options for threads: solaris, pth, win32
140 rm -rf "${D}"/usr/share/doc/aria2 \
141 "${D}"/usr/share/doc/${PF}/README{,.html}
143 dobashcomp doc/bash_completion/aria2c
144 use scripts && dobin doc/xmlrpc/aria2{mon,rpc}
149 elog "If you would like to use the additional aria2mon and aria2rpc tools,"
150 elog "you need to have \033[1mdev-lang/ruby\033[0m installed."