# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=deepin-image-viewer
pkgver=5.9.19
pkgrel=1
pkgdesc='An image viewing tool with fashion interface and smooth performance'
arch=('x86_64')
url="https://github.com/linuxdeepin/deepin-image-viewer"
license=('GPL3')
depends=('deepin-qt5integration' 'qt5-base' 'dtkcore' 'dtkgui' 'dtkwidget' 'deepin-image-editor'
         'gcc-libs' 'libraw' 'dtkdeclarative')
makedepends=('git' 'cmake' 'ninja' 'qt5-tools')
optdepends=('deepin-manual: for help manual'
            'deepin-shortcut-viewer: for shortcut display')
groups=('deepin')
source=("git+https://github.com/linuxdeepin/deepin-image-viewer.git#tag=$pkgver")
sha512sums=('913a0a723d09fd248ac306625c9ae14ddb1a3cfc2c1906a41276512a84e15f4c1dd6a90aff7e515b3965c81ff380ef6ff5092016382c692fdccbd76dd7ea81e7')

prepare() {
  cd deepin-image-viewer
  sed -i -e 's|qt5/plugins|qt/plugins|' -e 's|${Qt5Core_DIR}|/usr/lib/cmake/Qt5Core|' qimage-plugins/libraw/CMakeLists.txt
  git cherry-pick -n b0a7efaf1afb752bd2cbe96250db1e97e4f4da6f
}

build() {
  cd deepin-image-viewer
  cmake . -GNinja -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_POLICY_VERSION_MINIMUM=3.5
  ninja
}

package() {
  cd deepin-image-viewer
  DESTDIR="$pkgdir" ninja install
}
