# Contributor: Paul Spooren <mail@aparcar.org>
# Maintainer: Paul Spooren <mail@aparcar.org>
pkgname=ucode
pkgver=0.0.20220812
pkgrel=0
pkgdesc="Jinja-like micro templating"
url="https://github.com/jow-/ucode"
arch="all"
license="ISC"
source="https://github.com/jow-/ucode/archive/refs/tags/v$pkgver/ucode-v$pkgver.tar.gz"
makedepends="
	bash
	cmake
	coreutils
	diffutils
	json-c-dev
	samurai
	"
subpackages="$pkgname-dev"

build() {
	cmake -B build -G Ninja \
		-DCMAKE_INSTALL_LIBDIR=/usr/lib \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-D NL80211_SUPPORT=OFF \
 		-D RTNL_SUPPORT=OFF \
 		-D UBUS_SUPPORT=OFF \
 		-D UCI_SUPPORT=OFF \
 		-D ULOOP_SUPPORT=OFF
	cmake --build build
}

check() {
	export UCODE_BIN="$(pwd)/build/ucode"
	export UCODE_LIB="$(pwd)/build/"
	./tests/custom/run_tests.sh
}

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

sha512sums="
6434649a471050d45d7a42341b6f932762ebdf4bf37ab881bbb0ac2b3380f76e74f42e79e72568de9cde03008a0770edbffa2fdeb1dbb1dbfeabc6de82d60b8d  ucode-v0.0.20220812.tar.gz
"
