# Maintainer: Alexey Pavlov <alexpux@gmail.com>
# Contributor: Sandro Cumerlato <sandro.cumerlato@gmail.com>

_realname=kiss_fft
pkgbase=mingw-w64-${_realname}
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.3.1
pkgrel=1
pkgdesc="A Fast Fourier Transform based up on the principle: Keep It Simple, Stupid (mingw-w64)"
url="https://github.com/mborgerding/kissfft"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
license=('BSD')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc")
source=("${_realname}-${pkgver}.tar.gz"::https://github.com/mborgerding/kissfft/archive/v${pkgver//./}.tar.gz
        mingw-build.patch)
sha256sums=('a4f28cac6da18a5af7726a442416de87a6a3108fa12a59e101fa2f23defe4cf7'
            '5740e4fa233c3d715d7d375f920c712df4ed0cc636c43c40c1849ba27d602c38')

prepare() {
  cd "kissfft-${pkgver//./}"
  patch -p0 -i ${srcdir}/mingw-build.patch
}

build() {
  cd "kissfft-${pkgver//./}"
  make
}

package() {
  mkdir -p ${pkgdir}${MINGW_PREFIX}/{bin,lib,include}

  cd "kissfft-${pkgver//./}"
  make DESTDIR=${pkgdir} PREFIX=${MINGW_PREFIX} install
}
