# -*- 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        alantech alan 0.1.23 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0

categories          lang

license             Apache-2 \
                    AGPL-3

homepage            https://alan-lang.org

description         The Alan Programming Language

long_description    {*}${description}: The alan compiler and runtime can \
                    parallelize your code without concurrent or asynchronous \
                    programming (threads, promises, channels, etc) by only \
                    allowing iteration and recursion that is guaranteed to \
                    halt (e.g. no while (true) \{\} loops)

checksums           rmd160  576762d9ebc416c794b311f0b3ddcf721eb30ed0 \
                    sha256  77b8ed130eb5a99b9cf9f495fb5e0e0fd4a1ab2b78f841097994330d2b807a89 \
                    size    302908

maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

depends_build       port:cargo \
                    port:python27 \
                    port:rust \
                    port:yarn

build.env-append    PATH=${workpath}/bin:$env(PATH)
build.target

use_configure       no
use_parallel_build  no

post-extract {
    file mkdir ${workpath}/bin
    ln -s ${prefix}/bin/python2.7 ${workpath}/bin/python2

    # Replace npm with yarn in the build process
    reinplace "/npm init/ d" ${worksrcpath}/Makefile
    reinplace "s|npm run|yarn run|g" compiler/package.json

    # Don't run the envcheck script
    reinplace {s|\./\.envcheck\.sh|true|g} ${worksrcpath}/Makefile
}

destroot {
    xinstall -m 755 ${worksrcpath}/avm/target/release/${name} \
                    ${destroot}${prefix}/bin/
}

github.livecheck.regex {([0-9.]+)}
