# -*- 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 57375 2009-09-10 08:16:41Z ryandesign@macports.org $

PortSystem 1.0

name            dasher
version         4.10.1
set branch      [join [lrange [split ${version} .] 0 1] .]
description     Zooming text entry system.
long_description \
                Dasher is a zooming predictive text entry system, designed \
                for situations where keyboard input is impractical (for \
                instance, accessibility or PDAs). It is usable with highly \
                limited amounts of physical input while still allowing high \
                rates of text entry.
maintainers     nomaintainer
categories      gnome
platforms       darwin
homepage        http://www.gnome.org/

use_bzip2       yes
master_sites    gnome:sources/${name}/${branch}/

checksums       md5     83e556690ac54c4bb8c49c050510259e \
                sha1    bc2bd8c8c8f078f5290527f1525563d098f53b5d \
                rmd160  0ed314ba5717f129168e315e02389259dc28532c

depends_lib     port:libgnomeui \
                port:at-spi \
                port:libwnck

configure.args  --mandir=${prefix}/share/man \
                --without-gvfs \
                --disable-scrollkeeper

platform darwin 8 {
    configure.cxxflags-append -DWITH_DARWIN=1
}

variant speech description {build with speech support} {
        configure.args-append --enable-speech
        depends_lib-append port:gnome-speech
}

variant gvfs description {build with gvfs from gio in glib} {
        configure.args-delete --without-gvfs
        depends_lib-append port:gvfs
}

set storagedir  ${prefix}/etc/macports/gconf
set storagefile $storagedir/${name}

post-destroot {
    # Register schemas with gconf. See http://trac.macosforge.org/projects/macports/ticket/14729

    # Find all .schemas file in the destroot
    fs-traverse schema ${destroot}${prefix}/etc/gconf/schemas {
        if { [ file isfile $schema ] } {
            lappend schemafiles $schema
        }
    }

    # And put them in etc/macports/gconf/$name
    if { [ llength $schemafiles ] > 0 } {
        file mkdir ${destroot}${storagedir}
        set fh [open ${destroot}${storagefile} w]
        foreach file $schemafiles {
            puts $fh [exec basename $file]
        }
        close $fh
    }
}

post-activate {
    if { [file exists ${storagefile} ] } {
        set fh [open ${storagefile} r]
        while { ! [eof $fh] } {
            lappend schemafiles [gets $fh]
        }
        close $fh
    }

    set schemastring [join $schemafiles " "]

    system "cd ${prefix}/etc/gconf/schemas && \
         GCONF_CONFIG_SOURCE=`${prefix}/bin/gconftool-2 --get-default-source` \
         ${prefix}/bin/gconftool-2 --makefile-install-rule $schemastring"

    system "${prefix}/bin/scrollkeeper-update"
    system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
}

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