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

name                transmission-x11
version             2.92
revision            0
categories          net x11
license             {GPL-2 OpenSSLException}
maintainers         nomaintainer
description         Lightweight BitTorrent client
long_description    Transmission is a free, lightweight BitTorrent client. \
                    It features a simple, intuitive interface on top of an \
                    efficient, cross-platform back-end. Transmission is open \
                    source (MIT license) and runs on Mac OS X (Cocoa interface), \
                    Linux/NetBSD/FreeBSD/OpenBSD (GTK+ interface) and BeOS \
                    (native interface). This is the GTK+ version.
homepage            http://www.transmissionbt.com/
master_sites        http://download.m0k.org/transmission/files/ \
                    http://download.transmissionbt.com/files/ \
                    https://transmission.cachefly.net/

platforms           darwin freebsd

use_xz              yes

distname            transmission-${version}
dist_subdir         transmission

checksums           rmd160  6da78ce333fa2ea69aa4954c3b052a818ce7c93e \
                    sha256  3a8d045c306ad9acb7bf81126939b9594553a388482efa0ec1bfb67b22acd35f

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

depends_lib         port:miniupnpc \
                    path:lib/libssl.dylib:openssl \
                    port:curl \
                    port:gettext \
                    port:libevent

# reconfigure using upstream autogen.sh for intltool 0.51 compatibility

configure.cmd       ./autogen.sh

configure.args      --enable-daemon \
                    --enable-cli \
                    --without-gtk \
                    --disable-mac

default_variants    +gtk

variant aqua description {Build Aqua front-end} {
    configure.args-replace  --disable-mac --enable-mac
}

variant gtk description {Build Gtk3 front-end} {
    depends_lib-append      port:gtk3 \
                            port:libnotify \
                            port:desktop-file-utils

    depends_run             port:gnome-themes-standard

    configure.args-replace  --without-gtk --with-gtk

    post-activate {
        system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
        system "${prefix}/bin/gtk-update-icon-cache-3.0 -f -t ${prefix}/share/icons/hicolor"
    }
}

platform darwin 8 {
    pre-fetch {
        ui_error "${name} requires Mac OS X 10.5 or greater."
        return -code error "incompatible Mac OS X version"
    }
}

livecheck.url       ${homepage}/download.php
livecheck.regex     The current release version is <b>(.*)</b>