SUMMARY="Interfacing with pseudo terminal devices"
DESCRIPTION="This library provides primitives to interface with pseudo terminal \
devices as well as a KProcess derived class for running child processes and \
communicating with them using a pty.."
HOMEPAGE="https://github.com/KDE/kpty/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/kpty/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="f352e381b7ac41700e77797c9307f0dd7bdc1651fa91dddfd49e5da9b00238da"
PATCHES="kpty-$portVersion.patchset"

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

PROVIDES="
	kpty$secondaryArchSuffix = $portVersion
	lib:libKF5Pty$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libKF5ConfigGui$secondaryArchSuffix
	lib:libKF5CoreAddons$secondaryArchSuffix
	lib:libKF5I18n$secondaryArchSuffix
	lib:libKF5WidgetsAddons$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Xml$secondaryArchSuffix
	"

PROVIDES_devel="
	kpty${secondaryArchSuffix}_devel = $portVersion
	devel:libKF5Pty$secondaryArchSuffix = $portVersion compat >= 5
	"
REQUIRES_devel="
	kpty$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	devel:libKF5ConfigGui$secondaryArchSuffix == $portVersion
	devel:libKF5CoreAddons$secondaryArchSuffix == $portVersion
	devel:libKF5I18n$secondaryArchSuffix
	devel:libKF5WidgetsAddons$secondaryArchSuffix == $portVersion
	devel:libQt5Core$secondaryArchSuffix >= 5.15
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_CXX_FLAGS=-D_BSD_SOURCE \
		-DECM_MKSPECS_INSTALL_DIR=$dataDir/Qt5/mkspecs \
		-DECM_DIR=/system/data/cmake/Modules/ECM/cmake
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libKF5Pty

	packageEntries devel \
		$libDir/cmake \
		$dataDir/Qt5 \
		$developDir
}

TEST()
{
	cd build
	make test
}
