# Template file for 'rtorrent'
pkgname=rtorrent
version=0.9.5
revision=1
build_style=gnu-configure
configure_args="--with-xmlrpc-c"
hostmakedepends="automake libtool pkg-config"
makedepends="libcurl-devel libsigc++-devel libtorrent-devel ncurses-devel xmlrpc-c-devel"
short_desc="Ncurses BitTorrent client based on libTorrent"
maintainer="Juan RP <xtraeme@voidlinux.eu>"
homepage="https://github.com/rakshasa/rtorrent"
license="GPL-2"
distfiles="https://github.com/rakshasa/${pkgname}/archive/${version}.tar.gz>${pkgname}-${version}.tar.gz"
checksum=96ab7c168a5a83f4dd7e991cee3a65fda6d76c9bc9a72ac6fefe34a2ded0eb85

pre_configure() {
	# Drop cppunit requirement
	sed '/AM_PATH_CPPUNIT.*/d' -i configure.ac
	autoreconf -fi
	sed -e 's,test "$cross_compiling" = yes, false,' -i configure
}
post_configure() {
	local f
	for f in $(find ${wrksrc} -name Makefile); do
		sed -e "s;-L/usr/lib;-L${XBPS_CROSS_BASE}/usr/lib;g" -i $f
		sed -e "s;-I/usr/include;-L${XBPS_CROSS_BASE}/usr/include;g" -i $f
	done
	case "$XBPS_TARGET_ARCH" in
		*-musl) sed -e "s;-lm;-lm -lc;" Makefile
	esac
}
