# $Id: Portfile 51294 2009-05-22 09:18:21Z toby@macports.org $

PortSystem 1.0
name		cpphs
version		1.3
categories	devel
maintainers	gwright
platforms	darwin
description	cpp implemented in Haskell.
long_description	\
		cpphs is a liberalised re-implementation of cpp,	\
		the C pre-processor, in Haskell.

homepage	http://www.haskell.org/cpphs/
master_sites	http://www.cs.york.ac.uk/fp/${name}/

checksums	md5 fe1f36d1cbc2ca4a8b769d1f9c2f63bc

depends_build	port:ghc

pre-configure	{
		  system "ghc -o ${worksrcpath}/Setup ${worksrcpath}/Setup.hs -package Cabal"
		}

configure	{
		  system "cd ${worksrcpath} && ${worksrcpath}/Setup configure --ghc --prefix=${prefix}"
		}

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

destroot	{ 

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

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

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

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

