# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=cloc
pkgver=2.02
pkgrel=0
pkgdesc="Count lines of code"
url="https://github.com/AlDanial/cloc"
arch="noarch"
license="GPL-2.0-or-later Artistic-2.0"
makedepends="git"
checkdepends="gzip"
depends="perl perl-algorithm-diff perl-regexp-common
	perl-parallel-forkmanager"
subpackages="$pkgname-doc"
source="https://github.com/AlDanial/cloc/releases/download/v$pkgver/cloc-$pkgver.tar.gz
	skip-submodule-tests.patch
	"
builddir="$srcdir/$pkgname-$pkgver/Unix"

prepare() {
	default_prepare

	# Some tests expect the tests/ directory to be a Git repository.
	# We do some basic Git configuration here to make them pass.
	git init -q ..
	git config --local user.name "example"
	git config --local user.email "example@example.com"
	git add ../tests
	git commit -m "tests"
}

build() {
	make
}

check() {
	make test
}

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

	install -Dm644 NEWS README AUTHORS \
		-t "$pkgdir"/usr/share/doc/$pkgname/
}

sha512sums="
c7b039f5cb05cb8e5b01c2339789730d208d21ef3908e79ac9eeade8e9b466adbbee8c5a2ea5e7c93071b9b624c48fbe4002748e8e3625cfbe9657221b2e7add  cloc-2.02.tar.gz
0e9f976279721f7e40ad834c2fe70adf50f34f155915626ceb95dc43426a437eb4239b71e2318d0b3da98b36d69280d2d673e0884c4e3ca915f2f4e98f98f151  skip-submodule-tests.patch
"
