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

PortSystem          1.0

name                clojure
epoch               20110929
version             1.12.2.1571
revision            0
license             EPL-1
categories          lang java
maintainers         {gmail.com:jtrtik @jtrtik} openmaintainer
description         The Clojure programming language
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            https://clojure.org
platforms           any
supported_archs     noarch
master_sites        https://download.clojure.org/install/
distname            clojure-tools-${version}
worksrcdir          clojure-tools
checksums           rmd160  d493cee4fd29b58ba2efa2f6c6d9faa12bc00ac8 \
                    sha256  b81149ed66d4cf62c8dff57a48b67a4b673bef4ee3f70c4fbf958e99a95c9efe \
                    size    15352090
use_configure       no
build               {}

destroot {
    set bin_dir ${prefix}/bin
    set man_dir ${prefix}/share/man/man1
    set clojure_lib_dir ${prefix}/lib/${name}
    set clojure_libexec_dir ${clojure_lib_dir}/libexec

    xinstall -d ${destroot}${clojure_lib_dir}
    xinstall -m 644 -W ${worksrcpath} deps.edn example-deps.edn tools.edn ${destroot}${clojure_lib_dir}

    xinstall -d ${destroot}${clojure_libexec_dir}
    xinstall -m 0644 -W ${worksrcpath} ${distname}.jar exec.jar ${destroot}${clojure_libexec_dir}

    reinplace "s|PREFIX|${clojure_lib_dir}|g" ${worksrcpath}/clojure
    reinplace "s|BINDIR|${bin_dir}|g" ${worksrcpath}/clj
    xinstall -d ${destroot}${bin_dir}
    xinstall -m 0755 -W ${worksrcpath} clojure clj ${destroot}${bin_dir}

    xinstall -d ${destroot}${man_dir}
    xinstall -m 0644 -W ${worksrcpath} clojure.1 clj.1 ${destroot}${man_dir}
}

notes "Install the rlwrap port and invoke `clj` for more a more ergonomic REPL."

livecheck.type      regex
livecheck.url       https://api.github.com/repos/clojure/brew-install/releases?per_page=200
livecheck.regex     {\"name\":\s+\"(\d\.\d\d\.\d+\.\d+)\"}
