# $Id: Portfile 92856 2012-05-09 05:44:27Z jmr@macports.org $

PortSystem 1.0
name		hs-plugins
epoch		20050407
version		20050407
revision	1
categories	devel
maintainers	nomaintainer
platforms	darwin

#bugs		Now builds from a snapshot to be compatible with
#		ghc-6.4.  The previous 0.9.8 release was incompatible
#		with the new library packing system introduced with
#		6.4, the Common Architecture for Builing Applications
#		and Libraries (Cabal).  Will track releases again once
#		support for ghc-6.4 is introduced.

description	A plugin library for Haskell
long_description	\
		hs-plugins was originally designed as a system		\
		for replacing all the various configuration languages	\
		in existence (particularly mutt and vim) but developed	\
		to be very suitable for plugins in general.

homepage	http://www.cse.unsw.edu.au/~dons/hs-plugins/hs-plugins.html
master_sites	ftp://ftp.cse.unsw.edu.au/pub/users/dons/hs-plugins/snapshots

checksums	md5 c53af7d0563a8473da41c940e20922f3

depends_build	bin:ghc:ghc

patchfiles	src_build.mk.patch

use_autoconf	yes

destroot.destdir	PREFIX=${destroot}${prefix}

post-activate	{

		  # start by unregistering old versions

		  system "cd ${worksrcpath} && ghc-pkg -r printf  || true"
		  system "cd ${worksrcpath} && ghc-pkg -r eval    || true"
		  system "cd ${worksrcpath} && ghc-pkg -r plugins || true"
		  system "cd ${worksrcpath} && ghc-pkg -r hi      || true"
		  system "cd ${worksrcpath} && ghc-pkg -r altdata || true"

		  system "cd ${worksrcpath} && PREFIX=${prefix} LIBDIR=${prefix}/lib/${name} ghc-pkg -u < src/altdata/altdata.conf.in"
		  system "cd ${worksrcpath} && PREFIX=${prefix} LIBDIR=${prefix}/lib/${name} ghc-pkg -u < src/hi/hi.conf.in"
		  system "cd ${worksrcpath} && PREFIX=${prefix} LIBDIR=${prefix}/lib/${name} ghc-pkg -u < src/plugins/plugins.conf.in"
		  system "cd ${worksrcpath} && PREFIX=${prefix} LIBDIR=${prefix}/lib/${name} ghc-pkg -u < src/eval/eval.conf.in"
		  system "cd ${worksrcpath} && PREFIX=${prefix} LIBDIR=${prefix}/lib/${name} ghc-pkg -u < src/printf/printf.conf.in"

		  system "ranlib ${prefix}/lib/${name}/libHSplugins.a"
		  system "ranlib ${prefix}/lib/${name}/libHShi.a"
		  system "ranlib ${prefix}/lib/${name}/libHSaltdata.a"
		  system "ranlib ${prefix}/lib/${name}/libHSeval.a"
		  system "ranlib ${prefix}/lib/${name}/libHSprintf.a"
		}
