SUMMARY="A validating XML parser written in a portable subset of C++"
DESCRIPTION="This library makes it easy to give your application the ability \
to read and write XML data. A shared library is provided for parsing, \
generating, manipulating, and validating XML documents using the DOM, SAX, \
and SAX2 APIs."
HOMEPAGE="https://xerces.apache.org/xerces-c/"
COPYRIGHT="1999-2015 The Apache Software Foundation"
LICENSE="Apache v2"
REVISION="1"
SOURCE_URI="http://apache.mirrors.tds.net//xerces/c/3/sources/xerces-c-$portVersion.tar.gz"
CHECKSUM_SHA256="743bd0a029bf8de56a587c270d97031e0099fe2b7142cef03e0da16e282655a0"
SOURCE_DIR="xerces-c-$portVersion"

ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="!x86_gcc2 x86"

PROVIDES="
	xerces_c$secondaryArchSuffix = $portVersion compat >= 3.1
	lib:libxerces_c_3.1$secondaryArchSuffix = 3.1
	cmd:CreateDOMDocument$secondaryArchSuffix
	cmd:DOMCount$secondaryArchSuffix
	cmd:DOMPrint$secondaryArchSuffix
	cmd:EnumVal$secondaryArchSuffix
	cmd:MemParse$secondaryArchSuffix
	cmd:PParse$secondaryArchSuffix
	cmd:PSVIWriter$secondaryArchSuffix
	cmd:Redirect$secondaryArchSuffix
	cmd:SAX2Count$secondaryArchSuffix
	cmd:SAX2Print$secondaryArchSuffix
	cmd:SAXCount$secondaryArchSuffix
	cmd:SAXPrint$secondaryArchSuffix
	cmd:SCMPrint$secondaryArchSuffix
	cmd:SEnumVal$secondaryArchSuffix
	cmd:StdInParse$secondaryArchSuffix
	cmd:XInclude$secondaryArchSuffix
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	REQUIRES+="
		lib:libgcc_s$secondaryArchSuffix
		"
fi

PROVIDES_devel="
	xerces_c${secondaryArchSuffix}_devel = $portVersion compat >= 3.1
	devel:libxerces_c_3.1$secondaryArchSuffix = 3.1
	devel:libxerces_c$secondaryArchSuffix = 3.1
	"
REQUIRES_devel="
	xerces_c$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize
	cmd:make
	"

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

INSTALL()
{
	make install-strip
	
	prepareInstalledDevelLibs libxerces-c
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir
}
