SUMMARY="X Athena Widget library"
DESCRIPTION="X Athena Widgets, or Xaw, is a widget set based on the X Toolkit \
Intrinsics (Xt) Library. Xaw & Xt form together what is known as the X Toolkit."
HOMEPAGE="https://www.x.org/releases/individual/lib/"
COPYRIGHT="1985-1990, 1994, 1998 The Open Group
	2003-2004 Roland Mainz
	1998-1999 The XFree86 Project, Inc.
	1991 OMRON Corporation
	1985-1998 Digital Equipment Corporation
	1989 Prentice Hall
	1985-1989, 1991, 1994 X Consortium"
LICENSE="MIT"
REVISION="2"
SOURCE_URI="https://www.x.org/releases/individual/lib/libXaw-$portVersion.tar.bz2"
CHECKSUM_SHA256="76aef98ea3df92615faec28004b5ce4e5c6855e716fa16de40c32030722a6f8e"
SOURCE_DIR="libXaw-$portVersion"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

libVersion6="6.0.1"
libVersion7="7.0.0"

libVersionCompat6="$libVersion6 compat >= 6"
libVersionCompat7="$libVersion7 compat >= 7"

PROVIDES="
	libxaw$secondaryArchSuffix = $portVersion
	lib:libxaw6$secondaryArchSuffix = $libVersionCompat6
	lib:libxaw7$secondaryArchSuffix = $libVersionCompat7
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libX11$secondaryArchSuffix
	lib:libXext$secondaryArchSuffix
	lib:libXmu$secondaryArchSuffix
	lib:libXpm$secondaryArchSuffix
	lib:libXt$secondaryArchSuffix
	"

PROVIDES_devel="
	libxaw${secondaryArchSuffix}_devel = $portVersion
	devel:libXaw$secondaryArchSuffix
	devel:libXaw6$secondaryArchSuffix = $libVersionCompat6
	devel:libXaw7$secondaryArchSuffix = $libVersionCompat7
	"
REQUIRES_devel="
	libxaw$secondaryArchSuffix == $portVersion base
	devel:libX11$secondaryArchSuffix
	devel:libXext$secondaryArchSuffix
	devel:libXmu$secondaryArchSuffix
	devel:libXpm$secondaryArchSuffix
	devel:libXt$secondaryArchSuffix
	devel:xproto
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	docbook_xml_dtd
	docbook_xsl_stylesheets
	devel:libX11$secondaryArchSuffix
	devel:libXext$secondaryArchSuffix
	devel:libXmu$secondaryArchSuffix
	devel:libXpm$secondaryArchSuffix
	devel:libXt$secondaryArchSuffix
	devel:util_macros
	devel:xorg_sgml_doctools
	"
BUILD_PREREQUIRES="
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:xmlto
	cmd:xsltproc
	"

defineDebugInfoPackage libxaw$secondaryArchSuffix \
	$libDir/libXaw6.so.$libVersion6 \
	$libDir/libXaw7.so.$libVersion7

BUILD()
{
	runConfigure --omit-dirs docDir ./configure --docdir="$developDocDir"
	make $jobArgs
}

INSTALL()
{
	make install

	if [ -z "$secondaryArchSuffix" ]; then
		maybe_manDir="$manDir"
	else
		rm -rf "$manDir"
		rm -rf "$developDir/documentation"
		maybe_manDir=
	fi

	rm -f $libDir/libXaw*a

	prepareInstalledDevelLibs \
		libXaw6 \
		libXaw7 \
		libXaw
	fixPkgconfig

	# add missing symlinks
	ln -s libXaw6.so.$libVersion6 $libDir/libXaw6.so.6
	ln -s libXaw6.so.$libVersion6 $libDir/libXaw.so.6
	ln -s libXaw7.so.$libVersion7 $libDir/libXaw7.so.7
	ln -s libXaw7.so.$libVersion7 $libDir/libXaw.so.7

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