SUMMARY="A library for the X Damage region extension to the X11 protocol"
DESCRIPTION="libXdamage is a client interface to the Damage extension of the \
X protocol."
HOMEPAGE="https://www.x.org/wiki/"
COPYRIGHT="2001, 2003 Keith Packard
	2003 Noah Levitt
	2007 Eric Anholt"
LICENSE="libXdamage"
REVISION="2"
SOURCE_URI="https://www.x.org/releases/individual/lib/libXdamage-$portVersion.tar.bz2"
CHECKSUM_SHA256="b734068643cac3b5f3d2c8279dd366b5bf28c7219d9e9d8717e1383995e0ea45"
SOURCE_DIR="libXdamage-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

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

# server-interfacing: needs libX11_xcb.

PROVIDES="
	libxdamage$secondaryArchSuffix = $portVersion
	lib:libXdamage$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libX11_xcb$secondaryArchSuffix
	lib:libXfixes$secondaryArchSuffix
	"

PROVIDES_devel="
	libxdamage${secondaryArchSuffix}_devel = $portVersion
	devel:libXdamage$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libxdamage$secondaryArchSuffix == $portVersion base
	devel:damageproto
	devel:libX11_xcb$secondaryArchSuffix
	devel:libXfixes$secondaryArchSuffix
	devel:xproto
	"

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

defineDebugInfoPackage libxdamage$secondaryArchSuffix \
	"$libDir"/libXdamage.so.$libVersion

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

INSTALL()
{
	make install
	if [ -z "$secondaryArchSuffix" ]; then
		install -m 0755 -d "$developDocDir"
		install -m 0644 -t "$developDocDir" README.md
	fi

	rm -f "$libDir"/libXdamage.la

	prepareInstalledDevelLib libXdamage
	fixPkgconfig

	# devel package
	packageEntries devel \
		"$developDir"
}
