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

_perlname=Digest-SHA
_realname="${_perlname,,}"
pkgbase=mingw-w64-perl-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-perl-${_realname}")
pkgver=6.04
pkgrel=2
pkgdesc="Perl extension for SHA-1/224/256/384/512 (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url="https://metacpan.org/dist/Digest-SHA"
msys2_references=(
  'purl: pkg:cpan/MSHELOR/Digest-SHA'
)
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}-cc"
             "${MINGW_PACKAGE_PREFIX}-python"
             "${MINGW_PACKAGE_PREFIX}-make")
options=('!emptydirs')
source=("https://cpan.metacpan.org/authors/id/M/MS/MSHELOR/${_perlname}-${pkgver}.tar.gz"
        "patchmakefile.py")
sha256sums=('ee91f8f7db894ee7c6ee003daac10a99056c4948a674ef46acdbb63c81a4abeb'
            '9b3a852cfb38c05aaea3a6dff4625b038c1d889ed99bb292d8b73e4fb83ff676')

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

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