# Maintainer: André Klitzing <aklitzing@gmail.com>
pkgname=uncrustify
pkgver=0.80.1
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="
b10f09498ca9ab139bd1a81996837af7a79bde5c0ba8ce3d5988decc1fda0d3c72eb48c0fe04ae57313bf4b86da7d4e4669088735abf7aa7624937afe9d48306  uncrustify-0.80.1.tar.gz
"
