# $Id: Portfile 67197 2010-05-01 16:45:12Z gwright@macports.org $

PortSystem 1.0

name		cadabra
version		1.25
categories	math
platforms	darwin
maintainers	gwright
description	A field theory approach to symbolic computer algebra
long_description \
	Cadabra is a computer algebra system for the manipulation	\
	of what could loosely be called tensorial expressions. It is	\
	aimed at, though not necessarily restricted to, theoretical	\
	high energy physicists. Because of its target audience, the	\
	program's interface, storage system and underlying philosophy	\
	differ substantially from other computer algebra systems.

homepage	http://cadabra.phi-sci.com/
master_sites	${homepage}

checksums		md5     45198a26f72461bd6d29fe611ce3543f \
		sha1    c7a6c846fc48b60ad4b8f92c594f5e4408e9d943 \
		rmd160  c6341585d521d350bad09b07a1f41ea25df8bbb9

variant texmacs	description { install TeXmacs front end } {
		  depends_run-append port:TeXmacs
		}

variant maintainer_tests description { debug tests used by the maintainer } {
		  # 1.16 requires maxima to run the maintainer tests.
		  # This should go away in 1.18 according to the author.
		  depends_run-append port:maxima
		}

variant no_gui  description { do not build GUI } {
		  depends_lib-delete port:gtkmm
		  configure.args-append	--disable-gui
		}

patchfiles	patch-Makefile.in.diff		\
		patch-configure.diff

depends_lib	port:modglue	\
		port:pcre	\
		port:gmp	\
		port:LiE	\
		port:gtkmm	\
		port:texlive

post-patch	{
		  reinplace "s|XXPATH_TO_GCCXX|${configure.cc}|" ${worksrcpath}/configure
		}

build.env	CC=${configure.cc} CXX=${configure.cxx}

post-build	{
		  if {[variant_isset maintainer_tests]} {
			system "cd ${worksrcpath} && env CDB_LOG=1 ${build.cmd} test"
		  	system "cd ${worksrcpath} && env CDB_LOG=1 ${build.cmd} advtest"
		  }
		}

post-activate	{
		  system "${prefix}/bin/texhash"
		}

