# Template file for 'deluge'
pkgname=deluge
version=2.1.1
revision=3
build_style=python3-module
# TODO package python3-slimit to minify javascript
hostmakedepends="intltool python3-setuptools python3-wheel"
depends="python3-setuptools python3-chardet python3-Twisted python3-Mako
 python3-xdg python3-rencode python3-setproctitle libtorrent-rasterbar-python3
 python3-Pillow python3-pyasn1 python3-openssl python3-six python3-zope.interface"
short_desc="Fully-featured cross-platform BitTorrent client"
maintainer="Alexey Rochev <equeim@gmail.com>"
license="GPL-3.0-or-later"
homepage="https://deluge-torrent.org/"
changelog="https://raw.githubusercontent.com/deluge-torrent/deluge/develop/CHANGELOG.md"
distfiles="https://ftp.osuosl.org/pub/deluge/source/${version%.*}/deluge-${version}.tar.xz"
checksum=768dd319802e42437ab3794ebe75b497142e08ed5b0fb2503bad62cef442dff7
make_check=no # requires unpackaged pytest_twisted

system_accounts="deluge"
deluge_homedir="/var/lib/deluge"

make_dirs="
 /var/lib/deluge 0755 deluge deluge
 /var/lib/deluge/.config 0755 deluge deluge
 /var/lib/deluge/.config/deluge 0755 deluge deluge
 "

post_install() {
	vsv deluged
}

deluge-gtk_package() {
	replaces="deluge<1.3.14_1"
	short_desc+=" - GTK+ frontend"
	depends="${sourcepkg}-${version}_${revision} python3-gobject gtk+3"
	pkg_install() {
		vmove usr/bin/deluge
		vmove usr/bin/deluge-gtk
		vmove ${py3_sitelib}/deluge/ui/gtk3
		vmove usr/share/applications
		vmove usr/share/icons
		vmove usr/share/man/man1/deluge.1
		vmove usr/share/man/man1/deluge-gtk.1
	}
}
deluge-web_package() {
	replaces="deluge<1.3.14_1"
	short_desc+=" - Web frontend"
	depends="${sourcepkg}-${version}_${revision}"
	pkg_install() {
		vmove usr/bin/deluge-web
		vmove ${py3_sitelib}/deluge/ui/web
		vmove usr/share/man/man1/deluge-web.1
		vsv deluge-web
	}
}
