# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Auguste <auguste@gmail.com>
# Contributor: Jose Negron <josenj.arch@mailnull.com>

pkgname=libharu
pkgver=2.4.4
pkgrel=1
pkgdesc="C library for generating PDF documents"
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url="https://github.com/libharu/libharu"
license=(custom:ZLIB)
depends=('libpng' 'zlib')
makedepends=('cmake')
source=(${url}/archive/v${pkgver}/${pkgname}-${pkgver}.tar.gz)
sha512sums=('422210b09f89643cb25808559aeea109db5cce8a71c779d51f87222cdd50434f4f0f92322ebe429fca8f85ad73592bcabb14c3e36cd0bea19b6ec4c729220522')

build() {
  cmake -B build -S ${pkgname}-${pkgver} \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DLIBHPDF_STATIC=OFF
  make -C build
}

package() {
  make -C build DESTDIR="${pkgdir}" install
  install -Dm755 build/src/libhpdf.so "${pkgdir}"/usr/lib/libhpdf.so
  install -Dm644 ${pkgname}-${pkgver}/LICENSE "${pkgdir}"/usr/share/licenses/${pkgname}/LICENSE
}
