# Maintainer: Sergej Pupykin <arch+pub@sergej.pp.ru>
# Maintainer: Yuval Adam <yuval at y3xz dot com> PGP-Key: 271386AA2EB7672F
# Contributor: Yejun Yang <yejunx AT gmail DOT com>
# Contributor: Biru Ionut <ionut@archlinux.ro>

pkgname=yate
pkgver=6.4.1
_commit=f46ba196e1b4e083923f522306ba81d1bf65c688
pkgrel=1
pkgdesc="Next-generation telephony engine"
arch=('x86_64')
url="http://www.yate.ro/"
license=('GPL')
backup=('etc/yate/accfile.conf'
	'etc/yate/amrnbcodec.conf'
	'etc/yate/analog.conf'
	'etc/yate/cache.conf'
	'etc/yate/callcounters.conf'
	'etc/yate/callfork.conf'
	'etc/yate/camel_map.conf'
	'etc/yate/ccongestion.conf'
	'etc/yate/cdrbuild.conf'
	'etc/yate/cdrfile.conf'
	'etc/yate/ciscosm.conf'
	'etc/yate/clustering.conf'
	'etc/yate/cpuload.conf'
	'etc/yate/dbpbx.conf'
	'etc/yate/dsoundchan.conf'
	'etc/yate/dummyradio.conf'
	'etc/yate/enumroute.conf'
	'etc/yate/eventlogs.conf'
	'etc/yate/extmodule.conf'
	'etc/yate/fileinfo.conf'
	'etc/yate/filetransfer.conf'
	'etc/yate/gvoice.conf'
	'etc/yate/h323chan.conf'
	'etc/yate/heartbeat.conf'
	'etc/yate/isupmangler.conf'
	'etc/yate/jabberclient.conf'
	'etc/yate/jabberserver.conf'
	'etc/yate/javascript.conf'
	'etc/yate/jbfeatures.conf'
	'etc/yate/lateroute.conf'
	'etc/yate/lksctp.conf'
	'etc/yate/mgcpca.conf'
	'etc/yate/mgcpgw.conf'
	'etc/yate/moh.conf'
	'etc/yate/monitoring.conf'
	'etc/yate/mux.conf'
	'etc/yate/mysqldb.conf'
	'etc/yate/openssl.conf'
	'etc/yate/pbxassist.conf'
	'etc/yate/pgsqldb.conf'
	'etc/yate/presence.conf'
	'etc/yate/providers.conf'
	'etc/yate/queues.conf'
	'etc/yate/queuesnotify.conf'
	'etc/yate/radiotest.conf'
	'etc/yate/regexroute.conf'
	'etc/yate/regfile.conf'
	'etc/yate/register.conf'
	'etc/yate/rmanager.conf'
	'etc/yate/sigtransport.conf'
	'etc/yate/sip_cnam_lnp.conf'
	'etc/yate/sipfeatures.conf'
	'etc/yate/sqlitedb.conf'
	'etc/yate/ss7_lnp_ansi.conf'
	'etc/yate/subscription.conf'
	'etc/yate/tdmcard.conf'
	'etc/yate/tonegen.conf'
	'etc/yate/users.conf'
	'etc/yate/wpcard.conf'
	'etc/yate/yate.conf'
	'etc/yate/yate-qt4.conf'
	'etc/yate/ybladerf.conf'
	'etc/yate/yiaxchan.conf'
	'etc/yate/yjinglechan.conf'
	'etc/yate/yradius.conf'
	'etc/yate/yrtpchan.conf'
	'etc/yate/ysigchan.conf'
	'etc/yate/ysipchan.conf'
	'etc/yate/ysnmpagent.conf'
	'etc/yate/ysockschan.conf'
	'etc/yate/ystunchan.conf'
	'etc/yate/zapcard.conf'
	'etc/yate/zlibcompress.conf')
depends=('speex' 'gsm' 'postgresql-libs' 'mariadb-libs' 'alsa-lib' 'openssl' 'sqlite')
makedepends=('git' 'doxygen')
options=(!makeflags)
source=("git+https://github.com/yatevoip/yate.git#commit=${_commit}"
	"yate.service")
sha256sums=('9f018126958a4379da57a690e6d7cd80fd87122e594a13e57eaa9699e318717b'
            '73eab39a0ba884a4c36ca7c8f1faea4000301a0e795544b74cba78d90de5e302')

build() {
  cd "$srcdir/${pkgname}"
  test -x ./configure || ./autogen.sh
  ./configure --prefix=/usr \
              --sysconfdir=/etc \
              --with-libpq \
              --with-mysql \
              --without-openh323
  make
}

package(){
  cd "$srcdir/${pkgname}"
  make DESTDIR="$pkgdir" install
  install -Dm0644 "$srcdir"/yate.service "$pkgdir"/usr/lib/systemd/system/yate.service
}
