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

github.setup        Bushmills Bashforth ab846dca3f1c4cfdbd60031643dced7ab7e67fd7
version             0.63a
revision            0
checksums           rmd160  2f710f48548863d30ccf856853cb173bccfbe45e \
                    sha256  dde3aac8e4527d9921a3373e867826c76214af49e08972af98f35068e6881342 \
                    size    27803

name                bashforth
categories          lang
platforms           any
maintainers         {ryandesign @ryandesign} openmaintainer
license             GPL-2
supported_archs     noarch

description         a Forth interpreter written in Bash

long_description    Bashforth is a Forth interpreter written entirely in \
                    the Bash scripting language. Its virtual machine makes \
                    use of string threaded code. Because its source code \
                    doesn't need to be compiled, it is highly portable (to \
                    any platform running Bash).

github.tarball_from archive

post-extract {
    set fp [open ${worksrcpath}/bashforth r]
    set file_contents [read ${fp}]
    close ${fp}
    if {[regexp -lineanchor {^version="([^"]+)"$} ${file_contents} -> version_in_file] == 1} {
        if {${version} ne ${version_in_file}} {
            ui_error "version should be ${version_in_file} not ${version}"
            return -code error
        }
    } else {
        ui_error "Could not determine version"
        return -code error
    }
}

use_configure       no

build {}

destroot {
    xinstall ${worksrcpath}/bashforth ${destroot}${prefix}/bin/

    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -W ${worksrcpath} LICENSE README.md ${destroot}${docdir}
}
