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

github.setup        diku-dk smlpkg 0.1.5 v
revision            0
categories          devel ml
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
license             MIT
description         Generic package manager for Standard ML libraries and programs
long_description    This program constitutes a generic package manager for Standard ML libraries and programs. \
                    The package manager assumes nothing and knows nothing about the Standard ML compilers used and is thus quite generic. \
                    The package manager is centered around the notion of semantic versioning and currently supports packages hosted on GitHub and GitLab. \
                    The package manager takes care of downloading and upgrading dependent packages and works well with the use of MLB files \
                    supported by Standard ML compilers such as MLton, MLKit and SMLtoJs.
checksums           rmd160  68f0b5550fb1eb67e35529526287c99860b04545 \
                    sha256  53440d8b0166dd689330fc686738076225ac883a00b283e65394cf9312575c33 \
                    size    32592
github.tarball_from archive

depends_build-append \
                    port:mlton
depends_run-append  port:mlton

patchfiles-append   patch-makefile.diff

post-patch {
    reinplace "s,@PREFIX@,${prefix}," ${worksrcpath}/Makefile
    reinplace "s,@DESTDIR@,${destroot}${prefix}," ${worksrcpath}/Makefile
}

build.env-append    MLCOMP=${prefix}/bin/mlton

test.env-append     MLCOMP=${prefix}/bin/mlton

test.run            yes
test.target         test

# MLton is not universal.
universal_variant   no

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} LICENSE README.md ${destroot}${docdir}
}

# See also: https://github.com/diku-dk/smlpkg/issues/8
notes "
SMLPKG is almost a complete port of Haskell Futhark package manager.
Design description of the latter can be found here:
https://futhark-lang.org/blog/2018-08-03-the-present-futhark-package-manager.html
"
