SUMMARY="X Fixes extension library"
DESCRIPTION="X applications have often needed to work around various \
shortcomings in the core X window system. This extension is designed to \
provide the minimal server-side support necessary to eliminate problems \
caused by these workarounds."
HOMEPAGE="https://www.x.org/wiki/"
COPYRIGHT="2001-2003 Keith Packard
	2003 Noah Levitt
	2006 Oracle and/or its affiliates
	2011 Red Hat"
LICENSE="libXfixes"
REVISION="5"
SOURCE_URI="https://www.x.org/archive/individual/lib/libXfixes-$portVersion.tar.bz2"
CHECKSUM_SHA256="de1cd33aff226e08cefd0e6759341c2c8e8c9faf8ce9ac6ec38d43e287b22ad6"
SOURCE_DIR="libXfixes-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

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

# server-interfacing: needs libX11_xcb.

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

PROVIDES_devel="
	libxfixes${secondaryArchSuffix}_devel = $portVersion
	devel:libXfixes$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libxfixes$secondaryArchSuffix == $portVersion base
	devel:fixesproto
	devel:libX11_xcb$secondaryArchSuffix
	devel:xproto
	"

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

defineDebugInfoPackage libxfixes$secondaryArchSuffix \
	$libDir/libXfixes.so.$libVersion

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

INSTALL()
{
	make install
	if [ -z "$secondaryArchSuffix" ]; then
		install -d -m 755 "$developDocDir"
		install -m 644 -t "$developDocDir" README
		maybe_manDir="$manDir"
	else
		rm -rf "$manDir"
		maybe_manDir=
	fi

	rm -f "$libDir"/libXfixes.la

	fixPkgconfig
	prepareInstalledDevelLib libXfixes

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