SUMMARY="X Toolkit Intrinsics library"
DESCRIPTION="libXt provides the X Toolkit Intrinsics, an abstract widget \
library upon which other toolkits are based. Xt is the basis for many \
toolkits, including the Athena widgets (Xaw), and LessTif (a Motif \
implementation)."
HOMEPAGE="https://www.x.org/releases/individual/lib/"
COPYRIGHT="1993, 1994 X Consortium
	1989, 1998 The Open Group
	1987, 1988 by Digital Equipment Corporation
	1993, 2011, Oracle and/or its affiliates
	2001, 2003 Keith Packard"
LICENSE="MIT (no promotion)"
REVISION="1"
SOURCE_URI="https://www.x.org/releases/individual/lib/libXt-$portVersion.tar.bz2"
CHECKSUM_SHA256="b31df531dabed9f4611fc8980bc51d7782967e2aff44c4105251a1acb5a77831"
SOURCE_DIR="libXt-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	libxt$secondaryArchSuffix = $portVersion
	lib:libXt$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libICE$secondaryArchSuffix
	lib:libSM$secondaryArchSuffix
	lib:libX11$secondaryArchSuffix
	"

PROVIDES_devel="
	libxt${secondaryArchSuffix}_devel = $portVersion
	devel:libXt$secondaryArchSuffix = $libVersion
	"
REQUIRES_devel="
	libxt$secondaryArchSuffix == $portVersion base
	devel:libICE$secondaryArchSuffix
	devel:libSM$secondaryArchSuffix
	devel:libX11$secondaryArchSuffix
	devel:xproto
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	docbook_xml_dtd
	docbook_xsl_stylesheets
	devel:libglib_2.0$secondaryArchSuffix
	devel:libICE$secondaryArchSuffix
	devel:libSM$secondaryArchSuffix
	devel:libX11$secondaryArchSuffix
	devel:util_macros
	devel:xorg_sgml_doctools
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:perl
	cmd:pkg_config$secondaryArchSuffix
	cmd:xmlto
	cmd:xsltproc
	"

defineDebugInfoPackage libxt$secondaryArchSuffix \
	$libDir/libXt.so.$libVersion

BUILD()
{
	# --disable-selective-werror else makestrs fails the build
	autoreconf -vfi
	runConfigure --omit-dirs docDir ./configure \
		--docdir=$developDocDir \
		--disable-selective-werror
	make $jobArgs
}

INSTALL()
{
	make install

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

	rm -f $libDir/*.la

	prepareInstalledDevelLib libXt
	fixPkgconfig

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

TEST()
{
	make check
}
