*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / app-accessibility / speech-dispatcher / speech-dispatcher-0.8.7-r3.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=( python3_{6,7} )
7
8 inherit eutils python-r1
9
10 DESCRIPTION="Speech synthesis interface"
11 HOMEPAGE="http://www.freebsoft.org/speechd"
12 SRC_URI="http://www.freebsoft.org/pub/projects/speechd/${P}.tar.gz"
13
14 LICENSE="GPL-2"
15 SLOT="0"
16 KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"
17 IUSE="alsa ao +espeak flite nas pulseaudio python"
18
19 REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
20
21 COMMON_DEPEND="python? ( ${PYTHON_DEPS} )
22         >=dev-libs/dotconf-1.3
23         >=dev-libs/glib-2.28:2
24         dev-libs/libltdl:0
25         >=media-libs/libsndfile-1.0.2
26         alsa? ( media-libs/alsa-lib )
27         ao? ( media-libs/libao )
28         espeak? ( app-accessibility/espeak )
29         flite? ( app-accessibility/flite )
30         nas? ( media-libs/nas )
31         pulseaudio? ( media-sound/pulseaudio )"
32 DEPEND="${COMMON_DEPEND}
33         >=dev-util/intltool-0.40.0
34         virtual/pkgconfig"
35 RDEPEND="${COMMON_DEPEND}
36         python? ( dev-python/pyxdg[${PYTHON_USEDEP}] )"
37
38 src_configure() {
39         # bug 573732
40         export GIT_CEILING_DIRECTORIES="${WORKDIR}"
41
42         local myeconfargs=(
43                 --disable-python
44                 --disable-static
45                 $(use_with alsa)
46                 $(use_with ao libao)
47                 $(use_with espeak)
48                 $(use_with flite)
49                 $(use_with pulseaudio pulse)
50                 $(use_with nas)
51         )
52         econf ${myeconfargs[@]}
53 }
54
55 src_compile() {
56         use python && python_copy_sources
57
58         emake
59
60         if use python; then
61                 building() {
62                         cd src/api/python || die
63                         emake \
64                                 pyexecdir="$(python_get_sitedir)" \
65                                 pythondir="$(python_get_sitedir)"
66                 }
67                 python_foreach_impl run_in_build_dir building
68         fi
69 }
70
71 src_install() {
72         emake DESTDIR="${D}" install
73         dodoc ANNOUNCE AUTHORS BUGS FAQ NEWS README*
74
75         if use python; then
76                 installation() {
77                         cd src/api/python || die
78                         emake \
79                                 DESTDIR="${D}" \
80                                 pyexecdir="$(python_get_sitedir)" \
81                                 pythondir="$(python_get_sitedir)" \
82                                 install
83                 }
84                 python_foreach_impl run_in_build_dir installation
85                 python_replicate_script "${ED}"/usr/bin/spd-conf
86         fi
87
88         find "${D}" -name '*.la' -delete || die
89 }
90
91 pkg_postinst() {
92         local editconfig="n"
93         if ! use espeak; then
94                 ewarn "You have disabled espeak, which is speech-dispatcher's"
95                 ewarn "default speech synthesizer."
96                 ewarn
97                 editconfig="y"
98         fi
99         if ! use pulseaudio; then
100                 ewarn "You have disabled pulseaudio support."
101                 ewarn "pulseaudio is speech-dispatcher's default audio subsystem."
102                 ewarn
103                 editconfig="y"
104         fi
105         if [[ "${editconfig}" == "y" ]]; then
106                 ewarn "You must edit ${EROOT}/etc/speech-dispatcher/speechd.conf"
107                 ewarn "and make sure the settings there match your system."
108                 ewarn
109         fi
110         elog "For festival support, you need to"
111         elog "install app-accessibility/festival-freebsoft-utils."
112 }