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

pkgbase=libpillowfight
pkgname=(libpillowfight python-pillowfight)
pkgver=0.2.4
pkgrel=1
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 python-setuptools)
_commit=3a7ebba75f4c060ac1707900bd8891e8d200b1c6  # tags/0.2.4^0
source=("git+https://gitlab.gnome.org/World/OpenPaperwork/libpillowfight.git#commit=$_commit")
sha256sums=('SKIP')

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

prepare() {
  [[ -d build ]] || mkdir build
}


build() {
  cd $pkgbase
  make build_py

  cd ../build
  cmake -G "Unix Makefiles" ../$pkgbase/ \
    -DCMAKE_INSTALL_PREFIX=/usr
  make

}

package_libpillowfight() {
  depends=(glibc)

  cd build
  make DESTDIR="$pkgdir" install
}

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

  cd $pkgbase
  python3 setup.py install --root="$pkgdir" --optimize=1
}
