# $Id: Portfile 50980 2009-05-14 19:41:55Z and.damore@macports.org $

PortSystem 1.0

name		DoCon
set shortname	docon
version		2.11
revision	1
categories	math devel
maintainers	gwright
platforms	darwin

description	DoCon is the Algebraic Domain Constructor
long_description	\
		DoCon joins the categorial approach to mathematical	\
		computation expressed via the Haskell type classes,	\
		and explicit processing of the domain description	\
		terms.  It implements recently a good piece of		\
		commutative algebra: linear algebra, polynomial gcd,	\
		factorization, Groebner bases, and other functions.

homepage	http://haskell.org/${shortname}
master_sites	${homepage}/distrib/${version}
distname	${shortname}-${version}
use_zip		yes

checksums	md5 229b4af2005bc6fcac0e386d88bf69e4

patchfiles	patch-docon.cabal.diff

depends_lib	port:ghc

set worksrcpath	${workpath}/${shortname}/source

variant printable_doc description {Build printable documentation} {
		  depends_build bin:latex:texlive port:ghostscript

		  post-destroot {
			system "cd ${workpath}/${shortname} && latex manual.lat"
			system "cd ${workpath}/${shortname} && dvipdf manual"
			file mkdir ${destroot}${prefix}/share/doc/${shortname}-${version}
			file copy ${workpath}/${shortname}/manual.pdf ${destroot}${prefix}/share/doc/${shortname}-${version}/
		  }
		}

configure	{ system "cd ${worksrcpath} && runhaskell Setup configure --ghc --prefix=${prefix} --enable-library-profiling" }

build		{ system "cd ${worksrcpath} && runhaskell Setup build -v" }

destroot	{ system "cd ${worksrcpath} && runhaskell Setup copy --copy-prefix=${destroot}${prefix}"
                  system "cd ${worksrcpath} && runhaskell Setup register   --gen-script"
                  system "cd ${worksrcpath} && runhaskell Setup unregister --gen-script"

                  file mkdir ${destroot}${prefix}/libexec/${shortname}-${version}
                  file copy ${worksrcpath}/register.sh \
                            ${destroot}${prefix}/libexec/${shortname}-${version}
                  file copy ${worksrcpath}/unregister.sh \
                            ${destroot}${prefix}/libexec/${shortname}-${version}
                 }

post-activate	{ system "${prefix}/libexec/${shortname}-${version}/register.sh" }

#pre-deactivate	{ system "${prefix}/libexec/${shortname}-${version}/unregister.sh" }

