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

github.setup        AppleCommander bastools 0.4.0 v
revision            0
checksums           ${name}-tools-bt-${version}.jar \
                    rmd160  3aa6d8d45e5cea9663c4a8a9044d4ac29f5a5217 \
                    sha256  7e82acfbc2413223dcd7a9f0bfcba9ec9bd92d7ddc369f6256e606c96bed63b1 \
                    size    734316 \
                    ${name}-tools-st-${version}.jar \
                    rmd160  c8e5c9a261e75fd3e1e9ffb483f5734cb0f85422 \
                    sha256  b21e0738bce22211333040c2340c385472df66a99429eacabaed1a7676756938 \
                    size    1500039

categories          lang
platforms           any
maintainers         {ryandesign @ryandesign} openmaintainer
# TODO: Update when clarified in https://github.com/AppleCommander/bastools/issues/23
license             GPL-3
supported_archs     noarch

description         Applesoft BASIC tokenizer and shape table utility

long_description    ${name} provides command line utilities for \
                    Applesoft BASIC: bt, a BASIC tokenizer and \
                    optimizer, and st, for working with shape tables.

github.tarball_from releases

distfiles           ${name}-tools-bt-${version}.jar \
                    ${name}-tools-st-${version}.jar

extract.only

post-extract {
    copy ${filespath}/bt.in ${workpath}/bt
    copy ${filespath}/st.in ${workpath}/st
}

set javadir         ${prefix}/share/java/${name}

post-patch {
    reinplace -W ${workpath} "s|@JAVADIR@|${javadir}|g;s|@VERSION@|${version}|g" bt st
}

use_configure       no

build {}

destroot {
    xinstall -W ${workpath} bt st ${destroot}${prefix}/bin/
    xinstall -d ${destroot}${javadir}
    xinstall -m 0644 -W ${distpath} \
        ${name}-tools-bt-${version}.jar \
        ${name}-tools-st-${version}.jar \
        ${destroot}${javadir}
}
