# Maintainer: Iru Cai <mytbk920423@gmail.com>
# Contributor: Alexander Hunziker <alex.hunziker@gmail.com>
# Contributor: Alessio Biancalana <dottorblaster@gmail.com>
# Contributor: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>

pkgname=gegl-git
_pkgname=gegl
pkgver=0.4.70.204
pkgrel=2
pkgdesc="Graph based image processing framework"
arch=('i686' 'x86_64')
url="http://www.gegl.org"
license=('GPL3' 'LGPL3')
depends=('babl-git' 'libspiro' 'json-glib' 'sdl2') #'mrg'
makedepends=('git' 'meson' 'intltool' 'python' 'ruby' 'luajit'
             'libraw' 'openexr' 'ffmpeg4.4' 'librsvg' 'jasper'
             'libtiff' 'libnsgif' 'exiv2' 'libgexiv2' 'lensfun'
             'vala' 'python-gobject'
             'suitesparse' 'gobject-introspection')
optdepends=('openexr: for using the openexr plugin'
            'ffmpeg4.4: for using the ffmpeg plugin'
            'librsvg: for using the svg plugin'
            'libtiff: tiff plugin'
            'jasper: for using the jasper plugin'
            'libraw: raw plugin'
            'suitesparse: matting-levin plugin'
            'luajit: lua plugin'
            'libgexiv2: for image metadata'
            'lensfun: for lens distortion'
            'libnsgif: gif plugin')
provides=("gegl=${pkgver}")
conflicts=('gegl')
options=(!libtool)
source=(git+https://gitlab.gnome.org/GNOME/gegl.git)
md5sums=('SKIP')

pkgver() {
  cd $_pkgname
  git describe --always | sed -e 's/GEGL_//' -e 's/-g.*$//' -e 's/[_-]/./g'
}

prepare() {
    mkdir "${srcdir}/build" -p

    export PKG_CONFIG_PATH='/usr/lib/ffmpeg4.4/pkgconfig'
    export CFLAGS CXXFLAGS LDFLAGS
    meson "${srcdir}/${_pkgname}"\
          "${srcdir}/build" \
        --prefix=/usr \
        -Dworkshop=true
}

build() {
    export NINJA_STATUS="[%p | %f<%r<%u | %cbps ] "
    ninja -C "${srcdir}/build"
}

package() {
    DESTDIR="${pkgdir}" ninja -C "${srcdir}/build" install
}
