SUMMARY="An XML processing library"
DESCRIPTION="Pugixml is a C++ XML processing library, which consists of a \
DOM-like interface with rich traversal/modification capabilities, an \
extremely fast XML parser which constructs the DOM tree from an XML \
file/buffer, and an XPath 1.0 implementation for complex data-driven tree \
queries.
Full Unicode support is also available, with Unicode interface \
variants and conversions between different Unicode encodings (which \
happen automatically during parsing/saving)."
HOMEPAGE="https://pugixml.org/"
COPYRIGHT="2006-2021 Arseny Kapoulkine"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/zeux/pugixml/releases/download/v${portVersion}/pugixml-$portVersion.tar.gz"
CHECKSUM_SHA256="8ddf57b65fb860416979a3f0640c2ad45ddddbbafa82508ef0a0af3ce7061716"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="x86"

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

PROVIDES="
	pugixml$secondaryArchSuffix = $portVersion
	lib:libpugixml$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	pugixml${secondaryArchSuffix}_devel = $portVersion
	devel:libpugixml$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	pugixml$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	"

defineDebugInfoPackage pugixml$secondaryArchSuffix \
	$libDir/libpugixml.so.$libVersion

BUILD()
{
	cmake -B build -S . \
		-DBUILD_SHARED_LIBS=ON \
		$cmakeDirArgs

	make -C build $jobArgs
}

INSTALL()
{
	make -C build install

	# prepare develop/lib
	prepareInstalledDevelLib libpugixml
	fixPkgconfig

	# devel package
	packageEntries devel \
		$developDir \
		$libDir/cmake
}

TEST()
{
	make -C build test
}
