# $Id: Portfile,v 1.31 2006/03/31 15:21:06 gwright Exp $

PortSystem 1.0
name		graphviz
version		2.8
categories	graphics
maintainers	gwright@opendarwin.org
description	Graph visualization software from AT&T and Bell Labs
long_description \
		Graph Visualization Software from AT&T Laboratories and \
		Bell Laboratories (Lucent Technologies).		\
									\
		The package contains:					\
    		dot    - batch program for drawing directed graphs as	\
			 hierarchies					\
    		neato  - batch program for drawing undirected graphs	\
			 using Kamada-Kawai spring models.		\
									\
		Users wishing to have only the graph layout		\
		programs (for non-interactive use) can use the +no_x11	\
		variant to build graphviz without its display routines.

platforms	darwin

homepage	http://www.graphviz.org/
master_sites	http://www.graphviz.org/pub/graphviz/ARCHIVE/

checksums	md5 ca921b4a9bcd86da4a1092bb17a57d83

platform darwin 6 {
			patchfiles-append	patch-Makefile.in
			ui_msg "Note: dot2gxl and gxl2dot dot not build on OS X 10.2 (Jaguar). Sorry."
}

platform darwin 7 {
			configure.env-append	MACOSX_DEPLOYMENT_TARGET=10.3
			build.env-append	MACOSX_DEPLOYMENT_TARGET=10.3

			depends_lib-append	port:gnuregex

			post-extract {
				reinplace	"s|regex.h|gnuregex.h|g" ${worksrcpath}/lib/gvc/gvconfig.c
			}
}

platform darwin 8 {
			configure.env-append	MACOSX_DEPLOYMENT_TARGET=10.4 \
						CC=/usr/bin/gcc-4.0	\
						CPP=/usr/bin/cpp-4.0	\
						CXX=/usr/bin/g++-4.0

			build.env-append	MACOSX_DEPLOYMENT_TARGET=10.4
}

depends_lib	lib:libX11.6:XFree86	\
		port:jpeg		\
		port:libpng		\
		port:freetype		\
		port:expat		\
		port:gd2		\
		port:zlib		\
		port:gettext

# All of the language bindings except tcl are disabled by default.
# (If you're running DP, you have a good enough tcl to get the languange
# binding. If this is a problem for anyone it is easily remedied.)
#
# I have to use an ugly method to prevent the language bindings from
# being built: explicitly setting some of autoconf's environment
# variables.  This should go away when 2.8 is released.  It uses
# the standard GNU --{en,dis}able-feature flags to configure.

configure.env	CPPFLAGS=-I${prefix}/include	\
		LDFLAGS=-L${prefix}/lib
		
configure.args	--mandir=${prefix}/share/man	\
		--disable-guile			\
		--disable-ocaml			\
		--disable-perl			\
		--disable-php			\
		--disable-python		\
		--disable-ruby

variant guile	{ depends_lib-append	port:guile
		  configure.args-append	--enable-guile
		}

variant ocaml	{ depends_lib-append	port:ocaml
		  configure.args-append	--enable-ocaml
		}

variant perl	{ depends_lib-append	port:perl5.8
		  configure.args-append	--enable-perl
		}

variant php	{ depends_lib-append	port:php4
		  configure.args-append	--enable-php
		}

variant python	{ depends_lib-append	port:python24
		  configure.args-append	--enable-python
		}

variant ruby	{ depends_lib-append	port:ruby
		  configure.args-append	--enable-ruby
		}

variant all_lang { depends_lib-append	port:guile	\
					port:ocaml	\
					port:perl5.8	\
					port:php4	\
					port:python24	\
					port:ruby

		  configure.args-append	--enable-guile	\
					--enable-ocaml	\
					--enable-perl	\
					--enable-php	\
					--enable-python	\
					--enable-ruby
		}

variant no_x11	{ depends_lib-delete	lib:libX11.6:XFree86	\
					port:gd2
		  depends_lib-append	port:gd2-nox11

		  configure.args-append	--without-x
		}


# Make the configuration file that makes the plugins work:

post-activate	{
		  system "dot -c"
		}

