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

_realname=ExtUtils-Config
pkgname=perl-${_realname}
pkgver=0.008
pkgrel=1
pkgdesc="ExtUtils::Config - A wrapper for perl's configuration"
arch=('any')
url="https://metacpan.org/${_realname}/"
groups=('perl-modules')
license=('PerlArtistic' 'GPL')
depends=('perl')
options=('!emptydirs')
source=("https://www.cpan.org/authors/id/L/LE/LEONT/${_realname}-${pkgver}.tar.gz")
sha256sums=('ae5104f634650dce8a79b7ed13fb59d67a39c213a6776cfdaa3ee749e62f1a8c')

build() {
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""                 \
      PERL_AUTOINSTALL=--skipdeps                            \
      PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'"     \
      PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
      MODULEBUILDRC=/dev/null

    cd "${srcdir}/${_realname}-${pkgver}"
    /usr/bin/perl Makefile.PL
    make
  )
}

check() {
  cd "${srcdir}/${_realname}-${pkgver}"
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""
    make test
  )
}

package() {
  cd ${_realname}-${pkgver}
  make DESTDIR="${pkgdir}" install
  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}
