# Contributor: Curt Tilmes <Curt.Tilmes@nasa.gov>
# Maintainer: Curt Tilmes <Curt.Tilmes@nasa.gov>
pkgname=zef
pkgver=0.2.3
pkgrel=0
pkgdesc="Perl6 Module Management"
url="https://github.com/ugexe/zef"
arch="all"
options="!archcheck" # Precompiled arch dependent files included (quiet noarch warning)
license="Artistic-2.0"
depends="rakudo git wget curl tar unzip perl perl-utils"
makedepends="rakudo-dev"
install=""
subpackages="${pkgname}-doc"
source="${pkgname}-${pkgver}.tar.gz::https://github.com/ugexe/zef/archive/v${pkgver}.tar.gz"
builddir="$srcdir"/"$pkgname"-"$pkgver"

check() {
	cd "$builddir"
	prove -e 'perl6 -Ilib'
}

package() {
	cd "$builddir"
	RAKUDO_RERESOLVE_DEPENDENCIES=0 /usr/share/perl6/bin/install-dist.pl \
		--to="$pkgdir/usr/share/perl6/vendor" --for=vendor
	rm "$pkgdir"/usr/share/perl6/vendor/bin/zef-j \
		"$pkgdir"/usr/share/perl6/vendor/bin/zef-m
	mkdir -p "$pkgdir"/usr/bin
	ln -s /usr/share/perl6/vendor/bin/zef "$pkgdir"/usr/bin/zef
}

doc() {
	cd "$builddir"
	mkdir -p "$subpkgdir"/usr/share/doc/"$pkgname"
	for file in LICENSE META6.json README.pod; do
		cp $file "$subpkgdir"/usr/share/doc/"$pkgname"
	done
}

sha512sums="12bb66257743c95065dd0b394fb5feed966aee83b5019cdb0694da97732c5720bd5c8cb14e9e51cc00958fb5d42c5845a8c4ab5766886148693b12db24b89d14  zef-0.2.3.tar.gz"
