# -*- 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$

PortSystem          1.0
PortGroup           python 1.0
PortGroup           active_variants 1.1

name                deluge
version             1.3.13
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           rmd160  1c57d3da90f4e6812b582c78563bbc2cd0f69027 \
                    sha256  37b3a22cea3ce8b87183f5d2d972d70db6e61825ea1c6bbc052e0120c49ee8c5

depends_build-append \
                    port:intltool

depends_lib-append  port:libtorrent-rasterbar \
                    port:librsvg \
                    port:xdg-utils

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 python27 conflicts python26 description {Build for Python 2.7} {
        require_active_variants libtorrent-rasterbar python27
        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
}

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}"