1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 PYTHON_COMPAT=( python2_7 python3_6 )
7 PYTHON_REQ_USE="threads"
8 DISTUTILS_OPTIONAL=true
9 DISTUTILS_IN_SOURCE_BUILD=true
11 inherit distutils-r1 flag-o-matic
13 MY_PV=$(ver_rs 1-2 '_')
15 DESCRIPTION="C++ BitTorrent implementation focusing on efficiency and scalability"
16 HOMEPAGE="https://libtorrent.org"
17 SRC_URI="https://github.com/arvidn/libtorrent/releases/download/libtorrent-${MY_PV}/${P}.tar.gz"
21 KEYWORDS="amd64 ~arm ~ppc ~ppc64 ~sparc x86"
22 IUSE="debug +dht doc examples libressl python +ssl static-libs test"
24 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
26 RESTRICT="!test? ( test )"
29 dev-libs/boost:=[threads]
31 examples? ( !net-p2p/mldonkey )
34 dev-libs/boost:=[python,${PYTHON_USEDEP}]
37 !libressl? ( dev-libs/openssl:0= )
38 libressl? ( dev-libs/libressl:= )
49 # prepend -L${S}/... to ensure bindings link against the lib we just built
50 sed -i -e "s|^|-L${S}/src/.libs |" bindings/python/link_flags.in || die
52 # prepend -I${S}/... to ensure bindings use the right headers
53 sed -i -e "s|^|-I${S}/src/include |" bindings/python/compile_flags.in || die
55 use python && distutils-r1_src_prepare
59 append-cxxflags -std=c++11 # bug 634506
63 $(use_enable debug disk-stats)
64 $(use_enable debug logging)
66 $(use_enable examples)
67 $(use_enable ssl encryption)
68 $(use_enable static-libs static)
69 $(use_enable test tests)
72 econf "${myeconfargs[@]}"
76 econf "${myeconfargs[@]}" \
77 --enable-python-binding \
78 --with-boost-python="boost_${EPYTHON/./}"
80 distutils-r1_src_configure
88 cd "${BUILD_DIR}/../bindings/python" || die
89 distutils-r1_python_compile
91 use python && distutils-r1_src_compile
95 use doc && HTML_DOCS+=( "${S}"/docs )
100 cd "${BUILD_DIR}/../bindings/python" || die
101 distutils-r1_python_install
103 use python && distutils-r1_src_install
105 find "${D}" -name '*.la' -delete || die