# Maintainer: @naveen521kk on Github, Naveen M K <naveen521kk@gmail.com>

_perlname=File-Which
_realname="${_perlname,,}"
pkgbase=mingw-w64-perl-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-perl-${_realname}")
pkgver=1.27
pkgrel=2
pkgdesc="Perl implementation of the which utility as an API (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://metacpan.org/dist/${_perlname}"
msys2_references=(
  'purl: pkg:cpan/PLICEASE/File-Which'
)
license=('perl_5')
groups=("${MINGW_PACKAGE_PREFIX}-perl-modules")
depends=(
  "${MINGW_PACKAGE_PREFIX}-perl"
)
makedepends=(
  "${MINGW_PACKAGE_PREFIX}-make"
  "${MINGW_PACKAGE_PREFIX}-python"
)
options=('!emptydirs')
source=(
  "https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/${_perlname}-${pkgver}.tar.gz"
  "patchmakefile.py"
)
sha512sums=('8a6164c4af915e93924b1d62864e492b1c5067856e505c50b9a5cce0600d73bdcda5f7e35a9f37134d9e89949b45bbd0a5426cb56121604aea1a3cfe48d55e5c'
            'd7ec5ba4a3d75f674f4028e8a53bc4177ab71a379bc63affebf910e1d5a0e491b6642318218b55ddc4d90e0125d61e4b97626782af57d44522bcb5543fb21cb2')

build() {
  cd "$srcdir/${_perlname}-${pkgver}"
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL
  export pkgdir=$pkgdir
  python $srcdir/patchmakefile.py
  mingw32-make
}

package() {
  cd "$srcdir/${_perlname}-${pkgver}"
  mingw32-make DESTDIR="${pkgdir}/" install
}
