# Automatically generated by apkbuild-cpan, template 4
# Contributor: Celeste <cielesti@protonmail.com>
# Maintainer: Celeste <cielesti@protonmail.com>
pkgname=perl-http-tinyish
pkgver=0.19
pkgrel=0
#_pkgreal is used by apkbuild-cpan to find modules at MetaCpan
_pkgreal=HTTP-Tinyish
pkgdesc="HTTP::Tiny compatible HTTP client wrappers"
url="https://metacpan.org/release/HTTP-Tinyish/"
arch="noarch"
license="GPL-1.0-or-later OR Artistic-1.0-Perl"
depends="perl perl-file-which perl-ipc-run3"
subpackages="
	$pkgname-doc
	$pkgname-curl
	$pkgname-lwp
	$pkgname-wget
	"
source="https://cpan.metacpan.org/authors/id/M/MI/MIYAGAWA/HTTP-Tinyish-$pkgver.tar.gz"
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}')
	make test
}

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

curl() {
	pkgdesc="$pkgdesc (Curl backend)"
	depends="$pkgname=$pkgver-r$pkgrel curl"
	install_if="$pkgname=$pkgver-r$pkgrel curl"

	amove usr/share/perl5/vendor_perl/HTTP/Tinyish/Curl.pm
}

lwp() {
	pkgdesc="$pkgdesc (LWP backend)"
	depends="$pkgname=$pkgver-r$pkgrel perl-lwp-protocol-https"
	install_if="$pkgname=$pkgver-r$pkgrel perl-libwww"

	amove usr/share/perl5/vendor_perl/HTTP/Tinyish/LWP.pm
}

wget() {
	pkgdesc="$pkgdesc (GNU Wget backend)"
	depends="$pkgname=$pkgver-r$pkgrel wget"
	install_if="$pkgname=$pkgver-r$pkgrel wget"

	amove usr/share/perl5/vendor_perl/HTTP/Tinyish/Wget.pm
}

sha512sums="
cfc20e7b526c91a9baf8d049753762c35033c5e1bdf5b5239ba7695c2b0319e1e41bc669f617fc7e61ef8fcfaddbcdd299fad2c406d9cb166be304c401401010  HTTP-Tinyish-0.19.tar.gz
"
