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

github.setup        yoshuawuyts vmd 1.34.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            0

description         Preview markdown files

long_description    Preview markdown files in a separate window. Markdown is \
                    formatted exactly the same as on GitHub.

categories          textproc
license             MIT

maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer

checksums           rmd160  16931fc68d1cf07851a62c8e7536d13840b5d210 \
                    sha256  27c5ff27cd6746d2084063cf9931cf63f523ad0b126bff2de25a637562fadc65 \
                    size    697266

depends_build       port:yarn

build.env-append    CSC_IDENTITY_AUTO_DISCOVERY=false

use_configure       no
use_xcode           yes

build {
    # Fetch and build JS dependencies
    system -W ${worksrcpath} "${build.env} yarn install --frozen-lockfile"

    # Build electron app
    system -W ${worksrcpath} "${build.env} yarn pack-mac"
}

destroot {
    copy ${worksrcpath}/build/${name}-darwin-x64/${name}.app \
        ${destroot}${applications_dir}

    ln -s ${applications_dir}/${name}.app/Contents/MacOS/vmd \
        ${destroot}${prefix}/bin/
}

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