# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>
_pkgname=arch-wiki-lite
pkgname=parabola-wiki-lite
pkgver=20160606
_codever=20160430
pkgrel=2
pkgdesc="The wiki without html.  1/9 as big, easily searched and viewable on console."
arch=('any')
url="http://kmkeen.com/arch-wiki-lite/"
_watch="https://www.parabola.onu/packages/libre/any/parabola-wiki-docs/"
license=('GPL' 'FDL')
depends=('bash' 'gzip')
makedepends=('python' 'parabola-wiki-docs')
optdepends=('dialog: for interactive menu'
            'parabola-wiki-docs: for wiki-search-html'
            'xdg-utils: for wiki-search-html')
replaces=('arch-wiki-lite')
conflicts=('arch-wiki-lite')
mksource=("http://kmkeen.com/$_pkgname/$_pkgname-$_codever.tar.gz"
          'libre.patch')
source=("https://repo.parabola.nu/other/$pkgname/$pkgname-$pkgver.tar.gz")
mkmd5sums=('827909e927c20303395d74c65e34f04e'
           '1f039df2eae54ac2c5d56bb3d31c4ed9')
md5sums=('d846ef6e76cf2f0b15ab539d00fed60b')

mksource() {
  cd "$srcdir/$_pkgname"
  patch -p1 -i "$srcdir/libre.patch"
  mv "$srcdir/$_pkgname" "$srcdir/$pkgname"
}

build() {
  cd "$srcdir/$pkgname"
  LC_ALL=en_US.UTF-8 python3 wiki_lite.py
}

package() {
  cd "$srcdir/$pkgname"
  install -d "$pkgdir/usr/share/doc/parabola-wiki/text/"
  install -m 0644 wiki/* "$pkgdir/usr/share/doc/parabola-wiki/text/"
  install -Dm 0755 wiki-search      "$pkgdir/usr/bin/wiki-search"
  install -Dm 0755 wiki-search-html "$pkgdir/usr/bin/wiki-search-html"
  install -Dm 0644 wiki-search.dialog.rc "$pkgdir/etc/dialog.d/wiki-search.dialog.rc"
}
