# Maintainer: Eli Schwartz <eschwartz@archlinux.org>
# Contributor: Nate Simon <aurpkg (at natesimon.net)>

pkgname=xreader
pkgver=2.2.3
pkgrel=2
pkgdesc="Document viewer for files like PDF and Postscript. X-Apps Project."
arch=('x86_64')
url="https://github.com/linuxmint/${pkgname}"
license=('GPL')
groups=('x-apps')
depends=('poppler-glib' 'webkit2gtk' 'xapps')
optdepends=('djvulibre: support for djvu files'
            'libgxps: support for xps files'
            'libspectre: support for dvi and ps files'
            'mathjax2: support for math in epub files'
            'texlive-bin: support for dvi files')
makedepends=('meson' 'samurai' 'intltool' 'itstool' 'gobject-introspection' 'djvulibre'
             'libgxps' 'libspectre' 'texlive-bin')
source=("${pkgname}-${pkgver}.tar.gz::${url}/archive/${pkgver}.tar.gz")
sha256sums=('b71d64456899f7e4946b67e4fd1065529e5b246f23b0e843b78dcd2bef06189b')
b2sums=('462916ec5cef14c451d31a106bbed0dfcbf370f3567159222984af303c56e42d5f2ec7f83ee8de826d810c60b479f2f3b02d254725e4b5738b33ff00803370c9')

build() {
    mkdir -p "${srcdir}"/${pkgname}-${pkgver}/build
    cd "${srcdir}"/${pkgname}-${pkgver}/build

    meson --prefix=/usr \
          --libexecdir=lib/${pkgname} \
          --buildtype=plain \
          -Dmathjax-directory=/usr/share/mathjax2 \
          -Dcomics=true \
          -Ddjvu=true \
          -Ddvi=true \
          -Dt1lib=true \
          -Dpixbuf=true \
          -Dintrospection=true \
          -Dhelp_files=true \
          ..
    samu
}

package(){
    cd "${srcdir}"/${pkgname}-${pkgver}/build

    DESTDIR="${pkgdir}" samu install
}
