# -*- coding: utf-8; mode: tcl; tab-width: 4; truncate-lines: t; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
# $Id: Portfile 68444 2010-06-03 16:41:33Z elelay@macports.org $

PortSystem          1.0

name                gpodder
version             2.6
categories          gnome audio
license             GPLv3
maintainers         elelay
platforms           darwin
description         A media aggregator and podcast client

long_description    gPodder is a standalone podcast manager. \
                    It provides anything to manage feeds and podcasts \
                    but requires an external player to actually listen/view \
                    the content, e.g. Apple QuickTime Player.

homepage            http://gpodder.org
master_sites        http://download.berlios.de/gpodder/

checksums           md5     61ddfbf63c0f1de4b5d89c6b94f07339 \
                    sha1    6b4e6a7c7c7565bc664cc3bb366d3dc2a7e5f9c2 \
                    rmd160  949da3a0c99c097183d7cb6926fa04a9dfb1492e

depends_build       port:help2man\
                    port:intltool

depends_lib         port:vorbis-tools\
                    port:lame

variant python25 conflicts python26 description {Use Python 2.5} {
    depends_lib-append  port:py25-feedparser\
                        port:py25-pil\
                        port:dbus-python25\
                        port:py25-mygpoclient

    post-patch {
        reinplace s|python|${prefix}/bin/python2.5|g ${worksrcpath}/Makefile
    }

    destroot.args PREFIX=${prefix}
}


set my_python "${frameworks_dir}/Python.framework/Versions/2.6"

variant python26 conflicts python25 description {Use Python 2.6} {
    depends_lib-append  port:py26-feedparser\
                        port:py26-pil\
                        port:dbus-python26\
                        port:py26-mygpoclient
    
    post-patch {
        reinplace s|python|${my_python}/bin/python|g ${worksrcpath}/Makefile
    }
    
    # install in python 2.6 prefix, see bug #22522
    destroot.args PREFIX=${frameworks_dir}/Python.framework/Versions/2.6
    
    # Install the 2.6 apps in the standard path :
    # the 2 variants can't be active simultaneously.
    post-destroot {
    	foreach {app} {gpodder gpo gpodder-backup} {
    		ln -s ${my_python}/bin/${app} ${destroot}${prefix}/bin/${app}
        }
    }
}

if {![variant_isset python25] && ![variant_isset python26]} {
    default_variants +python26
}

variant quartz {
    depends_lib-append  port:gtk-osx-application
}

variant html_notes description {Use WebkitGtk+ to show episode notes in HTML format} {
	if {[variant_isset python25]} {
		depends_lib-append  port:py25-webkitgtk
	} else {
		depends_lib-append  port:py26-webkitgtk
	}
}

use_configure       no

build {}

post-destroot {

    # build a MacOS X application
	if {[variant_isset python26]} {
		set install_path "${my_python}"
	} else {
		set install_path "${prefix}"
	}

	system "cd ${worksrcpath}/data/osx && make \
		GPODDERSCRIPT=\"${install_path}/bin/gpodder\"\
		APPLICATIONSDIR=\"${destroot}${applications_dir}\"\
		VERSION=\"${version}\"\
		OSXVERSION=\"${os.platform}${os.major}\" all"
}

livecheck.type      regex
livecheck.url       ${master_sites}
livecheck.regex     "gpodder-(\\d+(?:\\.\\d+)*)${extract.suffix}"
