# Contributor: Dmitry Zakharchenko <dmitz@disroot.org>
# Maintainer: Antoni Aloy <aaloytorrens@gmail.com>
pkgname=pipe-viewer
pkgver=0.5.1
pkgrel=0
pkgdesc="Lightweight YouTube client that does not require an YouTube API key"
url="https://github.com/trizen/pipe-viewer"
arch="noarch"
license="Artistic-2.0"
makedepends="perl-module-build"
depends="
	perl-data-dump
	perl-json
	perl-libwww
	perl-lwp-protocol-https
	perl-term-readline-gnu
	perl-unicode-linebreak
	"
checkdepends="perl-test-pod"
subpackages="$pkgname-doc $pkgname-gtk"
source="$pkgname-$pkgver.tar.gz::https://github.com/trizen/pipe-viewer/archive/$pkgver.tar.gz"

build() {
	perl Build.PL --gtk3 \
		--installdirs=vendor \
		--create_packlist=0
	./Build
}

check() {
	./Build test
}

package() {
	./Build install --destdir="$pkgdir"
}

gtk() {
	depends="$pkgname perl-gtk3 perl-file-sharedir"
	pkgdesc="$pkgdesc (GTK interface)"

	amove usr/bin/gtk-pipe-viewer
	amove "usr/share/perl5/vendor_perl/auto/share/dist/WWW-PipeViewer/gtk-*"
	amove usr/share/perl5/vendor_perl/auto/share/dist/WWW-PipeViewer/icons
}

sha512sums="
e8b86fde9be4dc18d76f437daf07018dd21f94a36e08fbd973dc15afdc20db32fd47d22ac1b60453f31cb62cfb09106b5d08f9bb3922c9beecce795ec583fa72  pipe-viewer-0.5.1.tar.gz
"
