*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / media-libs / aubio / aubio-0.4.9.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 DISTUTILS_OPTIONAL=1
7 PYTHON_COMPAT=( python{2_7,3_{6,7}} )
8 PYTHON_REQ_USE='threads(+)'
9 inherit distutils-r1 waf-utils
10
11 DESCRIPTION="Library for audio labelling"
12 HOMEPAGE="https://aubio.org/"
13 SRC_URI="https://aubio.org/pub/${P}.tar.bz2"
14
15 LICENSE="GPL-3"
16 SLOT="0/5"
17 KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
18 IUSE="doc double-precision examples ffmpeg fftw jack libav libsamplerate sndfile python test"
19 RESTRICT="!test? ( test )"
20
21 RDEPEND="
22         ffmpeg? (
23                 !libav? ( >=media-video/ffmpeg-2.6:0= )
24                 libav? ( >=media-video/libav-9:0= )
25         )
26         fftw? ( sci-libs/fftw:3.0= )
27         jack? ( virtual/jack )
28         libsamplerate? ( media-libs/libsamplerate )
29         python? (
30                 ${PYTHON_DEPS}
31                 dev-python/numpy[${PYTHON_USEDEP}]
32         )
33         sndfile? ( media-libs/libsndfile )
34 "
35 DEPEND="${RDEPEND}
36         ${PYTHON_DEPS}
37         app-text/txt2man
38         virtual/pkgconfig
39         doc? ( app-doc/doxygen )
40 "
41 REQUIRED_USE="${PYTHON_REQUIRED_USE}
42         ?? ( double-precision libsamplerate )
43 "
44
45 DOCS=( AUTHORS ChangeLog README.md )
46 PYTHON_SRC_DIR="${S}"
47
48 PATCHES=(
49         "${FILESDIR}"/${PN}-0.4.9-docdir.patch
50 )
51
52 src_prepare() {
53         default
54         sed -e "s:doxygen:doxygen_disabled:" -i wscript || die
55
56         if ! use test; then
57                 sed -e "/bld.*tests/d" -i wscript || die
58         fi
59 }
60
61 src_configure() {
62         python_setup
63         local mywafconfargs=(
64                 --enable-complex
65                 --docdir="${EPREFIX}"/usr/share/doc/${PF}
66                 $(use_enable doc docs)
67                 $(use_enable double-precision double)
68                 $(use_enable fftw fftw3)
69                 $(use_enable ffmpeg avcodec)
70                 $(use_enable jack)
71                 $(use_enable libsamplerate samplerate)
72                 $(use_enable sndfile)
73         )
74         use double-precision || mywafconfargs+=( $(use_enable fftw fftw3f) )
75
76         waf-utils_src_configure "${mywafconfargs[@]}"
77
78         if use python ; then
79                 cd "${PYTHON_SRC_DIR}" || die
80                 distutils-r1_src_configure
81         fi
82 }
83
84 src_compile() {
85         waf-utils_src_compile --notests
86
87         if use doc; then
88                 cd "${S}"/doc || die
89                 emake dirhtml
90         fi
91
92         if use python ; then
93                 cd "${PYTHON_SRC_DIR}" || die
94                 distutils-r1_src_compile
95         fi
96 }
97
98 src_test() {
99         waf-utils_src_compile --alltests
100
101         if use python ; then
102                 cd "${PYTHON_SRC_DIR}" || die
103                 distutils-r1_src_test
104         fi
105 }
106
107 src_install() {
108         waf-utils_src_install
109
110         if use examples; then
111                 # install dist_noinst_SCRIPTS from Makefile.am
112                 dodoc -r examples
113         fi
114
115         if use python ; then
116                 cd "${PYTHON_SRC_DIR}" || die
117                 DOCS="" distutils-r1_src_install
118                 newdoc python/README.md README.python
119         fi
120
121         if use doc; then
122                 dodoc doc/*.txt
123                 docinto html
124                 dodoc -r doc/_build/dirhtml/.
125         fi
126
127         find "${ED}" -name "*.a" -delete || die
128 }