# Maintainer:
# Contributor: Andrea Scarpino <andrea@archlinux.org>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Adrià Arrufat <swiftscythe@gmail.com>
# Contributor: Mark Lee <mark@markelee.com>

pkgname=mediastreamer
pkgver=2.16.1
pkgrel=6
pkgdesc="A library written in C that allows you to create and run audio and video streams"
arch=(x86_64)
url="https://github.com/BelledonneCommunications/mediastreamer2"
license=(GPL)
depends=(ortp ffmpeg libxv libupnp bzrtp glew libsrtp)
# xxd from Vim is needed to build
makedepends=(intltool vim bcunit)
source=("$pkgname-$pkgver.tar.gz::https://github.com/BelledonneCommunications/mediastreamer2/archive/$pkgver.tar.gz"
        libsrtp2.diff)
sha256sums=('25e0557d5b992d256a6df07466ba3c10587bdf899850b46a31e79b91147e5910'
            'faec3586e3ff8315d79fb5ef5bcc4d630ee66e63a9c6a25f28d113765fa28e58')
validpgpkeys=('9774BC1725758EB16D639F8B3ECD52DEE2F56985')

prepare() {
  cd ${pkgname}2-$pkgver
  patch -Np1 -i ../libsrtp2.diff
  ./autogen.sh
}

build() {
  cd ${pkgname}2-$pkgver
  export CFLAGS="$CFLAGS -DMS2_GIT_VERSION=\"\\\"unknown\\\"\""
  ./configure --prefix=/usr \
    --enable-glx --enable-xv --enable-zrtp --enable-external-ortp --disable-strict
  make
}

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