# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libnice
pkgver=0.1.22
pkgrel=0
pkgdesc="GLib ICE implementation"
url="https://libnice.freedesktop.org/"
arch="all"
license="LGPL-2.1-or-later AND MPL-1.1"
makedepends="
	glib-dev
	gnutls-dev
	gstreamer-dev
	gobject-introspection-dev
	meson"
subpackages="
	$pkgname-dbg
	$pkgname-dev
	$pkgname-gstreamer:_gst"
source="https://nice.freedesktop.org/releases/libnice-$pkgver.tar.gz
	libnice-meson-0.58.patch
	test-pseudotcp.patch
	"

build() {
	abuild-meson \
		-Db_lto=true \
		-Dgtk_doc=disabled \
		-Dtests="$(want_check && echo enabled || echo disabled)" \
		-Dexamples=disabled \
		-Dintrospection=enabled \
		-Dcrypto-library=gnutls \
		-Dgstreamer=enabled \
		-Dgupnp=disabled builddir
	meson compile -C builddir
}

check() {
	meson test --print-errorlogs -C builddir
}

package() {
	DESTDIR="$pkgdir" meson install --no-rebuild -C builddir
}

_gst() {
	pkgdesc="Gstreamer 1.0 plugin for libnice"
	amove usr/lib/gstreamer-*
}

sha512sums="
c3aae2d36d2cec8654b87ecc464296711a4a64335052dfc1477f43f59e90341f7a6a01ebd4edf91a72d9ec425440e6dd0bd8f817c77e03578854e70193b3306b  libnice-0.1.22.tar.gz
c59962a20d554da909a993f5d83d8d96da927d0ac94cfef2f699468326509f5715e8f7054badd25d07819b733dcea13c308b72aff170c013f7004dadba960dd7  libnice-meson-0.58.patch
c2a7664e441a8f078e82a4557c015894007cf1f332af1055576924e6c5fc583b04bec01d652ae86f438b89ae200094bba391410523761a1911ff8aedf2488d94  test-pseudotcp.patch
"
