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

pkgname=calibre-web
pkgver=0.6.21
pkgrel=0
pkgdesc="Web app for browsing, reading and downloading eBooks stored in a Calibre database"
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="
d2f07eec0b6c9f65e68ae0b72fddd14444eb8be8b0fee997ec7caaa1feebb8a26603844752347547becde501669af5bce69e9eab466a28fd4b10624b65c9afcf  calibre-web-0.6.21.tar.gz
4aba825eb12f44eb0912cc6981b46bec9b77ad114627564c9c7585862a099c7d1ff8deec5f15d047319805e2b9a3e2d128b2d1292dd92293a7e72359009a480f  calibre-web.conf
62859a8a304216dc0dbfb7f2e8144a50d348c6621f5b292c08aa97a872ada67b52d36b567546fd0f4c439dbefe0bbe0e4fb1e1affbe507278b4a8d36ed3fa2a9  calibre-web.initd
"
