# Maintainer (Arch): Gaetan Bisson <bisson@archlinux.org>
# Maintainer (Arch): Jaroslav Lichtblau <svetlemodry@archlinux.org>
# Contributor (Arch): Daenyth <Daenyth [at] gmail [dot] com>
# Contributor (Arch): Jeff Mickey <jeff@archlinux.org>
# Contributor (Arch): sh__
# Based on rtorrent in [community]
# Maintainer: Omar Vega Ramos <ovruni@gnu.org.pe>

_pkgname=rtorrent
pkgname=$_pkgname-color
pkgver=0.9.7
pkgrel=2
pkgdesc='Ncurses BitTorrent client based on libTorrent'
pkgdesc+=' with color patch.'
url='http://rakshasa.github.io/rtorrent/'
license=('GPL')
arch=('x86_64')
arch+=('i686')
depends=("libtorrent=0.13.${pkgver##*.}" 'curl' 'xmlrpc-c')
conflicts=("${_pkgname}")
provides=("${_pkgname}")
source=("https://github.com/rakshasa/rtorrent/releases/download/v${pkgver}/${_pkgname}-${pkgver}.tar.gz")
source+=("${_pkgname}-${pkgver}_color.patch")
sha256sums=('5d9842fe48c9582fbea2c7bf9f51412c1ccbba07d059b257039ad53b863fe8bb'
            'd694fb2a1c0a60580fcc74ace5c7bbcaf667ce2fbd7968b209460e5deb79e4ed')

prepare() {
	cd "${srcdir}/${_pkgname}-${pkgver}"
	./autogen.sh

  patch -uNp1 -i "${srcdir}/${_pkgname}-${pkgver}_color.patch"
}

build() {
	cd "${srcdir}/${_pkgname}-${pkgver}"
	export CXXFLAGS+=' -fno-strict-aliasing'
	./configure \
		--prefix=/usr \
		--disable-debug \
		--with-xmlrpc-c \

	make
}

package() {
	cd "${srcdir}/${_pkgname}-${pkgver}"
	make DESTDIR="${pkgdir}" install
	install -D doc/rtorrent.rc "${pkgdir}"/usr/share/doc/rtorrent/rtorrent.rc
}
