# Contributor: A. Wilcox <awilfox@adelielinux.org>
# Maintainer: A. Wilcox <awilfox@adelielinux.org>
pkgname=nim
pkgver=0.20.0
pkgrel=0
pkgdesc="Statically typed, compiled systems programming language"
url="https://nim-lang.org/"
arch="all"
license=" "
depends=""
checkdepends="gc node"
makedepends="openssl-dev pcre-dev"
subpackages="$pkgname-doc"
source="https://nim-lang.org/download/nim-$pkgver.tar.xz"

build() {
	sh build.sh
	bin/nim --parallelBuild:${JOBS} c koch
	./koch boot --parallelBuild:${JOBS} -d:release
	PATH="./bin:$PATH" ./koch --stable tools
}

check() {
	PATH="./bin:$PATH" ./koch test
}

package() {
	PATH="./bin:$PATH" ./koch install "$pkgdir"
	mkdir -p "$pkgdir"/usr/share/doc
	mv "$pkgdir"/usr/share/nim/doc "$pkgdir"/usr/share/doc/nim

	for _exec in bin/*; do
		install -m755 _exec "$pkgdir"/usr/bin/
	done
}

sha512sums="e41fc9f9337535d07ebdd14ae8195bf9c666a0a242516f24d50241e69d50e89fcb9ac1a0b1fbeee0bc75b0218aeb18698ff2ac87447005dad52dc18da80bb02d  nim-0.20.0.tar.xz"