SUMMARY="Library for creating vnc servers"
DESCRIPTION="LibVNCServer/LibVNCClient are cross-platform C libraries that \
allow you to easily implement VNC server or client functionality in your \
program."
HOMEPAGE="https://libvnc.github.io/"
COPYRIGHT="2001-2017 Johannes E. Schindelin"
LICENSE="GNU GPL v2"
REVISION="1"
SOURCE_URI="https://github.com/LibVNC/libvncserver/archive/LibVNCServer-$portVersion.tar.gz"
CHECKSUM_SHA256="0ae5bb9175dc0a602fe85c1cf591ac47ee5247b87f2bf164c16b05f87cbfa81a"
SOURCE_DIR="libvncserver-LibVNCServer-$portVersion"
PATCHES="libvncserver-$portVersion.patchset"

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

PROVIDES="
	libvncserver$secondaryArchSuffix = $portVersion
	lib:libvncclient$secondaryArchSuffix = $portVersion
	lib:libvncserver$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgcrypt$secondaryArchSuffix
	lib:libgnutls$secondaryArchSuffix
	lib:libgpg_error$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libpng16$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	libvncserver${secondaryArchSuffix}_devel = $portVersion
	cmd:libvncserver_config$secondaryArchSuffix = $portVersion
	devel:libvncclient$secondaryArchSuffix = $portVersion
	devel:libvncserver$secondaryArchSuffix = $portVersion
	"
REQUIRES_devel="
	libvncserver$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgcrypt$secondaryArchSuffix
	devel:libgnutls$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libpng16$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	cmake -S. -Bbuild \
		-DCMAKE_BUILD_TYPE=Release \
		$cmakeDirArgs
	make -C build $jobArgs
}

INSTALL()
{
	make -C build install

	prepareInstalledDevelLibs \
		libvncclient \
		libvncserver
	fixPkgconfig
	packageEntries devel \
		$developDir
}

TEST()
{
	make check
}
