# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 106774 2013-06-07 18:55:49Z devans@macports.org $

PortSystem      1.0
PortGroup       muniversal 1.0
PortGroup       active_variants 1.1

name            libtorrent-rasterbar-devel
conflicts       libtorrent-rasterbar
set svn_rev     8450
version         0.16.99.${svn_rev}
license         permissive
categories      net
maintainers     devans openmaintainer
platforms       darwin
homepage        http://www.rasterbar.com/products/libtorrent/

description \
    A C++ bittorrent library (not the same as port libtorrent)

long_description \
    A C++ bittorrent library designed to run on anything from embedded systems to large scale \
    seed servers. It comes with python bindings and detailed documentation.

fetch.type      svn
svn.url         http://svn.code.sf.net/p/libtorrent/code/trunk
svn.revision    ${svn_rev}

worksrcdir      trunk

depends_build   port:autoconf \
                port:automake \
                port:libtool \
                port:pkgconfig

depends_lib     port:boost \
                port:libgeoip \
                port:openssl

patchfiles      patch-Makefile.am.diff \
                patch-bindings-python-setup.py.in.diff

post-patch      {
                    reinplace "s|__MP_BUILD_ARCH__|${build_arch}|" ${worksrcpath}/bindings/python/setup.py.in
                }

configure.cmd   ./bootstrap.sh
configure.args  --disable-silent-rules \
                --enable-python-binding \
                --enable-geoip \
                --with-libgeoip \
                --with-boost-libdir="${prefix}/lib" \
                --with-boost-python="boost_python-mt"

variant python26 conflicts python27 description {Build bindings for Python 2.6} {
        require_active_variants boost python26
        depends_lib-append port:python26
        configure.python ${prefix}/bin/python2.6
        configure.env-append \
                "PYTHON_INSTALL_PARAMS=--prefix=${destroot}${prefix}/Library/Frameworks/Python.framework/Versions/2.6" \
                "PYTHON_EXTRA_LDFLAGS=' '"
}

variant python27 conflicts python26 description {Build bindings for Python 2.7} {
        require_active_variants boost python27
        depends_lib-append port:python27
        configure.python ${prefix}/bin/python2.7
        configure.env-append \
                "PYTHON_INSTALL_PARAMS=--prefix=${destroot}${prefix}/Library/Frameworks/Python.framework/Versions/2.7" \
                "PYTHON_EXTRA_LDFLAGS=' '"
}

variant error_logging description {Enable logging of errors to disk} {
        configure.args-append --enable-logging=errors
}

if {![variant_isset python26]} {
        default_variants          +python27
}

livecheck.type  none
