# Packager = Developer <dev@tuxcore.org> 
pkgname=yyjson
pkgver=%version%
pkgrel=%release%
pkgdesc="A high performance JSON library written in ANSI C"
arch=('x86_64')
url="https://ibireme.github.io/yyjson"
license=('MIT')
depends=('glibc')
makedepends=('cmake')
provides=('libyyjson.so')
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/ibireme/yyjson/archive/refs/tags/${pkgver}.tar.gz")
sha256sums=('59902bea55585d870fd7681eabe6091fbfd1a8776d1950f859d2dbbd510c74bd')

build() {
	cmake -B build -S "${pkgname}-${pkgver}" \
	  -DCMAKE_BUILD_TYPE='None' \
	  -DCMAKE_INSTALL_PREFIX='/usr' \
	  -DBUILD_SHARED_LIBS='ON' \
	  -DYYJSON_BUILD_TESTS='ON' \
	  -Wno-dev
	cmake --build build
}

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

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

	cd "${pkgname}-${pkgver}"
	install -Dm 644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
	install -Dm 644 README.md "${pkgdir}/usr/share/doc/${pkgname}/README.md"
	install -Dm 644 doc/*.md -t "${pkgdir}/usr/share/doc/${pkgname}/"
}
