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

_realname=Crypt-SSLeay
pkgname=perl-${_realname}
pkgver=0.73_06
pkgrel=6
pkgdesc="OpenSSL glue that provides LWP https support"
arch=('i686' 'x86_64')
url="https://metacpan.org/release/Crypt-SSLeay"
groups=('perl-modules')
license=('GPL' 'PerlArtistic')
makedepends=('openssl-devel' 'perl-devel')
depends=('perl-LWP-Protocol-https' 'perl-Try-Tiny' 'perl-Path-Class')
options=('!emptydirs')
source=(https://www.cpan.org/CPAN/authors/id/N/NA/NANIS/Crypt-SSLeay-${pkgver}.tar.gz
        find-tiny.patch)
sha256sums=('f8ecca45c87eb91325992b13f0594f808e6f1bc4c3b9a7f141b9a838384d252c'
            'a395f76c901510bf83d15354045ce7a04e49c169716f6be19ddc328228bf7d4f')

prepare() {
  cd "${srcdir}/Crypt-SSLeay-${pkgver}"
  patch -p1 -i ${srcdir}/find-tiny.patch
}

build() {
  cd "${srcdir}/Crypt-SSLeay-${pkgver}"
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL INSTALLDIRS=vendor
  make
}

check() {
  cd "${srcdir}/Crypt-SSLeay-${pkgver}"
  make test
}

package() {
  cd "${srcdir}/Crypt-SSLeay-${pkgver}"

  make install DESTDIR="${pkgdir}"

  find ${pkgdir} -name '.packlist' -delete
  find ${pkgdir} -name '*.pod' -delete
}
