SUMMARY="X Extension library"
DESCRIPTION="libXext provides an X Window System client interface to several \
extensions to the X protocol. The supported protocol extensions are \
DOUBLE-BUFFER, DPMS, Extended-Visual-Information, LBX, MIT_SHM, \
MIT_SUNDRY-NONSTANDARD, Multi-Buffering, SECURITY, SHAPE, SYNC, TOG-CUP, \
XC-APPGROUP, XC-MISC, XTEST. libXext also provides a small set of utility \
functions to aid authors of client APIs for X protocol extensions."
HOMEPAGE="http://xorg.freedesktop.org/releases/individual/lib/"
COPYRIGHT="1986, 1987, 1988, 1989, 1994, 1998 The Open Group"
LICENSE="MIT (no promotion)"
REVISION="2"
SOURCE_URI="https://www.x.org/archive/individual/lib/libXext-$portVersion.tar.gz"
CHECKSUM_SHA256="8ef0789f282826661ff40a8eef22430378516ac580167da35cc948be9041aac1"
SOURCE_DIR="libXext-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

# server-interfacing: needs libX11_xcb.

PROVIDES="
	libxext$secondaryArchSuffix = $portVersion
	lib:libXext$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libX11_xcb$secondaryArchSuffix
	"

PROVIDES_devel="
	libxext${secondaryArchSuffix}_devel = $portVersion
	devel:libXext$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libxext$secondaryArchSuffix == $portVersion base
	devel:libX11_xcb$secondaryArchSuffix
	devel:xextproto
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	docbook_xml_dtd
	docbook_xsl_stylesheets
	devel:libX11_xcb$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 libxext$secondaryArchSuffix \
	$libDir/libXext.so.$libVersion

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

INSTALL()
{
	make install

	rm -rf $libDir/libXext.la

	if [ -n "$secondaryArchSuffix" ]; then
		rm -rf $manDir
		maybe_manDir_man3=
	else
		maybe_manDir_man3=$manDir/man3
	fi

	fixPkgconfig
	prepareInstalledDevelLib libXext

	# devel package
	packageEntries devel \
		$developDir \
		$maybe_manDir_man3

	rm -rf $documentationDir
}
