# $Id: Portfile 55944 2009-08-21 17:16:28Z ryandesign@macports.org $

PortSystem              1.0
PortGroup               xcode 1.0

name                    graphviz-gui-devel
set my_name             graphviz
# keep version in sync between graphviz-devel and graphviz-gui-devel
version                 2.25.20090821.0445
categories              graphics aqua
maintainers             ryandesign
homepage                http://www.graphviz.org/
master_sites            ${homepage}pub/graphviz/development/SOURCES/
use_parallel_build      yes
dist_subdir             ${my_name}
distname                ${my_name}-${version}
xcode.configuration     Release

description \
    Mac OS X Aqua GUI for viewing and exporting Graphviz graphs

long_description \
    ${description}.

checksums \
    md5     b9d92cc008ceb9c9db501c109446ab35 \
    sha1    418e43c7cf4e333a8538170cb6054049e1227b27 \
    rmd160  faff20663a14f35cd93bc98edf2cc49045fce0cf

depends_lib \
    port:graphviz-devel

pre-fetch {
    if {"darwin" != ${os.platform}} {
        ui_error "${name} requires Mac OS X."
        return -code error "incompatible operating system"
    }
    if {${os.major} < 9} {
        ui_error "${name} requires Mac OS X 10.5 or greater. Try graphviz-oldgui instead."
        return -code error "incompatible Mac OS X version"
    }
}

pre-extract {
    if {"darwin" == ${os.platform} && 9 == ${os.major}} {
        # graphviz-devel needs Xcode 3.1+ to avoid the libGL error when building the smyrna variant
        # graphviz-gui-devel needs Xcode 3.1.2+; see #18811
        set minimum_xcodeversion 3.1.2
        set current_xcodeversion [exec defaults read /Developer/Applications/Xcode.app/Contents/Info CFBundleShortVersionString]
        if {[rpm-vercomp ${current_xcodeversion} ${minimum_xcodeversion}] < 0} {
            ui_error "On Mac OS X ${macosx_version}, ${name} ${version} requires Xcode ${minimum_xcodeversion} or later but you have Xcode ${current_xcodeversion}."
            return -code error "incompatible Xcode version"
        }
    }
}

extract.post_args-append ${worksrcdir}/macosx ${worksrcdir}/doc

patchfiles              patch-project.pbxproj.diff

build.dir               ${worksrcpath}/macosx
xcode.build.settings    PREFIX=${prefix}

xcode.destroot.settings ${xcode.build.settings}

# keep livecheck in sync between graphviz-devel and graphviz-gui-devel
livecheck.check         regex
livecheck.url           ${homepage}Download_source.php
livecheck.regex         ${my_name}-(\[0-9\]+\\.\[0-9\]*\[13579\](\\.\[0-9\]+)*)\\.tar
