SUMMARY="A library for managing X11 cursors"
DESCRIPTION="libXcursor is a cursor management library for the X Window System."
HOMEPAGE="https://www.x.org/wiki/"
COPYRIGHT="2002-2003 Keith Packard"
LICENSE="libXcursor"
REVISION="1"
SOURCE_URI="https://www.x.org/releases/individual/lib/libXcursor-$portVersion.tar.bz2"
CHECKSUM_SHA256="3ad3e9f8251094af6fe8cb4afcf63e28df504d46bfa5a5529db74a505d628782"
SOURCE_DIR="libXcursor-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	libxcursor$secondaryArchSuffix = $portVersion
	lib:libXcursor$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libX11$secondaryArchSuffix
	lib:libXfixes$secondaryArchSuffix
	lib:libXrender$secondaryArchSuffix
	"

PROVIDES_devel="
	libxcursor${secondaryArchSuffix}_devel = $portVersion
	devel:libXcursor$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libxcursor$secondaryArchSuffix == $portVersion base
	devel:libX11$secondaryArchSuffix
	devel:libXfixes$secondaryArchSuffix
	devel:libXrender$secondaryArchSuffix
	devel:xproto
	"

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

defineDebugInfoPackage libxcursor$secondaryArchSuffix \
	"$libDir"/libXcursor.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"
		maybe_manDir=
	fi

	rm -f "$libDir"/libXcursor.la

	prepareInstalledDevelLib libXcursor
	fixPkgconfig

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