--- /keeps/gentoo/cvs/gentoo-x86/app-accessibility/espeak/espeak-1.19.ebuild	2007-02-10 14:41:51.000000000 +0100
+++ espeak-1.19.ebuild	2007-03-02 23:04:40.000000000 +0100
@@ -2,13 +2,14 @@
 # Distributed under the terms of the GNU General Public License v2
 # $Header: /var/cvsroot/gentoo-x86/app-accessibility/espeak/espeak-1.19.ebuild,v 1.4 2007/02/10 13:41:51 beandog Exp $
 
-inherit eutils
+inherit eutils toolchain-funcs
 
 MY_P="${P}-source"
 
 DESCRIPTION="Speech synthesizer for English and other languages"
 HOMEPAGE="http://espeak.sourceforge.net/"
-SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip"
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip
+	http://dev.gentoo.org/~leonardop/${PN}/${PN}-utils-${PV}.tar.bz2"
 
 LICENSE="GPL-2"
 SLOT="0"
@@ -22,7 +23,7 @@
 
 
 src_unpack() {
-	unpack "${A}"
+	unpack ${A}
 	cd "${S}"
 
 	# portaudio.h is by default the same as portaudio18.h, but use the version
@@ -39,15 +40,35 @@
 }
 
 src_compile() {
+	tc-export CXX CC LD
 	cd src
 	emake CXXFLAGS="${CXXFLAGS}" || die "Compilation failed"
+
+	cd "${S}"/../${PN}-utils-${PV}
+	emake || die "make espeak-utils failed"
+	./espeak-phoneme-data "${S}"/espeak-data || die "espeak-utils failed"
 }
 
 src_install() {
-	cd src
+	cd ${S}/dictsource
+	export HOME=${D}/usr/share
+
+	local i
+	pwd
+	for i in *_rules; do
+		einfo "Compiling LANG=${i/_rules/}"
+		espeak --compile=${i/_rules/}
+		eend
+	done
+
+	cd "${S}/"src
 	make DESTDIR="${D}" install || die "Installation failed"
 
 	cd "${S}"
 	dodoc ChangeLog ReadMe
 	dohtml -r docs/*
+
+	cd "${S}"/../${PN}-utils-${PV}
+	insinto /usr/share/${PN}-data
+	doins phondata phonindex phontab
 }

