# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0

name                mksh
version             R59c
revision            0
categories          shells
platforms           darwin
maintainers         {mps @Schamschula} openmaintainer
license             BSD

description         A free implementation of the Korn Shell programming language
long_description    A free implementation of the Korn Shell programming language and \
                    a successor to the Public Domain Korn Shell (pdksh).

homepage            https://www.mirbsd.org/mksh.htm
master_sites        https://www.mirbsd.org/MirOS/dist/mir/mksh/

extract.suffix      .tgz
worksrcdir          ${name}

checksums           rmd160  fd4160e431aaf471aa56029b557b0c446f3aa33b \
                    sha256  77ae1665a337f1c48c61d6b961db3e52119b38e58884d1c89684af31f87bc506 \
                    size    442736

post-extract {
    file attributes ${worksrcpath}/Build.sh -permissions a+x
}

use_configure       no

variant universal {}

build.cmd           ./Build.sh
build.target
if {${build.jobs} > 1} {
    build.args-append -j
}
build.env           CC=${configure.cc} \
                    "CFLAGS=${configure.cflags} [get_canonical_archflags cc]" \
                    CPPFLAGS=${configure.cppflags} \
                    "LDFLAGS=${configure.ldflags} [get_canonical_archflags ld]"

destroot {
    xinstall -d ${destroot}${prefix}/share/doc/mksh/examples/
    xinstall -m 755 ${worksrcpath}/mksh ${destroot}${prefix}/bin
    xinstall -m 644 ${worksrcpath}/dot.mkshrc ${destroot}${prefix}/share/doc/mksh/examples
    xinstall -m 644 ${worksrcpath}/mksh.1 ${destroot}${prefix}/share/man/man1
}

livecheck.type      regex
livecheck.regex     ${name}-(R\[0-9\]+\[a-z\]*)${extract.suffix}
