SUMMARY="X11 Screen Saver extension client library"
DESCRIPTION="The library provided by libXScrnSaver is an extension to the X \
protocol. It allows X clients behaving as screen savers to register themselves \
with the X server to better integrate themselves with the running X11 session."
HOMEPAGE="https://cgit.freedesktop.org/xorg/lib/libXScrnSaver
	https://www.x.org/releases/individual/lib/"
COPYRIGHT="1992 X Consortium
	2003-2012 The XFree86 Project, Inc."
LICENSE="libXScrnSaver"
REVISION="4"
SOURCE_URI="https://www.x.org/releases/individual/lib/libXScrnSaver-$portVersion.tar.bz2"
CHECKSUM_SHA256="f917075a1b7b5a38d67a8b0238eaab14acd2557679835b154cf2bca576e89bf8"
SOURCE_DIR="libXScrnSaver-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

# server-interfacing: needs libX11_xcb.

PROVIDES="
	libxscrnsaver$secondaryArchSuffix = $portVersion
	lib:libXss$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libX11_xcb$secondaryArchSuffix
	lib:libXext$secondaryArchSuffix
	"

PROVIDES_devel="
	libxscrnsaver${secondaryArchSuffix}_devel = $portVersion
	devel:libXss$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	libxscrnsaver$secondaryArchSuffix == $portVersion base
	devel:libX11_xcb$secondaryArchSuffix
	devel:libXext$secondaryArchSuffix
	devel:scrnsaverproto
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libX11_xcb$secondaryArchSuffix
	devel:libXext$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 libxscrnsaver$secondaryArchSuffix \
	"$libDir"/libXss.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
		maybe_manDir="$manDir"
	else
		rm -rf "$manDir"
		maybe_manDir=
	fi

	rm -f "$libDir"/libXss.la

	prepareInstalledDevelLib libXss
	fixPkgconfig

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