# -*- 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 92938 2012-05-11 14:36:43Z ryandesign@macports.org $

PortSystem                      1.0
PortGroup                       qt4 1.0
PortGroup                       app 1.0

# Keep relevant lines in sync between graphviz-devel, graphviz-gui-devel and gvedit-devel.

name                            gvedit-devel
conflicts                       gvedit
set my_name                     graphviz
version                         2.29.20120511.0445
categories                      graphics
maintainers                     ryandesign
license                         EPL-1.0
homepage                        http://www.graphviz.org/
master_sites                    ${homepage}pub/graphviz/development/SOURCES/
platforms                       darwin
use_parallel_build              yes
dist_subdir                     ${my_name}
distname                        ${my_name}-${version}

description                     Qt-based GUI for Graphviz

long_description                gvedit is a ${description}. You may prefer \
                                the Mac-native GUI in the graphviz-gui port.

checksums                       rmd160  908c04bf929f7b4e6ee42bb41dd8a9854b95d59c \
                                sha256  4196f28ad182f5c23ed6cc11d6e91f9179d7363fb2bdb8fccb55dab698da27de

depends_lib-append              port:graphviz-devel

post-extract {
    if {[get_short_version_string] == ""} {
        return -code error "cannot find ${app.name} short version string"
    }
}

patchfiles                      patch-cmd-gvedit-Makefile.in.diff

configure.args                  --with-qt

build.dir                       ${worksrcpath}/cmd/gvedit

app.name                        GVEdit
app.executable                  gvedit
app.icon                        ${build.dir}/images/icon.png

pre-destroot {
    app.short_version_string [get_short_version_string]
}

proc get_short_version_string {} {
    global build.dir
    return [exec /usr/bin/sed -E -n s/^\[\[:space:\]\]*"Version:\[\[:space:\]\]*(.+)".*/\\1/p ${build.dir}/mainwindow.cpp]
}

livecheck.type                  regex
livecheck.url                   ${homepage}Download_source.php
livecheck.regex                 ${my_name}-(\[0-9\]+\\.\[0-9\]*\[13579\](\\.\[0-9\]+)*)\\.tar
