# -*- 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               cmake 1.1
PortGroup               github 1.0
PortGroup               legacysupport 1.1

# clock_gettime
legacysupport.newest_darwin_requires_legacy 16

github.setup            atomvm atomvm 0.6.5 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from     tarball
revision                0
epoch                   1
categories              erlang devel
maintainers             {pguyot @pguyot} openmaintainer
license                 Apache-2

description             Tiny Erlang VM
long_description        AtomVM implements from scratch a minimal Erlang VM that \
                        supports a subset of ErlangVM features and that is able to \
                        run unmodified BEAM binaries on really small systems like \
                        MCUs.

checksums               rmd160  760fe585cebcd54bd21777d208bce504e483e7a9 \
                        sha256  5469c367a44f618b8c5a0bfa1f0f9dc74bbb2e498591311fcf19f033f912c9d6 \
                        size    1061634

cmake.generator         Ninja

depends_build-append    port:erlang \
                        port:elixir \
                        port:gperf
depends_lib-append      port:mbedtls3

# https://github.com/atomvm/AtomVM/pull/1255
patchfiles-append       0001-otp_net.c-use-EAI_OVERFLOW-when-it-is-defined.patch

# CMake Error at src/platforms/generic_unix/CMakeLists.txt:25 (target_compile_features):
# target_compile_features The compiler feature "c_std_11" is not known to C compiler
compiler.c_standard     2011
# CMake Error at src/libAtomVM/CMakeLists.txt:155 (message):
# Platform doesn't support atomic pointers
compiler.blacklist-append {clang < 900}

test.run                yes
test.cmd                tests/test-erlang && \
                        tests/test-enif && \
                        tests/test-mailbox && \
                        tests/test-structs && \
                        src/AtomVM ./tests/libs/estdlib/test_estdlib.avm && \
                        src/AtomVM ./tests/libs/eavmlib/test_eavmlib.avm && \
                        src/AtomVM ./tests/libs/alisp/test_alisp.avm && \
                        src/AtomVM ./tests/libs/exavmlib/Tests.avm
test.target             {}
