SUMMARY="X.Org X authorization library"
DESCRIPTION="LibXau manipulates .Xauthority files, used by xauth, X servers, \
and display managers to store shared secret data such as MIT-MAGIC-COOKIEs \
used for authenticating X clients attempting to connect to an X server.
LibXau is used by both Xlib and XCB."
HOMEPAGE="https://www.x.org/"
COPYRIGHT="1988, 1993, 1994, 1998  The Open Group"
LICENSE="MIT (no promotion)"
REVISION="1"
SOURCE_URI="https://www.x.org/releases/individual/lib/libXau-$portVersion.tar.bz2"
CHECKSUM_SHA256="ccf8cbf0dbf676faa2ea0a6d64bcc3b6746064722b606c8c52917ed00dcb73ec"
SOURCE_DIR="libXau-$portVersion"
PATCHES="libxau-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

PROVIDES="
	libxau$secondaryArchSuffix = $portVersion
	lib:libxau$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	libxau${secondaryArchSuffix}_devel = $portVersion
	devel:libxau$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libxau$secondaryArchSuffix == $portVersion base
	devel:xproto
	"

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

defineDebugInfoPackage libxau$secondaryArchSuffix \
	"$libDir"/libXau.so.$libVersion

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

INSTALL()
{
	make install

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

	prepareInstalledDevelLib libXau
	fixPkgconfig

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

TEST()
{
	make check
}
