SUMMARY="A client library for the Composite extension to the X11 protocol"
DESCRIPTION="libXcomposite is a client interface to the Composite extension of \
the X protocol."
HOMEPAGE="https://www.x.org/wiki/"
COPYRIGHT="2001, 2003 Keith Packard
	2003 Noah Levitt
	2006, 2007 Oracle and/or its affiliates"
LICENSE="libXcomposite"
REVISION="2"
SOURCE_URI="https://www.x.org/releases/individual/lib/libXcomposite-$portVersion.tar.bz2"
CHECKSUM_SHA256="b3218a2c15bab8035d16810df5b8251ffc7132ff3aa70651a1fba0bfe9634e8f"
SOURCE_DIR="libXcomposite-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

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

# server-interfacing: needs libX11_xcb.

PROVIDES="
	libxcomposite$secondaryArchSuffix = $portVersion
	lib:libXcomposite$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libX11_xcb$secondaryArchSuffix
	lib:libXfixes$secondaryArchSuffix
	"

PROVIDES_devel="
	libxcomposite${secondaryArchSuffix}_devel = $portVersion
	devel:libXcomposite$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libxcomposite$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libX11_xcb$secondaryArchSuffix
	devel:libXfixes$secondaryArchSuffix
	devel:util_macros
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
#	cmd:xmlto
	"

defineDebugInfoPackage libxcomposite$secondaryArchSuffix \
	"$libDir"/libXcomposite.so.$libVersion

BUILD()
{
	autoreconf -vfi
	runConfigure ./configure
	make $jobArgs
}

INSTALL()
{
	make install

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

	rm -f "$libDir"/libXcomposite.la

	prepareInstalledDevelLib libXcomposite
	fixPkgconfig

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