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

_realname=Locale-Gettext
pkgname=perl-${_realname}
pkgver=1.07
pkgrel=12
groups=('perl-modules')
pkgdesc="Permits access from Perl to the gettext() family of functions"
arch=('i686' 'x86_64')
license=('GPL' 'PerlArtistic')
url="https://search.cpan.org/dist/Locale-gettext/"
msys2_references=(
  'purl: pkg:cpan/PVANDRY/Locale-Gettext'
)
depends=('gettext' 'perl')
makedepends=('perl-devel' 'make' 'gcc' 'gettext-devel')
options=(!emptydirs)
source=(${_realname}-${pkgver}.tar.gz::"https://cpan.metacpan.org/authors/id/P/PV/PVANDRY/gettext-${pkgver}.tar.gz")
sha256sums=('909d47954697e7c04218f972915b787bd1244d75e3bd01620bc167d5bbc49c15')

build() {
  cd "${srcdir}/${_realname}-${pkgver}"

  # install module in vendor directories.
  perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"

  make test
}

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

  # fix permissons
  find ${pkgdir}/usr -type f \( -name *.dll -o -name *.exe \) | xargs chmod 0755

  # remove perllocal.pod and .packlist
  find "${pkgdir}" -name perllocal.pod -delete
  find "${pkgdir}" -name .packlist -delete
}
