SUMMARY="X Test extension library"
DESCRIPTION="This extension is a minimal set of client and server extensions \
required to completely test the X11 server with no user intervention."
HOMEPAGE="http://xorg.freedesktop.org/releases/individual/lib/"
COPYRIGHT="1990, 1991 UniSoft Group Limited
	1992, 1993, 1995, 1998 The Open Group"
LICENSE="MIT (no promotion)"
REVISION="4"
SOURCE_URI="https://www.x.org/archive/individual/lib/libXtst-$portVersion.tar.bz2"
CHECKSUM_SHA256="4655498a1b8e844e3d6f21f3b2c4e2b571effb5fd83199d428a6ba7ea4bf5204"
SOURCE_DIR="libXtst-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

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

# server-interfacing: needs libX11_xcb.

PROVIDES="
	libxtst$secondaryArchSuffix = $portVersion
	lib:libXtst$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libX11_xcb$secondaryArchSuffix
	lib:libXext$secondaryArchSuffix
	lib:libXi$secondaryArchSuffix
	"

PROVIDES_devel="
	libxtst${secondaryArchSuffix}_devel = $portVersion
	devel:libXtst$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libxtst$secondaryArchSuffix == $portVersion base
	devel:libX11_xcb$secondaryArchSuffix
	devel:libXext$secondaryArchSuffix
	devel:libXi$secondaryArchSuffix
	devel:recordproto
	devel:xextproto
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	docbook_xml_dtd
	docbook_xsl_stylesheets
	devel:libX11_xcb$secondaryArchSuffix
	devel:libXext$secondaryArchSuffix
	devel:libXi$secondaryArchSuffix
	devel:util_macros
	devel:xorg_sgml_doctools
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:xmlto
	cmd:xsltproc
	"

defineDebugInfoPackage libxtst$secondaryArchSuffix \
	$libDir/libXtst.so.$libVersion

BUILD()
{
	autoreconf -vfi
	runConfigure --omit-dirs docDir ./configure --docdir=$developDocDir
	make $jobArgs
}

INSTALL()
{
	make install

	if [ -z "$secondaryArchSuffix" ]; then
		install -m 0644 -t "$developDocDir" README
		maybe_manDir="$manDir"
	else
		rm -rf "$manDir"
		rm -rf "$developDir/documentation"
		maybe_manDir=
	fi

	rm -rf $libDir/libXtst.la

	fixPkgconfig
	prepareInstalledDevelLib libXtst

	# devel package
	packageEntries devel \
		$developDir \
		${maybe_manDir:+"$maybe_manDir"}
}
