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

github.setup        indoorvivants sn-demangler 0.1.0 v
revision            0
github.tarball_from archive

checksums           rmd160  fb6a616aa7e64148ba956f25fcce16031e62335c \
                    sha256  a6fafef99ab801805a4c10a88e994a964a058463537b2f9b1af61e9b9908a2bb \
                    size    11352

categories          devel
license             Apache-2
maintainers         nomaintainer

description         Scala Native name demangler
long_description    ${description}

# Required java version
java.version        1.8+
# LTS JDK port to install if required java not found
java.fallback       openjdk11

use_configure       no

# Scala-Native requires clang 6+ or apple's clang 8+
compiler.blacklist  *gcc* {clang < 800} {macports-clang-3.[0-9]} {macports-clang-[4-5].0}

# needs MAP_ANONYMOUS, linkat and symlinkat
legacysupport.newest_darwin_requires_legacy 14

legacysupport.use_mp_libcxx yes

build.env-append    SBT_OPTS=-Duser.home=${workpath}/.home \
                    CLANG_PATH=${configure.cc} \
                    CLANGPP_PATH=${configure.cxx}

build.cmd           ${prefix}/bin/sbt
build.target        buildReleaseBinary

depends_build-append \
                    port:sbt

set sn_demangler_out ${worksrcpath}/out/release/app

destroot {
    set bindir ${destroot}${prefix}/bin
    xinstall -m 0755 -d ${bindir}
    xinstall -m 0755 ${sn_demangler_out} ${bindir}/${name}
}

test.run            yes
test.cmd            ${sn_demangler_out}
test.target         -s
test.args           {'_SM36scala.scalanative.runtime.BoxedUnit$G8instance' '_SM34scala.scalanative.runtime.package$D16throwNullPointernEO'}


