# $Id: PKGBUILD 138627 2015-08-22 06:02:04Z fyan $
# Maintainer: Felix Yan <felixonmars@archlinux.org>
# Contributor: Håvard Pettersson <mail@haavard.me>
# Contributor: naxuroqa <naxuroqa at gmail.com>
# Contributor: Boohbah <boohbah at gmail.com>
# Contributor: Kevin MacMartin <prurigro at gmail dot com>

pkgname=toxcore
pkgver=3496
pkgrel=1
pkgdesc='Secure, configuration-free, P2P Skype replacement backend'
arch=('i686' 'x86_64')
url='https://tox.chat'
license=('GPL3')
depends=('libconfig>=1.4'
         'libsodium>=1.0'
         'libvpx'
         'opus')
makedepends=('git' 'check')
conflicts=("tox")
provides=("tox")
source=("git+https://github.com/irungentoo/toxcore.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname
  git rev-list --count HEAD
}

build() {
  cd $pkgname
  autoreconf -if
  ./configure \
    --prefix=/usr \
    --enable-daemon \
    --disable-ntox \
    --disable-tests
  make
}

check() {
  cd $pkgname
  make check
}

package() {
  cd $pkgname
  make DESTDIR="$pkgdir" install
  install -Dm644 ./other/bootstrap_daemon/tox-bootstrapd.service "$pkgdir/usr/lib/systemd/system/tox-bootstrapd.service"
}
