# -*- 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 87639 2011-11-29 23:37:07Z devans@macports.org $

PortSystem	1.0

name            gnome-python-desktop
version         2.30.2
revision        2
set branch      [join [lrange [split ${version} .] 0 1] .]
categories      gnome python
license         GPL-2+ LGPL-2.1+
maintainers     devans openmaintainer
description     Python modules for some GNOME Desktop libraries.
long_description	${description}
platforms       darwin
homepage        http://www.pygtk.org/
master_sites    gnome:sources/${name}/${branch}/

checksums       md5     b90f6e96a6321e7bf859f6faff2aa4df \
                sha1    75f41e1832baf37e332ee1e10b29a82b1809b6ef \
                rmd160  8b46fbe26e3fa0a9eae3dbd3ff31fb910fb6b135

use_bzip2       yes

depends_build   port:pkgconfig \
                port:libtool

depends_lib	port:gtksourceview \
                port:libgtop \
                port:gnome-media \
                port:gnome-panel \
                port:metacity \
                port:evince \
                port:bug-buddy \
                port:totem-pl-parser

patchfiles      patch-configure.diff

configure.args 	--enable-metacity \
                --disable-nautilusburn

configure.pre_args-delete  --prefix=${prefix}

variant python25 conflicts python26 python27 description {Use python 2.5} {
    set python_ver            2.5

    configure.python          ${prefix}/bin/python${python_ver}
    depends_lib-append        port:py25-gnome

    set python_prefix         ${frameworks_dir}/Python.framework/Versions/${python_ver}
    configure.pre_args-append --prefix=${python_prefix}
    configure.args-append     --includedir=${python_prefix}/include/python${python_ver}
    configure.python          ${prefix}/bin/python${python_ver}
    configure.env             PATH=${python_prefix}/bin:$env(PATH)
    configure.pkg_config_path ${python_prefix}/lib/pkgconfig

    post-destroot {
        set python_prefix ${frameworks_dir}/Python.framework/Versions/2.5
        # devhelp requires gtk-doc directory name  and .devhelp file name (less the .devhelp) to match
        foreach docname {pygnomeprint pygnomeprintui pygtksourceview} {
            file rename ${destroot}${python_prefix}/share/gtk-doc/html/${docname}/${docname}.devhelp \
                        ${destroot}${python_prefix}/share/gtk-doc/html/${docname}/${docname}25.devhelp 
            ln -s ${python_prefix}/share/gtk-doc/html/${docname} ${destroot}${prefix}/share/gtk-doc/html/${docname}25
        }
    }
}

variant python26 conflicts python25 python27 description {Use python 2.6} {
    set python_ver            2.6

    configure.python          ${prefix}/bin/python${python_ver}
    depends_lib-append        port:py26-gnome

    set python_prefix         ${frameworks_dir}/Python.framework/Versions/${python_ver}
    configure.pre_args-append --prefix=${python_prefix}
    configure.args-append     --includedir=${python_prefix}/include/python${python_ver}
    configure.python          ${prefix}/bin/python${python_ver}
    configure.env             PATH=${python_prefix}/bin:$env(PATH)
    configure.pkg_config_path ${python_prefix}/lib/pkgconfig

    post-destroot {
        set python_prefix ${frameworks_dir}/Python.framework/Versions/2.6
        # devhelp requires gtk-doc directory name  and .devhelp file name (less the .devhelp) to match
        foreach docname {pygnomeprint pygnomeprintui pygtksourceview} {
            file rename ${destroot}${python_prefix}/share/gtk-doc/html/${docname}/${docname}.devhelp \
                        ${destroot}${python_prefix}/share/gtk-doc/html/${docname}/${docname}26.devhelp 
            ln -s ${python_prefix}/share/gtk-doc/html/${docname} ${destroot}${prefix}/share/gtk-doc/html/${docname}26
        }
    }
}

variant python27 conflicts python25 python26 description {Use python 2.7} {
    set python_ver            2.7

    configure.python          ${prefix}/bin/python${python_ver}
    depends_lib-append        port:py27-gnome

    set python_prefix         ${frameworks_dir}/Python.framework/Versions/${python_ver}
    configure.pre_args-append --prefix=${python_prefix}
    configure.args-append     --includedir=${python_prefix}/include/python${python_ver}
    configure.python          ${prefix}/bin/python${python_ver}
    configure.env             PATH=${python_prefix}/bin:$env(PATH)
    configure.pkg_config_path ${python_prefix}/lib/pkgconfig

    post-destroot {
        set python_prefix ${frameworks_dir}/Python.framework/Versions/2.7
        # devhelp requires gtk-doc directory name  and .devhelp file name (less the .devhelp) to match
        foreach docname {pygnomeprint pygnomeprintui pygtksourceview} {
            file rename ${destroot}${python_prefix}/share/gtk-doc/html/${docname}/${docname}.devhelp \
                        ${destroot}${python_prefix}/share/gtk-doc/html/${docname}/${docname}27.devhelp 
            ln -s ${python_prefix}/share/gtk-doc/html/${docname} ${destroot}${prefix}/share/gtk-doc/html/${docname}27
        }
    }
}

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


platform darwin 9 {
    post-patch {
        reinplace "s| -export-symbols-regex.*||g" \
            ${worksrcpath}/evolution/Makefile.in \
            ${worksrcpath}/gnomeapplet/Makefile.in \
            ${worksrcpath}/gnomedesktop/Makefile.in \
            ${worksrcpath}/gnomekeyring/Makefile.in \
            ${worksrcpath}/gnomeprint/Makefile.in \
            ${worksrcpath}/gtksourceview/Makefile.in \
            ${worksrcpath}/gtop/Makefile.in \
            ${worksrcpath}/mediaprofiles/Makefile.in \
            ${worksrcpath}/metacity/Makefile.in \
            ${worksrcpath}/nautilusburn/Makefile.in \
            ${worksrcpath}/rsvg/Makefile.in \
            ${worksrcpath}/totem/Makefile.in \
            ${worksrcpath}/wnck/Makefile.in
    }
}

#
# gnome-panel -> evolution-data-server -> nss is not universal
#

universal_variant no

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS COPYING ChangeLog NEWS README \
        ${destroot}${docdir}
    xinstall -d ${destroot}${prefix}/share/gtk-doc/html
}

livecheck.type  regex
livecheck.url   http://ftp.gnome.org/pub/gnome/sources/${name}/${branch}/
livecheck.regex {LATEST-IS-(\d+(?:\.\d+)*)}
