# $Id: Portfile,v 1.17 2006/01/28 22:06:27 gwright Exp $

PortSystem 1.0
name		openmcl
version		1.0
revision	1
categories	lang
maintainers	waqar@opendarwin.org gwright@opendarwin.org
platforms	darwin
description	The OpenMCL Common Lisp Implementation
long_description \
		OpenMCL is an opensourced Common Lisp implementation,	\
		derived from Digitool's Macintosh Common Lisp product.	\
									\
		OpenMCL currently runs under LinuxPPC and, as of	\
		version 0.10, under Darwin, the BSD/Mach layer on which \
		MacOS X is based. 

homepage	http://www.openmcl.com
master_sites	ftp://clozure.com/pub \
		http://clozure.com/openmcl/ftp

distfiles	${name}-darwinppc-all-${version}${extract.suffix}

set prefixpath	\\\"[regsub -all / [strsed ${prefix}/share/asdf-install {g/^\///}] "\\\" \\\""]\\\"

checksums	md5  7e8b584100d0a2b8cb438b29bd891505			\
		sha1 10e0d3922462fc11d18c334ca542b668b793bce9

configure	{
		  reinplace "s|-traditional-cpp|-no-cpp-precomp|g" 	\
		  ${workpath}/ccl/lisp-kernel/darwin/Makefile
		}

build		{
		  cd ${workpath}/ccl/lisp-kernel/darwin
		  system "make"
		  cd ${workpath}/ccl
		  system "echo '(ccl::xload-level-0 :force)' | ./dppccl --batch"
		  system "echo '(ccl::compile-ccl)' | ./dppccl --batch"
		  system "echo '(ccl::save-application \"dppccl.image\")' | \
	          ./dppccl --batch --image-name ppc-boot.image"
		}

destroot	{
		  file mkdir ${destroot}/${prefix}/share/${name}/${version}
		  cd ${workpath}/ccl
		  system "tar cf - . | ( cd ${destroot}/${prefix}/share/${name}/${version} && tar xf -)"
		  reinplace "s|/usr/local/src/ccl|${prefix}/share/${name}/${version}|" \
		  ${workpath}/ccl/scripts/openmcl
		  system "chmod +x ${workpath}/ccl/scripts/openmcl"
		  file copy ${workpath}/ccl/scripts/openmcl ${destroot}/${prefix}/bin
		  reinplace "s|\"usr\" \"local\" \"asdf-install\")))))|${prefixpath})))))|" \
		  ${destroot}/${prefix}/share/${name}/${version}/tools/asdf-install/installer.lisp
		}

post-activate	{
		  # Prepare asdf install folders and so forth.
                  file mkdir ${prefix}/share/asdf-install
                  system "chgrp admin ${prefix}/share/asdf-install"
                  system "chmod g+w ${prefix}/share/asdf-install"
		}

