SUMMARY="Spellchecker, forked from myspell"
DESCRIPTION="
	Hunspell is a spell checker and morphological analyzer library and program
	designed for languages with rich morphology and complex word compounding or
	character encoding.
	"
HOMEPAGE="http://hunspell.sourceforge.net/"
SOURCE_URI="http://downloads.sourceforge.net/hunspell/hunspell-$portVersion.tar.gz"
CHECKSUM_SHA256="a7b2c0de0e2ce17426821dc1ac8eb115029959b3ada9d80a81739fa19373246c"
LICENSE="
	GNU GPL v2
	GNU LGPL v2.1
	MPL v1.1
	"
COPYRIGHT="
	2007-2011 Hunspell developers et al.
	2002-2008 László Németh (Hunspell)
	2001-2002 Kevin Hendricks (MySpell)
	"
REVISION="1"
ARCHITECTURES="x86 x86_gcc2 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

PATCHES="hunspell-$portVersion.patchset"

PROVIDES="
	$portName = $portVersion
	lib:libhunspell_1.3$secondaryArchSuffix = $portVersion compat >= 1.3
	"
if [ -z $secondaryArchSuffix ]; then
	PROVIDES="$PROVIDES
		cmd:affixcompress = $portVersion
		cmd:analyze = $portVersion
		cmd:chmorph = $portVersion
		cmd:hunspell = $portVersion
		cmd:hunzip = $portVersion
		cmd:hzip = $portVersion
		cmd:ispellaff2myspell = $portVersion
		cmd:makealias = $portVersion
		cmd:munch = $portVersion
		cmd:unmunch = $portVersion
		cmd:wordforms = $portVersion
		cmd:wordlist2hunspell = $portVersion
		"
fi
REQUIRES="
	haiku$secondaryArchSuffix
	"
BUILD_REQUIRES="
	"
BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:libtoolize
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	"

BUILD()
{
	libtoolize --force --copy --install
	aclocal -I m4
	autoconf
	automake --add-missing
	touch po/t-hu.gmo
	touch po/t-it.gmo
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install
	
	rm $libDir/charset.alias
	if [ -n $secondaryArchSuffix ]; then
		rm -rf $binDir
	fi

	prepareInstalledDevelLibs libhunspell-1.3
	fixPkgconfig

	packageEntries devel $developDir
}

TEST()
{
	make check
}

# ----- devel package -------------------------------------------------------

PROVIDES_devel="
	hunspell${secondaryArchSuffix}_devel = $portVersion
	devel:libhunspell_1.3$secondaryArchSuffix = $portVersion compat >= 1.3
	"
REQUIRES_devel="
	hunspell$secondaryArchSuffix == $portVersion base
	"
