# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 78589 2011-05-13 09:07:42Z ryandesign@macports.org $

PortSystem      1.0
PortGroup       xcode 1.0

name            transmission
version         2.22
categories      net aqua
maintainers     mnick openmaintainer
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 Cocoa version.
homepage        http://www.transmissionbt.com/

master_sites    http://download.m0k.org/transmission/files/ \
                http://download.transmissionbt.com/files/ 

checksums       md5     6499986bf769276310b00bda1090090d \
                sha1    ddd515bdcc201193b45f58b705f6e8fde9fcb5d1 \
                rmd160  e87b560f81fc8bc422dc7071a4b27bdcf2b2d6ac
                
use_bzip2       yes

patchfiles      patch-xcodebuild.diff patch-sparkle.diff
platforms       macosx

depends_lib     port:gettext \
                port:libevent

xcode.target            Transmission
xcode.configuration     Release

pre-patch {
    reinplace -E "s%third-party/(curl|libevent|openssl)/(include|lib)%@@PREFIX@@/\\2%g" \
        ${worksrcpath}/Transmission.xcodeproj/project.pbxproj
}

post-patch {
    reinplace -E "s|@@PREFIX@@|${prefix}|g" \
        ${worksrcpath}/Transmission.xcodeproj/project.pbxproj
}

destroot {
    file copy ${worksrcpath}/build/${xcode.configuration}/Transmission.app \
        ${destroot}${applications_dir}/Transmission.app
}

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>
