# Maintainer: Christoph Reiter <reiter.christoph@gmail.com>

_realname=libbs2b
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=3.1.0
pkgrel=1
pkgdesc="Bauer stereophonic-to-binaural DSP effect library (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64')
url='https://bs2b.sourceforge.io/'
license=('MIT')
depends=("${MINGW_PACKAGE_PREFIX}-libsndfile")
source=("https://downloads.sourceforge.net/bs2b/${_realname}-${pkgver}.tar.gz")
sha256sums=('6aaafd81aae3898ee40148dd1349aab348db9bfae9767d0e66e0b07ddd4b2528')

prepare() {
  cd "$srcdir"/${_realname}-${pkgver}
}

build() {
  cd "$srcdir"/${_realname}-${pkgver}
  [[ -d "${srcdir}"/build-${CARCH} ]] && rm -rf "${srcdir}"/build-${CARCH}
  mkdir -p "${srcdir}"/build-${CARCH} && cd "${srcdir}"/build-${CARCH}

  ../${_realname}-${pkgver}/configure \
    --prefix=${MINGW_PREFIX} \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --enable-static \
    --enable-shared

  make
}

package() {
  cd "${srcdir}"/build-${CARCH}
  make install DESTDIR="${pkgdir}"
}
