SUMMARY="A HTTP and WebDAV client library"
DESCRIPTION="Neon is a HTTP and WebDAV client library with a C interface.

Features:
- high-level wrappers for common HTTP and WebDAV operations (GET, MOVE, \
DELETE, etc.).
- low-level interface to the HTTP request/response engine, allowing the use of \
arbitrary HTTP methods, headers, etc.
- authentication support including Basic and Digest support, along with \
GSSAPI-based Negotiate on Unix, and SSPI-based Negotiate/NTLM on Win32.
- SSL/TLS support using OpenSSL or GnuTLS; exposing an abstraction layer for \
verifying server certificates, handling client certificates, and examining \
certificate properties. Smartcard-based client certificates are also supported \
via a PKCS#11 wrapper interface.
- abstract interface to parsing XML using libxml2 or expat, and wrappers to \
simplify handling XML HTTP response bodies.
- WebDAV metadata support; wrappers for PROPFIND and PROPPATCH to simplify \
property manipulation."
HOMEPAGE="https://notroj.github.io/neon/
	https://github.com/notroj/neon"
COPYRIGHT="1999-2021 Joe Orton and others"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://notroj.github.io/neon/neon-$portVersion.tar.gz"
CHECKSUM_SHA256="cf1ee3ac27a215814a9c80803fcee4f0ede8466ebead40267a9bd115e16a8678"
PATCHES="neon-$portVersion.patch"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"

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

PROVIDES="
	neon$secondaryArchSuffix = $portVersion compat >= 0.29
	lib:libneon$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libncurses$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	"

PROVIDES_devel="
	neon${secondaryArchSuffix}_devel = $portVersion compat >= 0.29
	cmd:neon_config$secondaryArchSuffix = $portVersion compat >= 0.29
	devel:libneon$secondaryArchSuffix = $libVersionCompat
	"
REQUIRES_devel="
	neon$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
	devel:libncurses$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

defineDebugInfoPackage neon$secondaryArchSuffix \
	"$libDir"/libneon.so.$libVersion

BUILD()
{
	echo 'LT_INIT' >> configure.ac
	echo 'AC_CONFIG_MACRO_DIR([macros])' >> configure.ac
	./autogen.sh
	runConfigure ./configure \
		--with-ssl=openssl \
		--with-libxml2 \
		--enable-shared \
		--disable-nls
	make $jobArgs
}

INSTALL()
{
	make install

	rm $libDir/libneon.la

	prepareInstalledDevelLib libneon
	fixDevelopLibDirReferences $binDir/neon-config
	fixPkgconfig

	# devel package
	packageEntries devel \
		$binDir/neon-config \
		$developDir \
		$documentationDir
}
