# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=gperf
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=3.1
pkgrel=1
pkgdesc="Perfect hash function generator (mingw-w64)"
arch=('any')
mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32')
url="https://www.gnu.org/software/gperf/"
license=('GPL3')
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs")
source=("https://ftp.gnu.org/pub/gnu/gperf/${_realname}-${pkgver}.tar.gz"{,.sig})
sha256sums=('588546b945bba4b70b6a3a616e80b4ab466e3f33024a352fc2198112cdbb3ae2'
            'SKIP')
options=('strip')
validpgpkeys=('93C08C88471097CD'
'EDEB87A500CC0A211677FBFD93C08C88471097CD')

build() {
  mkdir ${srcdir}/build-${MINGW_CHOST}
  cd "${srcdir}"/build-${MINGW_CHOST}
  ../${_realname}-${pkgver}/configure \
    --build=${MINGW_CHOST} \
    --host=${MINGW_CHOST} \
    --target=${MINGW_CHOST} \
    --prefix=${MINGW_PREFIX}
  make
}

check() {
  cd "${srcdir}"/build-${MINGW_CHOST}
  make check
}

package() {
  cd "${srcdir}"/build-${MINGW_CHOST}
  make DESTDIR="${pkgdir}" install
  rm -rf ${pkgdir}${MINGW_PREFIX}/share
}
