SUMMARY="Text-mode UI toolkit"
DESCRIPTION="libgnt is a GLib-based ncurses toolkit for creating text-mode \
graphical user interfaces quickly and easily."
HOMEPAGE="https://pidgin.im/"
COPYRIGHT="2006-2021 libgnt contributors"
LICENSE="GNU GPL v2"
REVISION=1
SOURCE_URI="http://downloads.sourceforge.net/project/pidgin/libgnt/$portVersion/libgnt-$portVersion.tar.xz"
CHECKSUM_SHA256="5ec3e68e18f956e9998d79088b299fa3bca689bcc95c86001bc5da17c1eb4bd8"
PATCHES="libgnt-$portVersion.patchset"

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

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

PROVIDES="
	libgnt$secondaryArchSuffix = $portVersion
	lib:libgnt$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgmodule_2.0$secondaryArchSuffix
	lib:libgobject_2.0$secondaryArchSuffix
	lib:libgthread_2.0$secondaryArchSuffix
	lib:libncursesw$secondaryArchSuffix
	lib:libpanelw$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	"
PROVIDES_devel="
	libgnt${secondaryArchSuffix}_devel = $portVersion
	devel:libgnt$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	haiku${secondaryArchSuffix}_devel
	libgnt$secondaryArchSuffix == $portVersion base
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libglib_2.0$secondaryArchSuffix
	devel:libgmodule_2.0$secondaryArchSuffix
	devel:libgobject_2.0$secondaryArchSuffix
	devel:libgthread_2.0$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:gtkdoc_scan
	cmd:meson
	cmd:ninja
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage libgnt$secondaryArchSuffix \
	"$libDir"/libgnt.so.$libVersion

BUILD()
{
	meson build --prefix=$prefix --libdir=$libDir --includedir=$includeDir
	ninja $jobargs -C build
}

INSTALL()
{
	ninja -C build install

	mkdir -p $docDir
	mv $prefix/share/gtk-doc/html/libgnt/* $docDir
	rm -rf $prefix/share/

	prepareInstalledDevelLib libgnt
	fixPkgconfig

	packageEntries devel \
		$developDir
}
