# Maintainer: Eric Bélanger <eric@archlinux.org>

pkgname=gupnp-igd
pkgver=0.2.5+3+gedd78a6
pkgrel=2
pkgdesc="A library to handle UPnP IGD port mapping"
url="https://wiki.gnome.org/Projects/GUPnP"
arch=(x86_64)
license=(LGPL)
depends=(gupnp)
makedepends=(gobject-introspection git gtk-doc)
_commit=edd78a6561fc1a6e6769342157f0e4db62705fa3  # master
source=("git+https://gitlab.gnome.org/GNOME/gupnp-igd.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd $pkgname

  # gupnp 1.2
  git cherry-pick -n 63531558a16ac2334a59f627b2fca5576dcfbb2e

  gtkdocize
  autoreconf -fvi
}

build() {
  cd $pkgname
  ./configure --prefix=/usr --enable-gtk-doc
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

check() {
  cd $pkgname
  # test broken (requires root to bind lowport)
  make check || :
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
}

