SUMMARY="A light-weight text-to-speech engine"
DESCRIPTION="Flite is a text-to-speech engine developed by the Carnegie \
Mellon University. As a light-weight alternative to the Festival engine, it \
is desinged to fit into small embedded machines as well as large-scale \
servers. In addition to its native format flite supports voices generated by \
the FestVox project as well."
HOMEPAGE="http://www.festvox.org/flite/
	https://github.com/festvox/flite"
COPYRIGHT="1986 University of Toronto
	1992, 1995 Markus Mummert
	1996-2004 University of Edinburgh, UK
	1999-2014 Language Technologies Institute, Carnegie Mellon University
	2001 Cepstral, LLC
	2001 Sun Microsystems, Inc.
	2003-2004 Nagoya Institute of Technology
	2003-2004 Nara Institute of Science and Technology
	2008-2012 University of Illinois at Urbana-Champaign"
# Although individually many files have different licenses, as a whole this
# license covers all the files.
LICENSE="Flite"
REVISION="1"
SOURCE_URI="http://www.festvox.org/flite/packed/flite-${portVersion}/flite-${portVersion}-release.tar.bz2"
CHECKSUM_SHA256="c73c3f6a2ea764977d6eaf0a287722d1e2066b4697088c552e342c790f3d2b85"
SOURCE_DIR="flite-${portVersion}-release"
PATCHES="flite-$portVersion.patchset"

ARCHITECTURES="all ?x86_gcc2"
SECONDARY_ARCHITECTURES="?x86_gcc2 x86"

commandBinDir=$binDir
commandSuffix=$secondaryArchSuffix
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

libVersion="$portVersion"
libVersionCompat="$libVersion compat >= ${libVersion%%.*}"

PROVIDES="
	flite$secondaryArchSuffix = $portVersion
	flite_tools$secondaryArchSuffix = $portVersion
	cmd:flite$commandSuffix = $portVersion
	cmd:flite_cmu_time_awb$commandSuffix = $portVersion
	cmd:flite_cmu_us_awb$commandSuffix = $portVersion
	cmd:flite_cmu_us_kal$commandSuffix = $portVersion
	cmd:flite_cmu_us_kal16$commandSuffix = $portVersion
	cmd:flite_cmu_us_rms$commandSuffix = $portVersion
	cmd:flite_cmu_us_slt$commandSuffix = $portVersion
	cmd:flite_time$commandSuffix = $portVersion
	lib:libflite$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmu_grapheme_lang$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmu_grapheme_lex$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmu_indic_lang$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmu_indic_lex$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmu_time_awb$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmu_us_awb$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmu_us_kal$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmu_us_kal16$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmu_us_rms$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmu_us_slt$secondaryArchSuffix = $libVersionCompat
	lib:libflite_cmulex$secondaryArchSuffix = $libVersionCompat
	lib:libflite_usenglish$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	flite${secondaryArchSuffix}_devel = $portVersion
	devel:libflite$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmu_grapheme_lang$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmu_grapheme_lex$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmu_indic_lang$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmu_indic_lex$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmu_time_awb$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmu_us_awb$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmu_us_kal$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmu_us_kal16$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmu_us_rms$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmu_us_slt$secondaryArchSuffix = $libVersionCompat
	devel:libflite_cmulex$secondaryArchSuffix = $libVersionCompat
	devel:libflite_usenglish$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	flite$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:autoconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage flite$secondaryArchSuffix \
	$commandBinDir/flite_cmu_time_awb \
	$commandBinDir/flite_cmu_us_awb \
	$commandBinDir/flite_cmu_us_kal \
	$commandBinDir/flite_cmu_us_kal16 \
	$commandBinDir/flite_cmu_us_rms \
	$commandBinDir/flite_cmu_us_slt \
	$commandBinDir/flite_time \
	$libDir/libflite.so.$libVersion \
	$libDir/libflite_cmu_indic_lang.so.$libVersion \
	$libDir/libflite_cmu_indic_lex.so.$libVersion \
	$libDir/libflite_cmu_time_awb.so.$libVersion \
	$libDir/libflite_cmu_us_awb.so.$libVersion \
	$libDir/libflite_cmu_us_kal16.so.$libVersion \
	$libDir/libflite_cmu_us_slt.so.$libVersion \
	$libDir/libflite_cmulex.so.$libVersion \
	$libDir/libflite_usenglish.so.$libVersion

BUILD()
{
	autoconf
	runConfigure --omit-dirs "binDir" ./configure \
		--bindir="$commandBinDir" \
		--enable-shared
	make
}

INSTALL()
{
	make install
	prepareInstalledDevelLibs \
		libflite \
		libflite_cmu_grapheme_lang \
		libflite_cmu_grapheme_lex \
		libflite_cmu_indic_lang \
		libflite_cmu_indic_lex \
		libflite_cmu_time_awb \
		libflite_cmu_us_awb \
		libflite_cmu_us_kal \
		libflite_cmu_us_kal16 \
		libflite_cmu_us_rms \
		libflite_cmu_us_slt \
		libflite_cmulex \
		libflite_usenglish
	packageEntries devel $developDir
}
