# Contributor: Curt Tilmes <Curt.Tilmes@nasa.gov>
# Maintainer: Curt Tilmes <Curt.Tilmes@nasa.gov>
pkgname=moarvm
pkgver=2024.07
pkgrel=0
pkgdesc="VM with adaptive optimization and JIT compilation, built for Rakudo"
url="https://moarvm.org/"
arch="all"
license="Artistic-2.0"
depends_dev="$pkgname=$pkgver-r$pkgrel perl zstd-dev libffi-dev libuv-dev"
makedepends="$depends_dev"
subpackages="$pkgname-dev $pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/MoarVM/MoarVM/releases/download/$pkgver/MoarVM-$pkgver.tar.gz"
builddir="$srcdir/MoarVM-$pkgver"
options="!check" # No tests

build() {
	unset CPPFLAGS CFLAGS
	perl Configure.pl --prefix=/usr --has-libffi \
		--has-libuv --no-mimalloc --debug
	make -j"$JOBS"
}

package() {
	make PKGCONFIGDIR=/usr/lib/pkgconfig \
		DESTDIR="$pkgdir" install

	install -Dvm644 Artistic2.txt CREDITS LICENSE \
		MANIFEST README.markdown VERSION \
		-t "$pkgdir"/usr/share/doc/"$pkgname"
	cp -vr docs "$pkgdir"/usr/share/doc/"$pkgname"/
}

dev() {
	default_dev
	amove usr/share/nqp/lib
}

sha512sums="
9f2e65d199d4e9237ffebb110a51c58c8284e4006dc88cba872856998509aac5894689568ad449cd7098e21e8311b1ae428cf03d8ce192318429c1f0923e413d  moarvm-2024.07.tar.gz
"
