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

_perlname=Win32-WinError
_realname="${_perlname,,}"
pkgbase=mingw-w64-perl-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-perl-${_realname}")
pkgver=0.04
pkgrel=6
pkgdesc="Perl module defining Windows error constants (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://metacpan.org/dist/Win32-WinError"
msys2_references=(
  'purl: pkg:cpan/JDB/Win32-WinError'
)
license=('spdx:Artistic-1.0-Perl OR GPL-1.0-or-later')
groups=("${MINGW_PACKAGE_PREFIX}-perl-modules")
depends=("${MINGW_PACKAGE_PREFIX}-perl")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
             "${MINGW_PACKAGE_PREFIX}-python"
             "${MINGW_PACKAGE_PREFIX}-make")
options=('!emptydirs')
source=("https://cpan.metacpan.org/authors/id/J/JD/JDB/${_perlname}-${pkgver}.tar.gz"
        "patchmakefile.py")
sha256sums=('69e71b28b6e67e9ccd10f1514e5bfa00c79ae9c74e2b7cf7abc83b3d5528d696'
            '9b3a852cfb38c05aaea3a6dff4625b038c1d889ed99bb292d8b73e4fb83ff676')

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
}
