# Contributor: Peter Bui <pnutzh4x0r@gmail.com>
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Bartłomiej Piotrowski <nospam@bpiotrowski.pl>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
pkgname=rtorrent
pkgver=0.10.0
pkgrel=0
pkgdesc="Ncurses BitTorrent client based on libTorrent"
url="https://rakshasa.github.io/rtorrent/"
license="GPL-2.0-or-later"
# riscv64 blocked by libtorrent
arch="all !riscv64"
makedepends="
	autoconf
	automake
	curl-dev
	libsigc++3-dev
	libtool
	libtorrent-dev
	ncurses-dev
	xmlrpc-c-dev
	"
checkdepends="cppunit-dev"
subpackages="$pkgname-doc"
source="https://github.com/rakshasa/rtorrent/archive/v$pkgver/rtorrent-$pkgver.tar.gz
	add-ax_require_defined-m4.patch
	"

prepare() {
	default_prepare
	autoreconf -iv
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--enable-ipv6 \
		--disable-debug \
		--with-xmlrpc-c
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm644 doc/rtorrent.rc "$pkgdir"/usr/share/doc/rtorrent/rtorrent.rc
}

sha512sums="
261943c29ff8b0bc2f11f54436990b35ebf4ea04272fca41fc6bfad502ff76b6e006c65e55e6e04eadf44c50869e15062c57d29888129a2f73f77dbac7f33b98  rtorrent-0.10.0.tar.gz
1133aea489ac13b5fabee774f940a6a0cf18a969a937fd24c8126978511dd1b521c2264ada9b46c6fbd63d648b97d8d34199ddc2763df487f607d3af87b619d6  add-ax_require_defined-m4.patch
"
