SUMMARY="An implementation of multicast DNS"
DESCRIPTION="Some of QMdnsEngine's features include:

* Supports Windows, macOS, Linux, and most other platforms supported by Qt
* Requires only QtCore and QtNetwork - no other dependencies
* Includes an exhaustive set of unit tests"
HOMEPAGE="https://github.com/nitroshare/qmdnsengine/"
COPYRIGHT="2017 Nathan Osman"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="$HOMEPAGE/archive/$portVersion.tar.gz"
CHECKSUM_SHA256="27416ca7b8b8a8588df4318de57127ef97e1205269fa506f00f21b09d30d3ac2"
SOURCE_FILENAME="qmdnsengine-$portVersion.tar.gz"

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

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

PROVIDES="
	qmdnsengine$secondaryArchSuffix = $portVersion
	lib:libqmdnsengine$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	"

PROVIDES_devel="
	qmdnsengine${secondaryArchSuffix}_devel = $portVersion
	devel:libqmdnsengine$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	qmdnsengine$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Test$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage qmdnsengine$secondaryArchSuffix \
	"$libDir"/libqmdnsengine.so.$libVersion

BUILD()
{
	cmake . \
		-DBIN_INSTALL_DIR=$prefix \
		-DLIB_INSTALL_DIR=$libDir \
		-DINCLUDE_INSTALL_DIR=$includeDir \
		-DBUILD_TESTS=ON
	make $jobArgs
}

INSTALL()
{
	make install

	# prepare develop/lib
	prepareInstalledDevelLibs libqmdnsengine
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir \
		$libDir/cmake
}

TEST()
{
	make tests
}
