SUMMARY="A C library to run an HTTP server as part of another application"
DESCRIPTION="GNU libmicrohttpd is a small C library that is supposed to make \
it easy to run an HTTP server as part of another application. GNU GNU \
Libmicrohttpd is free software and part of the GNU project. Key features \
that distinguish GNU Libmicrohttpd from other projects are:

* C library: fast and small
* API is simple, expressive and fully reentrant
* Implementation is HTTP 1.1 compliant
* HTTP server can listen on multiple ports
* Four different threading models (select, poll, pthread, thread pool)
* Supported platforms include GNU/Linux, FreeBSD, OpenBSD, NetBSD, Android,
* OSX, W32, Symbian and z/OS
* Support for IPv6
* Support for SHOUTcast
* Support for incremental processing of POST data (optional)
* Support for basic and digest authentication (optional)
* Support for SSL3 and TLS (requires libgcrypt and libgnutls, optional)
* Binary is only about 32k (without TLS/SSL support and other optional features)

GNU Libmicrohttpd was started because the author needed an easy way to add a \
concurrent HTTP server to other projects. Existing alternatives were either \
non-free, not reentrant, standalone, of terrible code quality or a \
combination thereof. Do not use GNU Libmicrohttpd if you are looking for a \
standalone HTTP server, there are many other projects out there that provide \
that kind of functionality already. However, if you want to be able to serve \
simple WWW pages from within your C or C++ application, check it out."
HOMEPAGE="https://www.gnu.org/software/libmicrohttpd/"
COPYRIGHT="2017 Free Software Foundation, Inc."
LICENSE="GNU LGPL v2.1"
REVISION="3"
SOURCE_URI="http://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-$portVersion.tar.gz"
CHECKSUM_SHA256="0c1cab8dc9f2588bd3076a28f77a7f8de9560cbf2d80e53f9a8696ada80ed0f8"
PATCHES="libmicrohttpd-$portVersion.patchset"

ARCHITECTURES="all"
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	libmicrohttpd$secondaryArchSuffix = $portVersion
	lib:libmicrohttpd$secondaryArchSuffix = 12.43.0 compat >= 12
	lib:libmicrospdy$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libcrypto$secondaryArchSuffix
	lib:libgcrypt$secondaryArchSuffix
	lib:libgnutls$secondaryArchSuffix
	lib:libgpg_error$secondaryArchSuffix
	lib:libssl$secondaryArchSuffix
	"

PROVIDES_devel="
	libmicrohttpd${secondaryArchSuffix}_devel = $portVersion
	devel:libmicrohttpd$secondaryArchSuffix = 12.43.0 compat >= 12
	devel:libmicrospdy$secondaryArchSuffix = 0.0.0 compat >= 0
	"
REQUIRES_devel="
	haiku${secondaryArchSuffix}_devel
	libmicrohttpd$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libcrypto$secondaryArchSuffix
	devel:libgcrypt$secondaryArchSuffix
	devel:libgnutls$secondaryArchSuffix
	devel:libgpg_error$secondaryArchSuffix
	devel:libssl$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:aclocal
	cmd:autoconf
	cmd:automake
	cmd:autoreconf
	cmd:awk
	cmd:gcc$secondaryArchSuffix
	cmd:libtoolize$secondaryArchSuffix
	cmd:make
	cmd:makeinfo
	cmd:pkg_config$secondaryArchSuffix
	"

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

INSTALL()
{
	make install

	rm $libDir/libmicrohttpd.la

	fixPkgconfig
	prepareInstalledDevelLibs \
		libmicrohttpd
	packageEntries devel \
		$developDir
}
