# -*- mode: tcl; coding: utf-8; 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            clisp
version         2.49
revision        3
categories      lang
maintainers     easieste openmaintainer
platforms       darwin
license         GPL-2
description     The Clisp Common Lisp Implementation
long_description        \
                CLISP is a Common Lisp implementation by Bruno Haible, \
                formerly of Karlsruhe University, and Michael Stoll, \
                formerly of Munich University, both in Germany. \
                It mostly supports the Lisp described in the \
                ANSI Common Lisp standard. \
                CLISP includes an interpreter, a compiler, almost all \
                of CLOS, a foreign language interface and a socket interface. \
                An X11 interface is available through CLX and Garnet. \
                Command line editing is provided by readline.

homepage        http://clisp.cons.org/
master_sites    gnu:clisp/release/${version}    \
                sourceforge

checksums           md5     1962b99d5e530390ec3829236d168649 \
                    sha1    7e8d585ef8d0d6349ffe581d1ac08681e6e670d4 \
                    rmd160  bfb81abf942b07bbb8d83505f287d546b1bbdacc

depends_lib     port:readline   \
                port:gettext    \
                port:libsigsegv

universal_variant no
use_bzip2       yes
patchfiles      patch-src_lispbibl_d.diff

if {${os.platform} eq "darwin" && ${os.major} >= 14} {
   patchfiles-append patch-src_configure.diff
}

# Enable a subset of architectures due to inline-asm 
supported_archs ppc i386 x86_64

# Works with Xcode 7.0 and macports-clang-3.4
# Failed in Lion (https://trac.macports.org/ticket/33344)
# Assuming {clang < 300}, but please refine if more datapoints become available
compiler.blacklist {clang < 300}

configure.cflags

if {${os.platform} eq "darwin" && ${os.major} >= 11} {
   configure.cflags-append -Wl,-no_pie
}

configure.cc-append  ${configure.cc_archflags}
configure.args      --with-libreadline-prefix=${prefix} \
                    --with-libsigsegv-prefix=${prefix} \
                    --with-libiconv-prefix=${prefix}

use_parallel_build  no
build.dir           ${worksrcpath}/src
build.env-delete    LD_PREBIND LD_PREBIND_ALLOW_OVERLAP
build.cmd           "ulimit -s 16384 && make"
build.target 

test.run            yes
test.target         check

livecheck.type  regex
livecheck.url   http://ftp.gnu.org/gnu/${name}/release/?C=M&O=D
livecheck.regex >(\[0-9.\]+)/<