SUMMARY="Video Multi-Method Assessment Fusion"
DESCRIPTION="VMAF is a perceptual video quality assessment algorithm \
developed by Netflix. VMAF Development Kit (VDK) is a software package \
that contains the VMAF algorithm implementation, as well as a set of tools \
that allows a user to train and test a custom VMAF model."
HOMEPAGE="https://github.com/Netflix/vmaf/"
COPYRIGHT="
	2016-2020 Netflix, Inc
	2002-2007 Daala project contributors
	"
LICENSE="BSD-2-Clause-Patent"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/v$portVersion.tar.gz"
SOURCE_FILENAME="vmaf-$portVersion.tar.gz"
CHECKSUM_SHA256="9267b40223ac8d67fb6b99726ce7ed3925b9843f18ad5aa8ffbe2fe873e45cbe"

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

PROVIDES="
	vmaf$secondaryArchSuffix = $portVersion
	cmd:vmafossexec$secondaryArchSuffix
	lib:libvmaf$secondaryArchSuffix = 1 compat >= 1
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	vmaf${secondaryArchSuffix}_devel = $portVersion
	devel:libvmaf$secondaryArchSuffix = 1 compat >= 1
	"
REQUIRES_devel="
	vmaf$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:meson
	cmd:ninja
	"

BUILD()
{
	cd libvmaf
	meson \
		--prefix=$prefix \
		--includedir=$includeDir \
		--libexecdir=$binDir \
		_build
	ninja -C _build $jobArgs
}

INSTALL()
{
	cd libvmaf
	ninja -C _build install

	mv $prefix/share/* $dataDir
	rmdir $prefix/share

	prepareInstalledDevelLibs libvmaf
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}

TEST()
{
	cd libvmaf
	ninja -C _build test
}
