# Maintainer: Andrew Sun <adsun701@gmail.com>

_realname=vo-amrwbenc
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=0.1.3
pkgrel=1
pkgdesc="VisualOn Adaptive Multi Rate Wideband (AMR-WB) encoder (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://sourceforge.net/projects/opencore-amr/"
license=('APACHE')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
source=("https://downloads.sourceforge.net/project/opencore-amr/${_realname}/${_realname}-${pkgver}.tar.gz")
sha256sums=('5652b391e0f0e296417b841b02987d3fd33e6c0af342c69542cbb016a71d9d4e')

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}"
}
