*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / net-libs / libtorrent-rasterbar / libtorrent-rasterbar-1.1.13-r1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5
6 PYTHON_COMPAT=( python2_7 python3_6 )
7 PYTHON_REQ_USE="threads"
8 DISTUTILS_OPTIONAL=true
9 DISTUTILS_IN_SOURCE_BUILD=true
10
11 inherit distutils-r1 flag-o-matic
12
13 MY_PV=$(ver_rs 1-2 '_')
14
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"
18
19 LICENSE="BSD"
20 SLOT="0/9"
21 KEYWORDS="amd64 ~arm ~ppc ~ppc64 ~sparc x86"
22 IUSE="debug +dht doc examples libressl python +ssl static-libs test"
23
24 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
25
26 RESTRICT="!test? ( test )"
27
28 RDEPEND="
29         dev-libs/boost:=[threads]
30         virtual/libiconv
31         examples? ( !net-p2p/mldonkey )
32         python? (
33                 ${PYTHON_DEPS}
34                 dev-libs/boost:=[python,${PYTHON_USEDEP}]
35         )
36         ssl? (
37                 !libressl? ( dev-libs/openssl:0= )
38                 libressl? ( dev-libs/libressl:= )
39         )
40 "
41 DEPEND="${RDEPEND}
42         sys-devel/libtool
43 "
44
45 src_prepare() {
46         default
47
48         # bug 578026
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
51
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
54
55         use python && distutils-r1_src_prepare
56 }
57
58 src_configure() {
59         append-cxxflags -std=c++11 # bug 634506
60
61         local myeconfargs=(
62                 $(use_enable debug)
63                 $(use_enable debug disk-stats)
64                 $(use_enable debug logging)
65                 $(use_enable dht)
66                 $(use_enable examples)
67                 $(use_enable ssl encryption)
68                 $(use_enable static-libs static)
69                 $(use_enable test tests)
70                 --with-libiconv
71         )
72         econf "${myeconfargs[@]}"
73
74         if use python; then
75                 python_configure() {
76                         econf "${myeconfargs[@]}" \
77                                 --enable-python-binding \
78                                 --with-boost-python="boost_${EPYTHON/./}"
79                 }
80                 distutils-r1_src_configure
81         fi
82 }
83
84 src_compile() {
85         default
86
87         python_compile() {
88                 cd "${BUILD_DIR}/../bindings/python" || die
89                 distutils-r1_python_compile
90         }
91         use python && distutils-r1_src_compile
92 }
93
94 src_install() {
95         use doc && HTML_DOCS+=( "${S}"/docs )
96
97         default
98
99         python_install() {
100                 cd "${BUILD_DIR}/../bindings/python" || die
101                 distutils-r1_python_install
102         }
103         use python && distutils-r1_src_install
104
105         find "${D}" -name '*.la' -delete || die
106 }