# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: William Díaz <wdiaz@archlinux.us>

pkgname=libnice
pkgver=0.1.23
pkgrel=1
pkgdesc="Nice: GLib ICE library"
url="https://libnice.freedesktop.org/"
arch=(x86_64 aarch64)
license=('MPL-1.1 OR LGPL-2.1-only')
depends=(
  glib2
  glibc
  gnutls
  gupnp-igd
)
makedepends=(
  git
  glib2-devel
  gobject-introspection
  graphviz
  gstreamer
  gtk-doc
  meson
)
checkdepends=(
  gst-plugins-base-libs
)
optdepends=('gstreamer: "nice" GStreamer plugin')
provides=(libnice.so)
source=(
  "git+https://gitlab.freedesktop.org/libnice/libnice.git#tag=$pkgver"
  0001-Update-for-gupnp-igd-1.6.patch
)
b2sums=('bc7d0c8ba9f38081e36b523d2922642eba82d06d98de81f5b8ebd47a62f0af23b22c3892552696bcc32ac532a58f7a002da22c6b7bc066d8578f7798c0134376'
        '2ebec9811d22447d8e9212184cbb0677439dcb131407d5a61ccef5752722e97c517ee80dec6ed7d2db4e25ff4688db6ab557de405b3d73934e8eb8fbff98c023')

prepare() {
  cd libnice

  # https://gitlab.freedesktop.org/libnice/libnice/-/merge_requests/255
  git apply -3 ../0001-Update-for-gupnp-igd-1.6.patch
}

build() {
  local meson_options=(
    -D glib_debug=disabled
    -D gtk_doc=enabled
  )

  arch-meson libnice build "${meson_options[@]}"
  meson compile -C build
}

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

package() {
  meson install -C build --destdir "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
