# $Id: Portfile,v 1.33 2006/07/16 06:13:29 jkh Exp $

PortSystem 1.0
name		sbcl
version		0.9.14
set bootversion 0.9.11
categories	lang
maintainers	gwright@opendarwin.org waqar@opendarwin.org
platforms	darwin
description	The Steel Bank Common Lisp system
long_description	\
		Steel Bank Common Lisp (SBCL) is a Open Source		\
		development system for ANSI Common Lisp. It provides an	\
		interactive environment including an integrated native	\
		compiler, interpreter, and debugger. (And it, and its	\
		generated code, can also play nicely with Unix when	\
		running noninteractively.)

homepage	http://www.sbcl.org
master_sites	sourceforge
use_bzip2	yes

platform powerpc { 
		   distfiles-append ${name}-${bootversion}-powerpc-darwin-binary${extract.suffix}
		   checksums-append ${name}-${bootversion}-powerpc-darwin-binary${extract.suffix} \
			md5 1d83aad72b16110f053f4fbdcb4e1a52

		   global host_lisp
		   set host_lisp	"\"${workpath}/${name}-${bootversion}-powerpc-darwin/src/runtime/sbcl --core ${workpath}/${name}-${bootversion}-powerpc-darwin/output/sbcl.core --disable-debugger --sysinit /dev/null --userinit /dev/null\" "
}

platform i386     {
		   distfiles-append ${name}-${bootversion}-x86-darwin-binary${extract.suffix}
		   checksums-append ${name}-${bootversion}-x86-darwin-binary${extract.suffix} \
			md5 46aae27e05750e08546ad5aeda766d1e

		   global host_lisp
		   set host_lisp	"\"${workpath}/${name}-${bootversion}-x86-darwin/src/runtime/sbcl --core ${workpath}/${name}-${bootversion}-x86-darwin/output/sbcl.core --disable-debugger --sysinit /dev/null --userinit /dev/null\" "
}

		
distfiles	${name}-${version}-source${extract.suffix}

distname	${name}-${version}-source
worksrcdir	${name}-${version}

checksums	${name}-${version}-source${extract.suffix}		\
			md5 d37a369e387286a0ceca51dbd8d1b173

patchfiles	patch-Config.x86-darwin patch-Config.ppc-darwin

post-patch	{ reinplace "s|/usr/local/lib/${name}|${prefix}/lib/${name}|g" \
                            ${worksrcpath}/src/runtime/runtime.c
		  reinplace "s|/usr/local/lib/${name}|${prefix}/lib/${name}|g" \
                            ${worksrcpath}/doc/sbcl.1
		}

use_configure	no


build		{ cd ${worksrcpath}
		  system "ulimit -s 8192"

		  system "unset LD_PREBIND && unset LD_PREBIND_ALLOW_OVERLAP && sh make.sh ${host_lisp}"
		}

default_variants	+test

variant test	{ test.run	yes
		  test.dir	${worksrcpath}/tests
		  test.cmd	sh
		  test.target	run-tests.sh
		}

destroot	{ cd ${worksrcpath}
		  system "INSTALL_ROOT=${destroot}/${prefix} sh install.sh"
		}

