# Maintainer (Arch): David Runge <dvzrv@archlinux.org>
# Contributor (Arch): Lukas Fleischer <lfleischer@archlinux.org>
# Contributor (Arch): Eric Belanger <eric@archlinux.org>
# Contributor (Arch): Darwin Bautista <djclue917@gmail.com>
# Contributor (Arch): Bob Finch <w9ya@qrparci.net>
# Maintainer: David P. <megver83@parabola.nu>

_pkgname=portaudio
pkgname=portaudio-git
_pkgver=19.6.0
pkgver=19.6.0.r749.78415a8
pkgrel=1
epoch=1
_commit=78415a8
pkgdesc='A free, cross-platform, open source, audio I/O library.'
arch=('x86_64' 'i686' 'armv7h')
url="http://www.portaudio.com/"
license=('MIT')
depends=('gcc-libs' 'glibc')
makedepends=('alsa-lib' 'jack' 'git')
provides=('libportaudio.so' 'libportaudiocpp.so' 'portaudio')
conflicts=('portaudio')
source=("git+https://github.com/PortAudio/portaudio.git#commit=${_commit}")
sha512sums=('SKIP')

pkgver() {
  cd "${_pkgname}"
  printf "%s.r%s.%s" "${_pkgver}" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

build() {
  cd "${_pkgname}"
  ./configure --prefix=/usr \
              --enable-cxx
  # build crashes somewhere above > 8 jobs
  make -j1
}

package() {
  depends+=('libasound.so' 'libjack.so')
  cd "${_pkgname}"
  make DESTDIR="${pkgdir}" install
  install -vDm 644 LICENSE.txt -t "${pkgdir}/usr/share/licenses/${_pkgname}"
  install -vDm 644 README.md -t "${pkgdir}/usr/share/doc/${_pkgname}"
}
