SUMMARY="Text Encoding Conversion toolkit"
DESCRIPTION="TECkit is a low-level toolkit intended to be used by other \
applications that need to perform encoding conversions (e.g., when importing \
legacy data into a Unicode-based application).
The primary component of the TECkit package is therefore a library that \
performs conversions; this is the \"TECkit engine\". The engine relies on \
mapping tables in a specific binary format (for which documentation is \
available); there is a compiler that creates such tables from a \
human-readable mapping description (a simple text file)."
HOMEPAGE="https://scripts.sil.org/cms/scripts/page.php?site_id=nrsi&id=TECkitIntro"
COPYRIGHT="Jonathan Kew, SIL International"
LICENSE="CPL v0.5
	GNU GPL v2
	GNU LGPL v2.1
	MPL v2.0"
REVISION="1"
SOURCE_URI="https://github.com/silnrsi/teckit/releases/download/v$portVersion/teckit-$portVersion.tar.gz"
CHECKSUM_SHA256="6823fb3142efa34e5d74de35d37cdf4724efbf577f5ff15a8e2b364e6ef47d3d"

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

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

PROVIDES="
	teckit$secondaryArchSuffix = $portVersion
	lib:libTECkit$secondaryArchSuffix = $libVersionCompat
	lib:libTECkit_Compiler$secondaryArchSuffix = $libVersionCompat
	cmd:sfconv
	cmd:teckit_compile
	cmd:txtconv
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libexpat$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	teckit${secondaryArchSuffix}_devel = $portVersion
	devel:libTECkit$secondaryArchSuffix = $libVersionCompat
	devel:libTECkit_Compiler$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	haiku${secondaryArchSuffix}_devel
	teckit$secondaryArchSuffix == $portVersion base
	devel:libexpat$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libexpat$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	runConfigure ./configure --enable-final --disable-static
	make $jobArgs
}

INSTALL()
{
	make install

	prepareInstalledDevelLibs libTECkit \
		libTECkit_Compiler
	fixPkgconfig

	# DEVEL
	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
