SUMMARY="API for Xinerama extension to X11 Protocol"
DESCRIPTION="Xinerama is a simple library designed to interface the Xinerama \
Extension for retrieving information about physical output devices which may \
be combined into a single logical X screen."
HOMEPAGE="https://cgit.freedesktop.org/xorg/lib/libXinerama
	https://xorg.freedesktop.org/releases/individual/lib/"
COPYRIGHT="2007 Oracle"
LICENSE="MIT (no promotion)"
REVISION="4"
SOURCE_URI="https://www.x.org/archive/individual/lib/libXinerama-$portVersion.tar.bz2"
CHECKSUM_SHA256="0008dbd7ecf717e1e507eed1856ab0d9cf946d03201b85d5dcf61489bb02d720"
SOURCE_DIR="libXinerama-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

# server-interfacing: needs libX11_xcb.

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

PROVIDES_devel="
	libxinerama${secondaryArchSuffix}_devel = $portVersion
	devel:libXinerama$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libXinerama$secondaryArchSuffix == $portVersion base
	devel:libX11_xcb$secondaryArchSuffix
	devel:libXext$secondaryArchSuffix
	devel:xineramaproto
	"

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

defineDebugInfoPackage libxinerama$secondaryArchSuffix \
	"$libDir"/libXinerama.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
		maybe_manDir="$manDir"
	else
		rm -rf "$manDir"
		rm -rf "$developDir/documentation"
		maybe_manDir=
	fi

	rm -f "$libDir"/libXinerama.la

	prepareInstalledDevelLib libXinerama
	fixPkgconfig

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

TEST()
{
	make check
}
