# -*- 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           cargo   1.0
PortGroup           github  1.0

github.setup        wasmerio wasmer 4.3.7 v
github.tarball_from archive
revision            0

homepage            https://wasmer.io

description         \
    The leading WebAssembly Runtime supporting WASI and Emscripten

long_description    \
    Wasmer is a fast and secure WebAssembly runtime that enables super \
    lightweight containers to run anywhere: from Desktop to the Cloud, Edge \
    and IoT devices.

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

checksums           rmd160  b7d2eeebf31ffbdec14893abc86c12d0006daccb \
                    sha256  9bbbac3845888ee709c8b160fdefb0fe808f2cff23033464629e39a69f4694f8 \
                    size    112256803

build.cmd           make
build.pre_args      {}
build.args          build-wasmer build-capi

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

destroot {
    xinstall -m 0755 \
        ${worksrcpath}/target/[cargo.rust_platform]/release/${name} \
        ${destroot}${prefix}/bin/

    xinstall \
        ${worksrcpath}/target/[cargo.rust_platform]/release/lib${name}.dylib \
        ${destroot}${prefix}/lib/

    xinstall \
        ${worksrcpath}/target/[cargo.rust_platform]/release/lib${name}.a \
        ${destroot}${prefix}/lib/

    xinstall -m 0444 \
        ${worksrcpath}/lib/c-api/tests/wasm-c-api/include/wasm.h \
        ${worksrcpath}/lib/c-api/wasmer.h \
        ${worksrcpath}/lib/c-api/wasmer_wasm.h \
        ${destroot}${prefix}/include/
}

post-destroot {
    system -W ${destroot}${prefix} \
        "sh -c 'WASMER_DIR=${prefix} ./bin/${name} config --pkg-config > ${destroot}${prefix}/lib/pkgconfig/${name}.pc'"
}
