SUMMARY="A library for establishing peer-to-peer UDP data streams"
DESCRIPTION="Libnice is an implementation of the IETF's Interactive \
Connectivity Establishment (ICE) standard (RFC 5245) and the Session Traversal \
Utilities for NAT (STUN) standard (RFC 5389).

ICE is useful for applications that want to establish peer-to-peer UDP \
data streams. It automates the process of traversing NATs and provides \
security against some attackes. It also allows applications to create \
reliable streams using a TCP over UDP layer."
HOMEPAGE="http://nice.freedesktop.org/wiki"
COPYRIGHT="2006-2011 Collabora Ltd.
	2006-2011 Nokia Corporation"
LICENSE="MPL v1.1
	GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="http://nice.freedesktop.org/releases/libnice-$portVersion.tar.gz"
CHECKSUM_SHA256="5eabd25ba2b54e817699832826269241abaa1cf78f9b240d1435f936569273f4"
PATCHES="libnice-$portVersion.patchset"

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

PROVIDES="
	libnice$secondaryArchSuffix = $portVersion
	cmd:stunbdc$secondaryArchSuffix = $portVersion
	cmd:stund$secondaryArchSuffix = $portVersion
	lib:libnice$secondaryArchSuffix = 10.11.0 compat >= 10
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libgio_2.0$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgnutls$secondaryArchSuffix
	lib:libgobject_2.0$secondaryArchSuffix
	"

PROVIDES_devel="
	libnice${secondaryArchSuffix}_devel = $portVersion
	devel:libnice$secondaryArchSuffix = 10.11.0 compat >= 10
	"
REQUIRES_devel="
	libnice$secondaryArchSuffix == $portVersion
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libgio_2.0$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libgnutls$secondaryArchSuffix
	devel:libgobject_2.0$secondaryArchSuffix
	devel:libgthread_2.0$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
#	cmd:gtkdocize
	cmd:ld$secondaryArchSuffix
	cmd:meson
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	export CFLAGS="-D_BSD_SOURCE"
	meson build \
		--prefix="$prefix" --libdir="$libDir" --includedir="$includeDir" \
		--bindir="$binDir" \
		-Dgstreamer=disabled
	meson compile -C build
}

INSTALL()
{
	meson install -C build

	prepareInstalledDevelLibs libnice
	fixPkgconfig

	packageEntries devel $developDir
}

TEST()
{
	meson test -C build
}
