SUMMARY="Line and word breaking library"
DESCRIPTION="An implementation of the line breaking and word breaking \
algorithms as described in Unicode Standard Annex 14 and Unicode Standard \
Annex 29."
HOMEPAGE="http://vimgadgets.sourceforge.net/libunibreak/"
COPYRIGHT="2016 Andreas Röver"
LICENSE="Zlib"
REVISION="1"
SOURCE_URI="https://github.com/adah1972/libunibreak/releases/download/libunibreak_${portVersion//./_}/libunibreak-$portVersion.tar.gz"
CHECKSUM_SHA256="f7329bef1eb169d3363f040cefcc323cfd0a0bc53290a35a395e1d1adc849539"

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

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

PROVIDES="
	libunibreak$secondaryArchSuffix = $portVersion
	lib:libunibreak$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	"

PROVIDES_devel="
	libunibreak${secondaryArchSuffix}_devel = $portVersion
	devel:liblinebreak$secondaryArchSuffix = $libVersionCompat
	devel:libunibreak$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libunibreak$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libunibreak$secondaryArchSuffix \
	"$libDir"/libunibreak.so.$libVersion

BUILD()
{
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

	# remove libtool library files
	rm $libDir/*.la
	rm $libDir/liblinebreak.a

	# prepare develop/lib
	prepareInstalledDevelLibs libunibreak
	ln -s libunibreak.a $developLibDir/liblinebreak.a

	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
