# -*- 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        teodimoff curves f97e0569491439f6e63f3b00559689fbfbc5d261
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
version             20220312
revision            0

checksums           rmd160  04c9c5f697eb85bc1d8fa26d00cd87b84e176520 \
                    sha256  d7af1257007e612d4a70ad9ecb13ba265716e7509b64b3ac82a149e7c1f7eb66 \
                    size    7825641

categories          math graphics
license             Apache-2
maintainers         nomaintainer

description         Curves provide mapping a point from 1D to 2D hilbert space.
long_description    Curves provide Hilbert mapping of a point from 1D to 2D hilbert space. \
                    This means that points closer together from one dimentional space are closer in the other. \
                    In other words it preserves locality.

# 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        hashdrawNative/nativeLink

build.pre_args-prepend \
                    "'set (hashdraw.native / nativeCompileOptions) := \"${configure.cppflags}\".split(\" \").toSeq'" \
                    "'set (hashdraw.native / nativeLinkingOptions) := \"${configure.ldflags}\".split(\" \").toSeq'"

depends_build-append \
                    port:sbt

depends_lib-append  port:libsdl2

set curves_out ${worksrcpath}/example/hashdraw/native/target/scala-2.13/hashdraw-out

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

test.run            yes
test.cmd            ${curves_out}
test.target         -h

github.livecheck.branch main
