# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 115941 2014-01-14 21:55:00Z jmr@macports.org $

PortSystem          1.0

name                gcl
version             2.6.7
revision            1
categories          lang
license             GPL-2+
platforms           darwin
maintainers         nomaintainer

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.
homepage            http://www.gnu.org/software/gcl

depends_lib         port:gettext \
                    port:gmp \
                    port:readline

master_sites        gnu
checksums           md5 c0f42e1f391162e5ac90912a70e8ecc3 \
                    sha1 d54f7db5dbd9f49953f80259a5eb44ade65027b5

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

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

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

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

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

use_parallel_build no

variant x11 {
    configure.args-replace --without-x --with-x
}
