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

_realname=Alien-Libxml2
pkgname=perl-${_realname}
pkgver=0.20
pkgrel=1
pkgdesc="Install the C libxml2 library on your system"
arch=('any')
license=('PerlArtistic')
url="https://metacpan.org/dist/Alien-Libxml2"
msys2_references=(
  'purl: pkg:cpan/PLICEASE/Alien-Libxml2'
)
groups=('perl-modules')
depends=('libxml2' 'perl-Alien-Build>=2.37')
makedepends=('perl-HTML-Parser' 'perl-Sort-Versions' 'perl-Test2-Suite' 'perl-URI' 'libxml2-devel'
             'perl-alien-build-plugin-download-gitlab' 'pkgconf')
options=(!emptydirs)
source=("https://cpan.metacpan.org/authors/id/P/PL/PLICEASE/${_realname}-${pkgver}.tar.gz")
sha256sums=('56aae7b339bbeb02f77c5801f57a821be5791b51f43bf7f9062bb3bfa444c328')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}
}

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

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

check() {
  cd ${_realname}-${pkgver}
  make test
}

package() {
  cd ${srcdir}/${_realname}-${pkgver}

  make install DESTDIR=${pkgdir}
  # Remove .packlist and perllocal.pod files.
  find "$pkgdir" -name '.packlist' -delete
  find "$pkgdir" -name 'perllocal.pod' -delete
}
