summaryrefslogtreecommitdiff
blob: b52de17feda69fe5e2bdd3657b624f490cf60958 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# Copyright 1999-2017 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

EAPI=5

PYTHON_COMPAT=( python2_7 )
DISTUTILS_OPTIONAL=1
AUTOTOOLS_AUTORECONF=1

inherit autotools-utils distutils-r1

DESCRIPTION="Support library required by the Sphinx Speech Recognition Engine"
HOMEPAGE="http://cmusphinx.sourceforge.net/"
SRC_URI="mirror://sourceforge/cmusphinx/${P}.tar.gz"

LICENSE="BSD-2 HPND MIT"
SLOT="0"
KEYWORDS="amd64 x86"
IUSE="doc lapack python static-libs"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

# automagic dep on pulseaudio
RDEPEND="
	media-sound/pulseaudio
	lapack? ( virtual/lapack )
	python? ( ${PYTHON_DEPS} )"
DEPEND="${RDEPEND}
	doc? ( >=app-doc/doxygen-1.4.7 )"

# Due to generated Python setup.py.
AUTOTOOLS_IN_SOURCE_BUILD=1

PATCHES=(
	"${FILESDIR}"/${P}-unbundle-lapack.patch
	"${FILESDIR}"/${P}-automake113.patch
)

src_configure() {
	local myeconfargs=(
		$(use_with lapack)
		$(use_enable doc)
		# python modules are built through distutils
		# so disable the ugly wrapper
		--without-python
	)
	autotools-utils_src_configure
}

run_distutils() {
	if use python; then
		pushd python > /dev/null || die
		distutils-r1_"${@}"
		popd > /dev/null || die
	fi
}

src_compile() {
	autotools-utils_src_compile

	run_distutils ${FUNCNAME}
}

python_test() {
	LD_LIBRARY_PATH="${S}"/src/lib${PN}/.libs \
		"${PYTHON}" sb_test.py || die "Tests fail with ${EPYTHON}"
}

src_test() {
	autotools-utils_src_test

	run_distutils ${FUNCNAME}
}

src_install() {
	run_distutils ${FUNCNAME}

	use doc && local HTML_DOCS=( doc/html/. )
	autotools-utils_src_install
}