# Depends on: boost python python2

description="A C++ BitTorrent library that aims to be a good alternative to all the other implementations around"
url="http://www.rasterbar.com/products/libtorrent/"
packager="rems <rems@nutyx.org>"
contributors=""

name=libtorrent-rasterbar
version=1.1.11
_version=${version//./_}
release=2

source=(https://github.com/arvidn/libtorrent/archive/libtorrent_"${_version}".tar.gz)

build() {
mkdir -v py2 py3
  cd libtorrent-libtorrent_"${_version}"
  sed -i 's/-msse4.2//' configure.ac
  ./autotool.sh
cp -a * ../py2
cp -a * ../py3
cd ../py2
_boost="boost_python"
CXXFLAGS="$CXXFLAGS -std=c++11" \
  PYTHON=/usr/bin/python2 \
  ../libtorrent-libtorrent_${_version}/configure \
  --prefix=/usr \
  --enable-python-binding \
  --enable-examples \
  --disable-static \
  --with-libiconv \
  --with-boost-python=$_boost
make
make DESTDIR=$PKG install
unset _boost

cd ../py3
_boost="boost_python3"
CXXFLAGS="$CXXFLAGS -std=c++11" \
  PYTHON=/usr/bin/python3 \
  ../libtorrent-libtorrent_${_version}/configure \
  --prefix=/usr \
  --enable-python-binding \
  --enable-examples \
  --disable-static \
  --with-libiconv \
  --with-boost-python=$_boost
make DESTDIR="$PKG" install
rm "$PKG"/usr/bin/{*_test,*_tester,simple_client,stats_counters}

# Obsolet lib
rm $PKG/usr/lib/libtorrent-rasterbar.la
}
