SUMMARY="Library for SSA/ASS subtitles rendering"
DESCRIPTION="Libass is a portable subtitle renderer for the ASS/SSA (Advanced \
Substation Alpha/Substation Alpha) subtitle format."
HOMEPAGE="https://github.com/libass/libass"
COPYRIGHT="2006-2017 libass contributors
	2006 Evgeniy Stepanov
	2011 Grigori Goronzy
	2011-2014 Yu Zhuohuang
	2013 Rodger Combs"
LICENSE="ISC"
REVISION="1"
SOURCE_URI="https://github.com/libass/libass/releases/download/$portVersion/libass-$portVersion.tar.xz"
CHECKSUM_SHA256="1be2df9c4485a57d78bb18c0a8ed157bc87a5a8dd48c661961c625cb112832fd"

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

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

PROVIDES="
	libass$secondaryArchSuffix = $portVersion compat >= 0.11
	lib:libass$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix # required by freetype
	lib:libenca$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libfribidi$secondaryArchSuffix
	lib:libgraphite2$secondaryArchSuffix # required by harfbuzz
	lib:libharfbuzz$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libintl$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix # required by freetype
	lib:libxml2$secondaryArchSuffix # required by fontconfig
	lib:libz$secondaryArchSuffix # required by freetype
	"

PROVIDES_devel="
	libass${secondaryArchSuffix}_devel = $portVersion compat >= 0.11
	devel:libass$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libass$secondaryArchSuffix == $portVersion base
	devel:libfontconfig$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libharfbuzz$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libbz2$secondaryArchSuffix # required by freetype
	devel:libenca$secondaryArchSuffix
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libgraphite2$secondaryArchSuffix # required by harfbuzz
	devel:libharfbuzz$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix # required by freetype
	devel:libxml2$secondaryArchSuffix # required by fontconfig
	devel:libz$secondaryArchSuffix # required by freetype
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libass$secondaryArchSuffix \
	$libDir/libass.so.$libVersion

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

INSTALL()
{
	make install

	rm $libDir/libass.la

	prepareInstalledDevelLibs libass
	fixPkgconfig

	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
