# POWER Maintainer: Alexander Baldeck <alex.bldck@gmail.com>
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Christoph Drexler <chrdr at gmx dot at>

pkgname=leptonica
pkgver=1.84.1
pkgrel=2
pkgdesc='Software that is broadly useful for image processing and image analysis applications'
arch=(x86_64 powerpc64le powerpc64 powerpc riscv64)
url='http://www.leptonica.com'
_url="https://github.com/DanBloomberg/$pkgname"
license=(custom)
depends=(giflib libgif.so
         libjpeg-turbo libjpeg.so
         libpng libpng16.so
         libtiff libtiff.so
         libtiff libtiff.so
         libwebp libwebp.so libwebpmux.so libsharpyuv.so
         openjpeg2 # libopenjp2.so
         zlib libz.so)
_archive="$pkgname-$pkgver"
source=("$_url/archive/$pkgver/$_archive.tar.gz")
sha256sums=('ecd7a868403b3963c4e33623595d77f2c87667e2cfdd9b370f87729192061bef')

prepare() {
  cd "$_archive"
  ./autogen.sh
}

build() {
  cd "$_archive"
  ./configure --prefix=/usr
  make
}

package() {
  cd "$_archive"
  make DESTDIR="$pkgdir" install
  install -Dm0644 -t "$pkgdir/usr/share/licenses/leptonica/" leptonica-license.txt
}
