# $Id: Portfile 77550 2011-04-03 07:38:55Z jmr@macports.org $

PortSystem 1.0
name		gcl
version		2.6.7
revision	1
categories	lang
maintainers	waqar openmaintainer
description	GNU Common Lisp
long_description	\
	GCL is the official Common Lisp for the GNU project. Its design \
	makes use of the system's C compiler to compile to native 	\
	object code, providing for both good performance and facile 	\
	portability. On most platforms, GCL can load native object code \
	modules directly into its lisp core, where they are preserved 	\
	in any custom lisp images produced via the save-system call.
platforms	darwin
homepage       	http://www.gnu.org/software/gcl
master_sites	gnu
checksums	md5 c0f42e1f391162e5ac90912a70e8ecc3			\
		sha1 d54f7db5dbd9f49953f80259a5eb44ade65027b5

depends_lib	port:gettext port:readline port:gmp

patchfiles  configure.diff sbrk.diff
if {${os.major} >= 9 && ${os.platform} == "darwin"} {
    patchfiles-append stack_t.diff
}

post-patch 		{
	reinplace "s|/sw|${prefix}|g" 			\
			${worksrcpath}/h/powerpc-macosx.defs
	reinplace "s|/usr/local/lib|${prefix}/share|g"	\
			${worksrcpath}/info/makefile
	reinplace "s|/usr/share|${prefix}/share|g" 	\
			${worksrcpath}/configure
}

configure.args  --enable-machine=powerpc-macosx	\
		--prefix=${prefix}		\
		--enable-ansi			\
		--disable-statsysbfd 		\
		--disable-locbfd 		\
		--enable-custreloc 		\
		--enable-notify=no		\
		--mandir=${prefix}/share/man 	\
		--infodir=${prefix}/share/info	\
		--enable-infodir=${prefix}/share/info \
		--enable-emacsdir=${prefix}/share/emacs/site-lisp/gcl \
		--enable-readline 		\
		--without-x

if {$build_arch == "x86_64" && ${os.platform} == "darwin"} {
    configure.args-append --build=${build_arch}-apple-${os.platform}${os.version} \
                          --host=${build_arch}-apple-${os.platform}${os.version}
}

post-configure	{
	reinplace "s|./default.el|${prefix}/etc/default.el|g" \
		${worksrcpath}/makedefs \
		${worksrcpath}/makedefc
	reinplace "s|/usr/share|${prefix}/share|g" \
		${worksrcpath}/makedefs \
		${worksrcpath}/makedefc
}

use_parallel_build no

destroot.destdir       DESTDIR=${destroot}

variant x11	{
	configure.args-delete --without-x
	configure.args-append --with-x
}
