# -*- 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$

PortSystem 1.0

name                    mit-scheme
epoch                   1
version                 9.2
revision                2
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  a8028230d500855fe1864e2ad7f8210810296ec5 \
                        sha256  4f6a16f9c7d4b4b7bb3aa53ef523cad39b54ae1eaa3ab3205930b6a87759b170

depends_lib \
    port:xorg-libX11 \
    port:ncurses \
    path:lib/libssl.dylib: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.]+)/}