# -*- 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 84550 2011-09-27 21:05:11Z snc@macports.org $

PortSystem        1.0

name              QiII
version           1.07
revision          1
categories        lang
maintainers       mac.com:quest
platforms         darwin
description       Qi is a functional programming language developed \
                  by Dr Mark Tarver

long_description  Qi is a functional programming language developed \
                  by Dr Mark Tarver and introduced in April 2005. A \
                  new version was reimplemented and issued as Qi II \
                  in November 2008. The first version was free \
                  software, licensed under GPL. But, as GPL was \
                  perceived as unfriendly to commercial use, Qi II \
                  is available via two proprietary licenses: one for \
                  personal and educational use, and another for \
                  producing closed source software. \
                  Qi is written in Lisp. It includes most of the \
                  features common to modern functional programming \
                  languages such as pattern-matching, currying, partial \
                  applications, guards and (optional) static type checking.

homepage          http://www.lambdassociates.org/
master_sites      http://www.lambdassociates.org/Download/
distname          ${name}${version}
use_zip           yes
use_configure     no
supported_archs   noarch

checksums         md5 3a0b5c56d0f107f80f5bca11b82a4d59

depends_build     port:sbcl

set qiii_dir        ${prefix}/share/${name}

build { 
  system "cd ${worksrcpath}/Lisp && ${prefix}/bin/sbcl --load 'install.lsp'"
  reinplace "s|Qi.core|${qiii_dir}/Lisp/Qi.core|g" ${worksrcpath}/Lisp/Qi-Linux-SBCL
  system "cd ${worksrcpath}/Lisp && cat Qi-Linux-SBCL | col -b > Qi-Mac-SBCL"
  file attributes ${worksrcpath}/Lisp/Qi-Mac-SBCL -permissions 0755
}

destroot {
    copy ${worksrcpath} ${destroot}${qiii_dir}
    ln -s ${qiii_dir}/Lisp/Qi-Mac-SBCL ${destroot}${prefix}/bin/Qi
}
