SUMMARY="A strictly RFC 3986 compliant URI parsing library in C"
DESCRIPTION="uriparser is a strictly RFC 3986 compliant URI parsing and handling library written \
in C89 (ANSI C).
uriparser is cross-platform, fast, supports both char and wchar_t."
HOMEPAGE="https://uriparser.github.io/"
COPYRIGHT="2007 Weijia Song
	2013 Radu Hociung
	2007-2022 Sebastian Pipping"
LICENSE="BSD (3-clause)"
REVISION="1"
SOURCE_URI="https://github.com/uriparser/uriparser/releases/download/uriparser-$portVersion/uriparser-$portVersion.tar.bz2"
CHECKSUM_SHA256="9ce4c3f151e78579f23937b44abecb428126863ad02e594e115e882353de905b"
SOURCE_FILENAME="uriparser-$portVersion.tar.gz"
SOURCE_DIR="uriparser-$portVersion"

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

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

PROVIDES="
	uriparser$secondaryArchSuffix = $portVersion
	cmd:uriparse$secondaryArchSuffix = $portVersion
	lib:liburiparser$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgtest$secondaryArchSuffix
	"

PROVIDES_devel="
	uriparser${secondaryArchSuffix}_devel = $portVersion
	devel:liburiparser$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	uriparser$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgtest$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:dot
	cmd:doxygen
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	cmd:qhelpgenerator$secondaryArchSuffix
	"

defineDebugInfoPackage uriparser$secondaryArchSuffix \
	"$libDir"/liburiparser.so.$libVersion

BUILD()
{
	cmake -B build -S . \
		$cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release
	make -C build $jobArgs
}

INSTALL()
{
	make -C build install

	rm -f "$libDir"/liburiparser.la

	prepareInstalledDevelLib liburiparser
	fixPkgconfig

	packageEntries devel \
		"$developDir" \
		"$libDir"/cmake
}

TEST()
{
	make -C build test
}
