# -*- 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 80872 2011-07-19 22:21:50Z ryandesign@macports.org $

PortSystem                      1.0
PortGroup                       archcheck 1.0
PortGroup                       xcode 1.0
PortGroup                       xcodeversion 1.0

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

name                            graphviz-gui
conflicts                       graphviz-gui-devel graphviz-oldgui
set my_name                     graphviz
version                         2.28.0
categories                      graphics aqua
maintainers                     ryandesign
license                         EPL-1.0
homepage                        http://www.graphviz.org/
master_sites                    ${homepage}pub/graphviz/stable/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                       sha1    4725d88a13e071ee22e632de551d4a55ca08ee7d \
                                rmd160  5a5fae7cb1128d4e863b954bee5f2491ff23ada0

depends_lib                     port:graphviz

archcheck.files                 lib/libgvc.dylib

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"
    }
}

# graphviz needs Xcode 3.1+ to avoid the libGL error when building the smyrna variant
# graphviz-gui needs Xcode 3.1.2+; see #18811
minimum_xcodeversions           {9 3.1.2}

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}

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