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

_realname=Net-SSLeay
pkgname=perl-${_realname}
pkgver=1.94
pkgrel=3
pkgdesc="Perl extension for using OpenSSL"
arch=('i686' 'x86_64')
license=('custom:BSD')
url="https://metacpan.org/dist/Net-SSLeay/"
msys2_references=(
  'purl: pkg:cpan/CHRISN/Net-SSLeay'
)
groups=('perl-modules')
makedepends=('openssl-devel' 'perl-devel' 'make' 'gcc')
depends=('openssl')
options=(!emptydirs)
replaces=('net-ssleay')
provides=('net-ssleay')
source=("https://cpan.metacpan.org/authors/id/C/CH/CHRISN/${_realname}-${pkgver}.tar.gz")
sha256sums=('9d7be8a56d1bedda05c425306cc504ba134307e0c09bda4a788c98744ebcd95d')

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

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

  export OPTIMIZE="$CFLAGS"
  export OPENSSL_PREFIX=/usr

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

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

  make install DESTDIR=${pkgdir}
  install -D -m644 README "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
