# -*- 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
PortGroup           java 1.0

name                leiningen
version             2.11.2
categories          devel java
maintainers         {easieste @easye} openmaintainer
supported_archs     noarch
platforms           any
license             EPL-1

description         A build tool for Clojure designed to not set your hair on fire.
long_description    {*}${description}

homepage            https://leiningen.org

master_sites \
    https://codeberg.org/leiningen/leiningen/archive/:source \
    https://codeberg.org/leiningen/leiningen/releases/download/${version}/:standalone

distfiles           \
    ${version}.tar.gz:source \
    leiningen-${version}-standalone.jar:standalone

checksums           \
    ${version}.tar.gz \
                    rmd160  71b8d47aecc3b7964dbfcbe4f5c604fb1b219e9a \
                    sha256  b8dd330040ed473183fbc4a8bc404ec54f92f818172e0c3996d7c65ab7940a1e \
                    size    981415 \
    leiningen-${version}-standalone.jar \
                    rmd160  a7df0926cf959007a6d9fd67fda7a4da594db382 \
                    sha256  7d31ae23ae769e927438b0cd55d15a93e7dabab09fd4fc15877979161e108774 \
                    size    16481883

java.version    1.8+

extract.only    ${version}.tar.gz

worksrcdir      ${name}
use_configure   no

set javadir       ${prefix}/share/java/leiningen
set lein_jar_dest ${javadir}/leiningen-${version}-standalone.jar

build {
    reinplace -E  "s|^LEIN_JAR=.*$|LEIN_JAR=${lein_jar_dest}|" ${worksrcpath}/bin/lein-pkg
}

destroot {
    xinstall -m 0755 -d ${destroot}${javadir}
    xinstall -m 0755 ${worksrcpath}/bin/lein-pkg ${destroot}${prefix}/bin/lein
    xinstall -m 0644 ${distpath}/leiningen-${version}-standalone.jar ${destroot}${lein_jar_dest}
}