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

github.setup        berry-lang berry 1.1.0 v
github.tarball_from archive
revision            0

homepage            https://berry-lang.github.io/

description         \
    An ultra-lightweight embedded scripting language optimized for \
    microcontrollers.

long_description    \
    Berry is an ultra-lightweight dynamically typed embedded scripting \
    language. It is designed for lower-performance embedded devices. The \
    Berry interpreter-core's code size is less than 40KiB and can run on less \
    than 4KiB heap \(on ARM Cortex M4 CPU, Thumb ISA and ARMCC compiler\). \
    The interpreter of Berry includes a one-pass compiler and register-based \
    VM. All the code is written in ANSI C99.

checksums           rmd160  0f5a34cef7681e1f4b3385238c12615146bd013d \
                    sha256  b8eb94a44378ecd2f281cf7e244b8617b99f51d500638622b6126e60e730a693 \
                    size    189282

categories          lang devel
installs_libs       no
license             MIT
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

set python_ver      311
set python_branch   \
    [string index ${python_ver} 0].[string range ${python_ver} 1 end]
set python_bin      ${prefix}/bin/python${python_branch}

patchfiles-append   patch-Makefile.diff

compiler.c_standard 1999

depends_build-append \
                    port:python${python_ver}

build.pre_args-append \
                    PYTHON=${python_bin}

post-patch {
    reinplace -E \
        "s|#! /usr/bin/env python3|#!${python_bin}|" \
        ${worksrcpath}/tools/coc/coc
}

post-destroot {
    xinstall -d ${destroot}${prefix}/share/${name}
    copy ${worksrcpath}/examples ${destroot}${prefix}/share/${name}/
}
