# Maintainer: Andreas Grapentin <andreas@grapentin.org>
# Maintainer (arch): Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Márcio Silva <coadde@hyperbola.info>
# Contributor: Christian Himpel <chressie at gmail dot com>
# Contributor: Johannes Hanika <hanatos at gmail dot com>
# Contributor: Freemor <freemor@freemor.ca>

pkgname=darktable
epoch=2
pkgver=2.6.3
pkgrel=1.nonprism1
pkgdesc="Utility to organize and develop raw images, without flickcurl support"
arch=(i686 x86_64 armv7h)
url="https://darktable.org"
license=(GPL3)
depends=(pugixml libjpeg-turbo colord-gtk libgphoto2 openexr lensfun iso-codes
         exiv2 openjpeg2 graphicsmagick lua osm-gps-map libsecret)
makedepends=(cmake intltool desktop-file-utils llvm clang python-jsonschema libwebp libxslt)
source=("https://github.com/darktable-org/darktable/releases/download/release-${pkgver}/darktable-${pkgver/rc/.rc}.tar.xz"{,.asc}
	fixCompileFlag.patch)
sha256sums=('a518999c8458472edfc04577026ce5047d74553052af0f52d10ba8ce601b78f0'
            'SKIP'
            '4529cf75dc0fd68f3aed9b3c917106eeac58adffa608b57b79256f66fd23959b')

validpgpkeys=(C4CBC150699956E2A3268EF5BB5CC8295B1779C9  # darktable releases <release@darktable.org>
              F10F9686652B0E949FCD94C318DCA123F949BD3B) # Pascal Obry <pascal@obry.net>

prepare() {
    cd "$srcdir/$pkgname-$pkgver"
    patch --strip=1 --input=../fixCompileFlag.patch
    cd "$srcdir"
    mkdir -p build
}

build() {
    cd build
    cmake ../${pkgname}-${pkgver/rc/~rc} \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_LIBDIR=/usr/lib \
        -DCMAKE_BUILD_TYPE=Release \
        -DBINARY_PACKAGE_BUILD=1 \
        -DBUILD_USERMANUAL=False \
        -DUSE_LIBSECRET=ON \
        -DUSE_LUA=ON \
        -DUSE_COLORD=ON \
        -DRAWSPEED_ENABLE_LTO=ON \
	-DUSE_USE_FLICKR=Off \
        -DPROJECT_VERSION=${pkgver}
    make
}

package() {
    cd build
    make DESTDIR="${pkgdir}" install
    ln -s darktable/libdarktable.so "${pkgdir}"/usr/lib/libdarktable.so
}
