# $Id: Portfile 53527 2009-07-07 16:42:36Z jmr@macports.org $

PortSystem 1.0
name		openmcl
version		1.0
revision	1
categories	lang
maintainers	waqar gwright
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 \
		Mac OS 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		{
		  system "cd ${workpath}/ccl/lisp-kernel/darwin && make"
		  system "cd ${workpath}/ccl && echo '(ccl::xload-level-0 :force)' | ./dppccl --batch"
		  system "cd ${workpath}/ccl && echo '(ccl::compile-ccl)' | ./dppccl --batch"
		  system "cd ${workpath}/ccl && echo '(ccl::save-application \"dppccl.image\")' | \
	          ./dppccl --batch --image-name ppc-boot.image"
		}

destroot	{
		  file mkdir ${destroot}${prefix}/share/${name}/${version}
		  system "cd ${workpath}/ccl && 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"

		  ui_msg "******************************************************"
		  ui_msg " The OpenMCL port is deprecated and will be removed."
		  ui_msg "Please use the ccl (Clozure Common Lisp) port instead."
		  ui_msg "******************************************************"
		  ui_msg ""
		}

