SUMMARY="HTTP/2 C Library"
DESCRIPTION="nghttp2 is an implementation of HTTP/2 and its header compression \
algorithm HPACK in C."
HOMEPAGE="https://nghttp2.org/"
COPYRIGHT="2012-2018 Tatsuhiro Tsujikawa & nghttp2 contributors"
LICENSE="MIT"
REVISION="1"
SOURCE_URI="https://github.com/nghttp2/nghttp2/releases/download/v$portVersion/nghttp2-$portVersion.tar.xz"
CHECKSUM_SHA256="f7d54fa6f8aed29f695ca44612136fa2359013547394d5dffeffca9e01a26b0f"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

PROVIDES="
	nghttp2$secondaryArchSuffix = $portVersion
	lib:libnghttp2$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	"

PROVIDES_devel="
	nghttp2${secondaryArchSuffix}_devel = $portVersion
	devel:libnghttp2$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	nghttp2$secondaryArchSuffix == $portVersion base
	"

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

defineDebugInfoPackage nghttp2$secondaryArchSuffix \
	"$libDir"/libnghttp2.so.$libVersion

BUILD()
{
	runConfigure ./configure \
		--enable-lib-only \

	make $jobArgs
}

INSTALL()
{
	make install

	rm -f "$libDir"/libnghttp2.la "$libDir"/libnghttp2.a

	rm -rf "$manDir"/man1

	prepareInstalledDevelLib libnghttp2
	fixPkgconfig

	packageEntries devel \
		"$developDir"

	rmdir "$manDir"
}

TEST()
{
	make check
}
