# Automatically generated by apkbuild-cpan, template 4
# Contributor: Valery Kartel <valery.kartel@gmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=perl-mail-sendmail
pkgver=0.80
pkgrel=6
#_pkgreal is used by apkbuild-cpan to find modules at MetaCpan
_pkgreal=Mail-Sendmail
pkgdesc="Simple platform independent mailer"
url="https://metacpan.org/release/Mail-Sendmail/"
arch="noarch"
license="GPL-1.0-or-later OR Artistic-1.0-Perl"
depends="perl"
checkdepends="python3 python3-tests"
subpackages="$pkgname-doc"
source="https://cpan.metacpan.org/authors/id/N/NE/NEILB/Mail-Sendmail-$pkgver.tar.gz
	test-localhost.patch
	fake-smtp.py
	"
builddir="$srcdir/$_pkgreal-$pkgver"

build() {
	export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')
	PERL_MM_USE_DEFAULT=1 perl -I. Makefile.PL \
		INSTALLDIRS=vendor \
		NO_PACKLIST=1 \
		NO_PERLLOCAL=1
	make
}

check() {
	export CFLAGS=$(perl -MConfig -E 'say $Config{ccflags}')

	# run dummy smtp server
	python3 "$srcdir"/fake-smtp.py &
	local pid=$!
	local rc=0
	if ! make test; then
		rc=1
	fi
	kill $pid
	return $rc
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
848ec471938d679645dfb4e032a33d35e49655a336dc6ff3a24ffa35606bff77e73162af672d1a60ad3a7bf571113e802fc42d6cb9a072cdca0d89f707f54a08  Mail-Sendmail-0.80.tar.gz
2592c4aafd9f58d9e4f8c0f78e8d87e7e6160b4a53aa73b929ad12d26d677f8a7baec540a57a8edabbba6f05bd33c9e2dc5ee707cfaaccd14837a6ddc681d742  test-localhost.patch
22dbe3e35c9112fd61024b1636c30c3a2a9803f63ba0017a43ec13cfdaa3e80c99ee6b3b154fac64d8e2e170655e4235e369c3189c8938362cbb6ed1687fe033  fake-smtp.py
"
