SUMMARY="A testing framework for infrastructure software"
DESCRIPTION="Kyua is a testing framework for infrastructure software, \
originally designed to equip BSD-based operating systems with a test suite. \
This means that Kyua is lightweight and simple, and that Kyua integrates well \
with various build systems and continuous integration frameworks.

Kyua features an expressive test suite definition language, a safe runtime \
engine for test suites and a powerful report generation engine.

Kyua is for both developers and users, from the developer applying a simple \
fix to a library to the system administrator deploying a new release on a \
production machine.

Kyua is able to execute test programs written with a plethora of testing \
libraries and languages. The library of choice is ATF, for which Kyua was \
originally designed, but simple, framework-less test programs and \
TAP-compliant test programs can also be executed through Kyua."
HOMEPAGE="https://github.com/jmmv/kyua"
COPYRIGHT="2010-2015 The Kyua Authors"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/jmmv/kyua/releases/download/kyua-$portVersion/kyua-$portVersion.tar.gz"
CHECKSUM_SHA256="db6e5d341d5cf7e49e50aa361243e19087a00ba33742b0855d2685c0b8e721d6"
PATCHES="kyua-$portVersion.patchset"

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

commandSuffix=$secondaryArchSuffix
commandBinDir=$binDir
if [ "$targetArchitecture" = x86_gcc2 ]; then
	commandSuffix=
	commandBinDir=$prefix/bin
fi

PROVIDES="
	kyua$secondaryArchSuffix = $portVersion
	cmd:kyua$commandSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:liblua$secondaryArchSuffix
	lib:liblutok$secondaryArchSuffix
	lib:libsqlite3$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libatf_c++$secondaryArchSuffix
	devel:liblutok$secondaryArchSuffix
	devel:libsqlite3$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoreconf
	cmd:awk
	cmd:doxygen
	cmd:g++$secondaryArchSuffix
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:sed
	"

TEST_REQUIRES="
	cmd:find
	cmd:sqlite3
	"

USER_SETTINGS_FILES="
	settings/kyua directory
	settings/kyua/kyua.conf template $dataDir/kyua/examples/kyua.conf"

defineDebugInfoPackage kyua$secondaryArchSuffix \
	"$commandBinDir/kyua"

BUILD()
{
	autoreconf -vfi
	LIBS="-Wl,--as-needed -lbe" \
	runConfigure --omit-dirs "binDir settingsDir" ./configure \
		--bindir=$commandBinDir --enable-developer=no
	make $jobArgs
}

INSTALL()
{
	make install

	rm -rf "$prefix/tests"
	rm "$docDir"/{LICENSE,CONTRIBUTING.md}
}

TEST()
{
	make check
}
