# -*- 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           qmake5 1.0
PortGroup           github 1.0

github.setup        Swordfish90 cool-retro-term 1.2.0
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            1

categories          aqua shells
license             GPL-3+
maintainers         {amake @amake} openmaintainer

description         A good looking terminal emulator which mimics the old cathode display

long_description    A terminal emulator which mimics the look and feel of the \
                    old cathode tube screens. It has been designed to be \
                    eye-candy, customizable, and reasonably lightweight.

set dep_name        qmltermwidget
set dep_version     63228027e1f97c24abb907550b22ee91836929c5
set dep_distname    ${dep_name}-${dep_version}

master_sites        ${github.master_sites}:main \
                    https://github.com/${github.author}/${dep_name}/tarball/${dep_version}:dep

distfiles           ${distname}${extract.suffix}:main \
                    ${dep_distname}${extract.suffix}:dep

checksums           ${distname}${extract.suffix} \
                        rmd160  af3d0847a9091d4f75a7748c289e51639f5813c8 \
                        sha256  f47a3140562c78dfd1af28748f15ff3b828e9e13920ce4b3b4414751b3e074dd \
                        size    1996578 \
                    ${dep_distname}${extract.suffix} \
                        rmd160  339f4f0442b3386a5103f4309302ceb8c9dfa4a1 \
                        sha256  97cfb66b845160854783da9d9bbab7540143a29237e50215331ee8dac6c4a901 \
                        size    234929

qt5.depends_component   qtquickcontrols qtquickcontrols2
qt5.depends_runtime_component   sqlite-plugin

# Work around "Failed to restore metadata" on file
# "app/qml/fonts/modern-pro-font-win-tweaked/Comments for ProFontWindows"
extract.post_args-append    || true

post-extract {
    # Since we have customized master_sites, we don't get the benefit of the
    # github-1.0 PortGroup's path finagling, so we do it ourselves.
    move [glob ${workpath}/${github.author}-${github.project}-*] ${worksrcpath}
    delete ${worksrcpath}/${dep_name}
    # qmltermwidget is a git submodule in the upstream repo, but it disappears
    # in the tarball so we put it into place here.
    move [glob ${workpath}/${github.author}-${dep_name}-*] ${worksrcpath}/${dep_name}
}

# Fixes errors like "Could not resolve SDK Path for 'macosx12' using --show-sdk-path"
# See https://trac.macports.org/ticket/62934#comment:18
use_xcode           yes

destroot {
    xinstall -d ${destroot}${applications_dir}
    copy ${worksrcpath}/${name}.app ${destroot}${applications_dir}
    set plugins_dir ${destroot}${applications_dir}/${name}.app/Contents/PlugIns
    xinstall -d ${plugins_dir}
    copy ${worksrcpath}/${dep_name}/QMLTermWidget ${plugins_dir}
}

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