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

pkgname=xreader
pkgver=3.0.2
pkgrel=1
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=('a2e32274787723e81afeb62390c92b64f0ad222e3ca6295704535e5c499fdd28')
b2sums=('3534f16b16ef73dfe58c62a5dc82bf13f7f68bea4a7646e65e612af6a6ff6250f3989c999f039d6d7044eeb30791554d660ee159e7f064e810f81d0e8f6a3f87')

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 \
          -Dtests=false \
          ..
    samu
}

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

    DESTDIR="${pkgdir}" samu install
}
