SUMMARY="Generic spell-checking dictionary library"
DESCRIPTION="Enchant is also meant to be used in a cross-platform (XP) \
environment. Part of this means that Enchant wants to limit its number of \
external dependencies to 0, or as close is as humanly possible. Also, any \
enchant consumer (i.e. a Word Processor) should not need to know about what \
backend providers Enchant knows about. In fact, Enchant shouldn't even need \
to know this information itself. To accomplish this, all of Enchant's \
providers are DLLs.\
Enchant is also meant to be used in a multi-user environment, such as Unix.\
It is preferable to have both a \$USER and a \$GLOBAL location for both \
provider DLLs and for dictionaries themselves, when possible. Enchant's DLL\
location algorithm takes this into account, and gives preference to the \$USER \
DLLs, when found."
HOMEPAGE="http://abisource.com/projects/enchant/"
COPYRIGHT="2003-2020 Dom Lachowicz"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://github.com/AbiWord/enchant/releases/download/v$portVersion/enchant-$portVersion.tar.gz"
CHECKSUM_SHA256="3b0f2215578115f28e2a6aa549b35128600394304bd79d6f28b0d3b3d6f46c03"

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

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

PROVIDES="
	enchant$secondaryArchSuffix = $portVersion
	cmd:enchant_2$secondaryArchSuffix
	cmd:enchant_lsmod_2$secondaryArchSuffix
	cmd:enchant_lsmod$secondaryArchSuffix
	lib:libenchant_2$secondaryArchSuffix = $libVersionCompat
	lib:enchant_aspell$secondaryArchSuffix
	lib:enchant_hunspell$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libaspell$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libhunspell_1.7$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	"

PROVIDES_devel="
	enchant${secondaryArchSuffix}_devel = $portVersion
	devel:libenchant_2$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	enchant$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libaspell$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libhunspell_1.7$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libintl$secondaryArchSuffix
	devel:libunittest++$secondaryArchSuffix #needed for the test
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	AUTOCONF=: AUTOMAKE=: runConfigure ./configure \
		--disable-static \
		--with-hunspell-dir=$(finddir B_SYSTEM_DATA_DIRECTORY)/hunspell \
		--with-aspell-dir=$(finddir B_SYSTEM_DATA_DIRECTORY)/aspell-0.60

	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/enchant-2/*.la $libDir/*.la

	fixPkgconfig

	prepareInstalledDevelLibs \
		libenchant-2

	packageEntries devel \
		$developDir
}

TEST()
{
	#TEST fails for main.test
	make check
}
