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

# strnlen
legacysupport.newest_darwin_requires_legacy 10

github.setup        wasm3 wasm3 0.5.0 v
github.tarball_from archive
revision            0

description         \
    A fast WebAssembly interpreter, and the most universal WASM runtime

long_description    {*}${description}

checksums           rmd160  b21b0de54d74c928f2424ebf1985069d034e0d9a \
                    sha256  b778dd72ee2251f4fe9e2666ee3fe1c26f06f517c3ffce572416db067546536c \
                    size    2582080

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

depends_build-append \
                    port:git

# cc1: error: unrecognized command line option "-Wjump-misses-init"
compiler.blacklist-append \
                    *gcc-4.0 *gcc-4.2

set luv_ver         1.40

post-configure {
    # Sources of libuv are fetched during configure, so magic is needed.
    system -W ${cmake.build_dir}/_deps/libuv-src "patch -p0 < [shellescape ${filespath}/patch-libuv-${luv_ver}.diff]"
}

configure.args-append \
                    -DBUILD_NATIVE=OFF \
                    -DBUILD_WASI=uvwasi

destroot {
    xinstall -m 0755 ${cmake.build_dir}/${name} ${destroot}${prefix}/bin/
}
