# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Jelle van der Waa <jelle@archlinux.org>

pkgname=cjson
pkgver=1.7.18
pkgrel=1
pkgdesc="Ultralightweight JSON parser in ANSI C"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
license=("MIT")
depends=("glibc")
makedepends=("cmake")
url="https://github.com/DaveGamble/cJSON"
source=("$pkgname-$pkgver.tar.gz::https://github.com/DaveGamble/cJSON/archive/v$pkgver.tar.gz")
sha512sums=('2accb507c6b97222eb5f0232c015b356cf6d248d1247049928731aa8e897378245e62395c232b1ec57d28d1e53ac72c849be85e59c33616a382d40473649f66b')

build() {
  cmake -B build -S "cJSON-${pkgver}" -DENABLE_CJSON_UTILS=On -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_INSTALL_LIBDIR=lib
  make -C build
}

check() {
  make -C build check
}

package() {
  make -C build DESTDIR="${pkgdir}" install
  install -Dm644 "$srcdir/cJSON-$pkgver/LICENSE" \
    "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}
