# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Ionut Biru <ibiru@archlinux.org>

pkgname=libdmapsharing
pkgver=3.9.13
pkgrel=1
pkgdesc="A library that implements the DMAP family of protocols"
url="https://www.flyn.org/projects/libdmapsharing/index.html"
arch=(x86_64)
license=(LGPL2.1)
depends=(
  avahi
  gdk-pixbuf2
  gst-plugins-base-libs
  libsoup3
)
makedepends=(
  git
  gobject-introspection
  gtk-doc
  vala
)
provides=(libdmapsharing-4.0.so)
_commit=9eadd4a2ab454201437612b54e7df760431d8e0b  # tags/LIBDMAPSHARING_3_9_13^0
source=("git+https://gitlab.gnome.org/GNOME/libdmapsharing.git#commit=$_commit")
b2sums=('SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^LIBDMAPSHARING_//;s/_/./g;s/[^-]*-g/r&/;s/-/+/g'
}

prepare() {
  cd $pkgname
  NOCONFIGURE=1 ./autogen.sh
}

build() {
  local configure_args=(
    --prefix=/usr
    --sysconfdir=/etc
    --localstatedir=/var
    --with-mdns=avahi

    # Disable tests; get built into the library, adding a dep on libcheck
    --disable-tests

    # GTK-docs are broken when tests are disabled
    --disable-gtk-doc
  )


  cd $pkgname
  ./configure "${configure_args[@]}"
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

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

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