# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgbase=libpillowfight
pkgname=(libpillowfight python-pillowfight)
pkgver=0.3.0
pkgrel=4
pkgdesc='Small library containing various image processing algorithms'
arch=('x86_64')
url='https://gitlab.gnome.org/World/OpenPaperwork/libpillowfight'
license=('GPL2')
depends=('glibc' 'python-pillow')
makedepends=('cmake' 'git' 'ninja' 'python-nose' 'python-setuptools')
_commit=dae21f97de872e4ad2e94f1b0fc53302a00259fd  # tags/0.3.0^0
source=("git+https://gitlab.gnome.org/World/OpenPaperwork/libpillowfight.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd $pkgbase
  git describe --tags | sed 's/-/+/g'
}

build() {
  make -C $pkgbase src/pillowfight/_version.h
  cmake -S $pkgbase -B build -G Ninja -DCMAKE_INSTALL_PREFIX='/usr'
  cmake --build build

  cd $pkgbase
  python setup.py build
}

package_libpillowfight() {
  depends=(glibc)

  DESTDIR="$pkgdir" cmake --install build
}

package_python-pillowfight() {
  depends=(python-pillow)

  cd $pkgbase
  python setup.py install --root="$pkgdir" --optimize=1 --skip-build
}
