# -*- 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 107110 2013-06-18 18:38:13Z jmr@macports.org $

PortSystem      1.0
PortGroup       python 1.0

name            deluge
version         1.3.6
revision        1
categories      net gnome python
license         {GPL-3+ OpenSSLException}
maintainers     devans openmaintainer
supported_archs noarch

description     A GNOME BitTorrent client.
long_description \
                Deluge is a GNOME client for the BitTorrent network written in python.
homepage        http://www.deluge-torrent.org
platforms       darwin

master_sites    http://download.deluge-torrent.org/source/

use_bzip2       yes

checksums       sha256  756a025d88752f39133aa34d8fc96d4ce216113919488d60098ee41f860a1f60 \
                rmd160  04f3e92669e415d547648720bf96019aea0ce945

depends_lib-append \
                path:lib/libtorrent-rasterbar.dylib:libtorrent-rasterbar \
                port:boost \
                port:librsvg

patchfiles      patch-remove-osx-native-menus.diff

build.env       PYTHON_CFLAGS="-I${prefix}/include -I${prefix}/include/boost" \
                PYTHON_LDFLAGS=-L${prefix}/lib \
                CFLAGS="-I${prefix}/include -I${prefix}/include/boost" \
                CC=${configure.cc} CXX=${configure.cxx} CPP=${configure.cpp}

variant python26 conflicts python27 description {Build for Python 2.6} {
        python.default_version 26
        depends_lib-append \
                port:dbus-python26 \
                port:py26-chardet \
                port:py26-game \
                port:py26-pygtk \
                port:py26-setuptools \
                port:py26-xdg \
                port:py26-twisted \
                port:py26-twisted-web2 \
                port:py26-openssl \
                port:py26-mako
}

variant python27 conflicts python26 description {Build for Python 2.7} {
        python.default_version 27
        depends_lib-append \
                port:dbus-python27 \
                port:py27-chardet \
                port:py27-game \
                port:py27-pygtk \
                port:py27-setuptools \
                port:py27-xdg \
                port:py27-twisted \
                port:py27-twisted-web2 \
                port:py27-openssl \
                port:py27-mako
}

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

python.link_binaries no
post-destroot {
        foreach bin [glob -nocomplain -tails -directory "${destroot}${python.prefix}/bin" *] {
            ln -s "${python.prefix}/bin/${bin}" "${destroot}${prefix}/bin/${bin}${python.link_binaries_suffix}"
        }
}

livecheck.type  regex
livecheck.url   http://download.deluge-torrent.org/source/
livecheck.regex "${name}-(\\d+(?:\\.\\d+)*)${extract.suffix}"
