# $Id: Portfile 84907 2011-10-04 14:47:13Z and.damore@macports.org $

PortSystem          1.0

name                clojure-devel
conflicts           clojure
version             1.1.0-rc2
revision            0
categories          lang java
maintainers         ieure
description         The Clojure programming language (development version)
long_description    Clojure is a dynamic programming language for the JVM. \
                    It is interactive, yet compiled, with a robust \
                    infrastructure for concurrency. It is a functional \
                    dialect of Lisp, with a rich set of immutable, \
                    persistent data structures and a macro system.
homepage            http://clojure.org/
platforms           darwin

fetch.type          git
git.url             git://github.com/richhickey/clojure.git
git.branch          d548cf2078846ec06336d2357435bb87959281e1



use_configure       no
build.cmd           ant
build.target        jar

variant readline conflicts rlwrap description {Use readline support} {
    depends_run-append port:jline
}

variant rlwrap conflicts readline description {Use rlwrap support for tab completion, parenthesis matching} {
    depends_run-append port:rlwrap
}

destroot {
    set javadir ${destroot}${prefix}/share/java
    set clojuredir ${javadir}/clojure
    set clojurejar ${clojuredir}/lib/clojure.jar
    set clojurebin ${clojuredir}/bin/clj
    set clojurelink ${prefix}/share/java/clojure/bin/clj
    set clojuresh clj.sh
    set bindir ${destroot}${prefix}/bin
    
    if {[variant_isset readline]} {
        set clojuresh clj-jline.sh
    }
    
    if {[variant_isset rlwrap]} {
        set clojuresh clj-rlwrap.sh
    }
    
    xinstall -m 0755 -d ${javadir}
    xinstall -m 0755 -d ${clojuredir}
    xinstall -m 0755 -d ${clojuredir}/lib
    xinstall -m 0755 -d ${clojuredir}/bin
    xinstall -m 0644 -W ${worksrcpath} clojure-${version}.jar ${clojurejar}
    xinstall -m 0755 -W ${filespath} ${clojuresh} ${clojurebin}
    
    if {[variant_isset rlwrap]} {
        xinstall -m 0644 -W ${filespath} .clj_completions  ${clojuredir}/.clj_completions
    }
    
    ln -s ${clojurelink} ${bindir}/clj
}
