# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>

pkgname=calibre-web
pkgver=0.6.20
pkgrel=0
pkgdesc="Web app for browsing, reading and downloading eBooks stored in a Calibre database"
# blocked by py3-levenshtein
#arch='noarch'
url="https://github.com/janeczku/calibre-web"
license='GPL-3.0-only'
depends="
	py3-apscheduler
	py3-babel
	py3-backports-abc
	py3-blinker
	py3-chardet
	py3-flask-babel
	py3-flask-login
	py3-flask-limiter
	py3-flask-principal
	py3-flask-wtf
	py3-goodreads
	py3-levenshtein
	py3-iso639
	py3-lxml
	py3-pypdf2
	py3-requests
	py3-sqlalchemy
	py3-tornado
	py3-tz
	py3-unidecode
	py3-wand
	py3-werkzeug
	"
source="
	$pkgname-$pkgver.tar.gz::https://github.com/janeczku/calibre-web/archive/$pkgver.tar.gz
	calibre-web.conf
	calibre-web.initd
	"
options="!check" # No testsuite
subpackages="$pkgname-openrc"
pkgusers="calibre-web"
pkggroups="www-data"

prepare() {
	default_prepare
	sed -i 's|#!/usr/bin/env python|#!/usr/bin/env python3|' cps.py
}

package() {
	local wwwdir="/usr/share/webapps"

	install -d -m 755 "$pkgdir"/$wwwdir
	cp -a "$srcdir"/$pkgname-$pkgver "$pkgdir"/$wwwdir/$pkgname

	install -D -m 755 "$srcdir"/calibre-web.initd "$pkgdir"/etc/init.d/calibre-web
	install -D -m 644 "$srcdir"/calibre-web.conf "$pkgdir"/etc/conf.d/calibre-web
}
sha512sums="
19111905fd52421e2f62b29cb4e339ad6607d38f8d5f8b45f9a4e620132b1e487a0404aa0d2da89bfc61bb2ea5f020d38d3bf83d2be37c03d91ddd5bb841508f  calibre-web-0.6.20.tar.gz
4aba825eb12f44eb0912cc6981b46bec9b77ad114627564c9c7585862a099c7d1ff8deec5f15d047319805e2b9a3e2d128b2d1292dd92293a7e72359009a480f  calibre-web.conf
62859a8a304216dc0dbfb7f2e8144a50d348c6621f5b292c08aa97a872ada67b52d36b567546fd0f4c439dbefe0bbe0e4fb1e1affbe507278b4a8d36ed3fa2a9  calibre-web.initd
"