# Template file for 'libtorrent-rasterbar'
pkgname=libtorrent-rasterbar
version=1.1.1
revision=5
build_style=gnu-configure
configure_args="--with-libgeoip --with-boost-libdir=${XBPS_CROSS_BASE}/usr/lib"
hostmakedepends="pkg-config intltool"
makedepends="libressl-devel boost-devel geoip-devel"
short_desc="C++ bittorrent library by Rasterbar Software"
maintainer="Eivind Uggedal <eivind@uggedal.com>"
homepage="http://www.rasterbar.com/products/libtorrent/"
license="BSD"
distfiles="https://github.com/arvidn/libtorrent/releases/download/libtorrent-${version//./_}/libtorrent-rasterbar-${version}.tar.gz"
checksum=f70c82367b0980460ef95aff3e117fd4a174477892d529beec434f74d615b31f

subpackages="libtorrent-rasterbar-devel"
CXXFLAGS="-std=c++11"
CFLAGS="-std=c++11"  # FIXME: bindings/python doesn't use CXXFLAGS

if [ -z "$CROSS_BUILD" ]; then
	configure_args+=" --enable-python-binding"
	makedepends+=" boost-python python-devel"
	subpackages+=" libtorrent-rasterbar-python"
fi

post_install() {
	vlicense LICENSE
}

libtorrent-rasterbar-python_package() {
	replaces="${sourcepkg}<1.0.9_2"
	short_desc+=" - python bindings"
	pkg_install() {
		vmove usr/lib/python*
	}
}
libtorrent-rasterbar-devel_package() {
	depends="${sourcepkg}>=${version}_${revision} libressl-devel>=2.1.4 boost-devel geoip-devel"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove "usr/lib/*.so"
		vmove "usr/lib/*.a"
	}
}
