# Maintainer: bill-auger <bill-auger@programmer.net>


pkgbase=libninjam
pkgname=(libninjam ninjam-client ninjam-server)
pkgver=0.7.0
pkgrel=1
pkgdesc="common base library for compatible NINJAM servers and clients"
arch=(armv7h i686 x86_64)
url=https://github.com/libninjam/libninjam
license=('GPL2')

depends=('jack' 'libvorbis')
source=(https://github.com/libninjam/${pkgname}/archive/v${pkgver}.tar.gz)
sha256sums=('6b869f32669a06845546cbb7df0f20758abb99e1506049996c66c00198a2f662')


build()
{
  cd ${pkgbase}-${pkgver}

  make
}

package_libninjam()
{
  cd ${pkgbase}-${pkgver}

  mkdir   -p                               "$pkgdir"/usr/include/libninjam/ninjam
  install -m 644 src/ninjam/*.h            "$pkgdir"/usr/include/libninjam/ninjam/
  mkdir   -p                               "$pkgdir"/usr/include/libninjam/WDL/jnetlib
  install -m 644 src/WDL/*.h               "$pkgdir"/usr/include/libninjam/WDL/
  install -m 644 src/WDL/jnetlib/*.h       "$pkgdir"/usr/include/libninjam/WDL/jnetlib/
  mkdir   -p                               "$pkgdir"/usr/lib/pkgconfig
  install -m 644 build/lib/*.so            "$pkgdir"/usr/lib/
  install -m 644 build/lib/*.a             "$pkgdir"/usr/lib/
  install -m 644 build/pc/ninjam.pc        "$pkgdir"/usr/lib/pkgconfig/
  install -m 644 build/pc/ninjam-client.pc "$pkgdir"/usr/lib/pkgconfig/
}

package_ninjam-client()
{
  cd ${pkgbase}-${pkgver}

  install -Dm755 build/ninjamsrv "$pkgdir"/usr/bin/cninjam
}

package_ninjam-server()
{
  cd ${pkgbase}-${pkgver}

  install -Dm755 build/ninjamsrv "$pkgdir"/usr/bin/ninjamsrv
}
