# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=uncrustify
pkgver=0.79.0
pkgrel=0
pkgdesc="Source code beautifier"
url="https://github.com/uncrustify/uncrustify"
arch="all"
license="GPL-2.0-or-later"
makedepends="cmake python3 samurai"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/uncrustify/uncrustify/archive/uncrustify-$pkgver.tar.gz"
builddir="$srcdir/uncrustify-uncrustify-$pkgver"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_INSTALL_PREFIX=/usr
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build

	install -Dm644 etc/*.cfg -t "$pkgdir"/usr/share/$pkgname
}

sha512sums="
7972061058cbf232a0fa44fc165b73b0b4f1b75baca4e460b4d64a704779804d7cfd14fbcbd9bc1828273284feb83196a8e4ccc7c923e875ce3fa7b843151e5f  uncrustify-0.79.0.tar.gz
"
