# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 90606 2012-03-09 21:21:00Z dports@macports.org $

PortSystem 1.0

name                    mit-scheme
epoch                   1
version                 9.1.1
categories              lang
license                 {GPL-2+ OpenSSLException}
platforms               darwin
maintainers             dports openmaintainer

description             MIT/GNU Scheme

long_description        MIT/GNU Scheme is an implementation of the \
                        Scheme programming language, providing an \
                        interpreter, compiler, source-code debugger, \
                        integrated Emacs-like editor, and a large \
                        runtime library. MIT/GNU Scheme is best suited \
                        to programming large applications with a rapid \
                        development cycle.

homepage                http://www.gnu.org/software/mit-scheme/
master_sites            gnu:${name}/stable.pkg/${version}/
distname                ${name}-c-${version}

checksums               rmd160  e0691d673c0bd423beff438009090dc9069bf1a6 \
                        sha256  32705fc0e668870e79fbbcfe8ed4427e3d2e0cad466f8eb9f10fafceff54945d

depends_lib \
    port:xorg-libX11 \
    port:ncurses \
    port:openssl

post-patch  {
    reinplace "s|/usr/local|${prefix}|g" \
        ${worksrcpath}/doc/configure \
        ${worksrcpath}/doc/ref-manual/os-interface.texi \
        ${worksrcpath}/doc/scheme.1 \
        ${worksrcpath}/doc/user-manual/user.texinfo \
        ${worksrcpath}/src/6001/edextra.scm \
        ${worksrcpath}/src/6001/floppy.scm \
        ${worksrcpath}/src/compiler/documentation/porting.guide \
        ${worksrcpath}/src/compiler/etc/disload.scm \
        ${worksrcpath}/src/configure \
        ${worksrcpath}/src/edwin/techinfo.scm \
        ${worksrcpath}/src/edwin/unix.scm \
        ${worksrcpath}/src/lib/include/configure \
        ${worksrcpath}/src/lib/include/option.c \
        ${worksrcpath}/src/README.txt \
        ${worksrcpath}/src/swat/c/tk3.2-custom/Makefile \
        ${worksrcpath}/src/swat/c/tk3.2-custom/tcl/Makefile \
        ${worksrcpath}/src/swat/scheme/other/btest.scm

    if {[vercmp $xcodeversion 4.3] >= 0} {
        set sdks_dir "${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs"
        reinplace "s|MACOSX_SYSROOT=/Developer/SDKs/|MACOSX_SYSROOT=${sdks_dir}/|" \
            ${worksrcpath}/src/configure \
            ${worksrcpath}/src/microcode/configure
    }
}

use_configure           no

use_parallel_build      no

destroot.cmd            ${build.cmd}

build.dir               ${worksrcpath}/src
build.cmd               etc/make-liarc.sh
build.args              --prefix=${prefix}
build.target
build.env               CC=${configure.cc} CFLAGS="${configure.cflags} ${configure.cc_archflags}"

livecheck.url           http://ftp.gnu.org/gnu/${name}/stable.pkg/
livecheck.type          regex
livecheck.regex         {([0-9.]+)/}
