dev-tcltk/snack: Stabilize and fix tests
[gentoo.git] / dev-tcltk / snack / snack-2.2.10-r8.ebuild
1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=6
5
6 PYTHON_COMPAT=( python2_7 pypy )
7
8 inherit autotools distutils-r1 multilib virtualx
9
10 DESCRIPTION="The Snack Sound Toolkit (Tcl)"
11 HOMEPAGE="http://www.speech.kth.se/snack/"
12 SRC_URI="http://www.speech.kth.se/snack/dist/${PN}${PV}.tar.gz"
13
14 LICENSE="GPL-2"
15 KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x86-macos"
16 SLOT="0"
17 IUSE="alsa examples python vorbis"
18
19 DEPEND="
20         dev-lang/tcl:0=
21         dev-lang/tk:0=
22         alsa? ( media-libs/alsa-lib )
23         python? ( ${PYTHON_DEPS} )
24         vorbis? ( media-libs/libvorbis )"
25 RDEPEND="${DEPEND}"
26
27 S="${WORKDIR}/${PN}${PV}/unix"
28
29 PATCHES=(
30         "${FILESDIR}"/alsa-undef-sym.patch
31         "${FILESDIR}"/${P}-CVE-2012-6303-fix.patch
32         "${FILESDIR}"/${P}-debian-args.patch
33         "${FILESDIR}"/${P}-test.patch
34 )
35
36 HTML_DOCS="${WORKDIR}/${PN}${PV}/doc/*"
37
38 src_prepare() {
39         # adds -install_name (soname on Darwin)
40         [[ ${CHOST} == *-darwin* ]] && PATCHES+=( "${FILESDIR}"/${P}-darwin.patch )
41
42         sed \
43                 -e "s:ar cr:$(tc-getAR) cr:g" \
44                 -e "s:-O:${CFLAGS}:g" \
45                 -i Makefile.in || die
46
47         cd ..
48
49         default
50
51         sed \
52                 -e 's|^\(#define roundf(.*\)|//\1|' \
53                 -i generic/jkFormatMP3.c || die
54         rm tests/{play,record}.test || die
55 }
56
57 src_configure() {
58         local myconf=""
59
60         use alsa && myconf+=" --enable-alsa"
61
62         if use vorbis; then
63                 myconf+=" --with-ogg-include="${EPREFIX}"/usr/include"
64                 myconf+=" --with-ogg-lib="${EPREFIX}"/usr/$(get_libdir)"
65         fi
66
67         econf \
68                 --libdir="${EPREFIX}"/usr/$(get_libdir) \
69                 --includedir="${EPREFIX}"/usr/include \
70                 --with-tcl="${EPREFIX}"/usr/$(get_libdir) \
71                 --with-tk="${EPREFIX}"/usr/$(get_libdir) \
72                 $myconf
73 }
74
75 src_compile() {
76         default
77 }
78
79 src_test() {
80         TCLLIBPATH=${S} virtx default | grep FAILED && die
81 }
82
83 src_install() {
84         default
85
86         if use python ; then
87                 cd "${S}"/../python || die
88                 distutils-r1_src_install
89         fi
90
91         cd "${S}"/.. || die
92
93         if use examples ; then
94                 docinto examples
95                 sed -i -e 's/wish[0-9.]+/wish/g' demos/tcl/* || die
96                 dodoc -r demos/tcl
97
98                 use python && dodoc -r demos/python
99         fi
100 }