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

PortSystem          1.0
PortGroup           perl5 1.0

perl5.require_variant   yes
perl5.conflict_variants yes
perl5.branches          5.28 5.30 5.32 5.34
perl5.default_branch    5.34
perl5.create_variants   ${perl5.branches}

name                vit
version             1.2
revision            6
maintainers         nomaintainer
categories          office
description         Vit is a full-screen terminal interface for Taskwarrior
long_description    ${description} with Vi key bindings and complete support \
                    for native Taskwarrior colorization.

license             GPL-3+
supported_archs     noarch
platforms           any

homepage            https://taskwarrior.org/news/news.20140406.html

master_sites        https://taskwarrior.org/download/

checksums           rmd160  492f50e2f8b3cefb766dd78750a00e69083550ef \
                    sha256  a78dee573130c8d6bc92cf60fafac0abc78dd2109acfba587cb0ae202ea5bbd0 \
                    size    48729

depends_lib         port:p${perl5.major}-curses \
                    port:task

patchfiles          patch-configure.diff \
                    patch-vit.pl.diff

configure.perl      ${perl5.bin}

build.target

post-patch {
    reinplace "s|#!/usr/bin/env perl.*|#!${perl5.bin} -w|g" ${worksrcpath}/vit.pl
}

destroot {
    xinstall -m 775 ${worksrcpath}/vit ${destroot}${prefix}/bin/
    xinstall -m 664 ${worksrcpath}/commands ${destroot}${prefix}/etc/vit-commands

    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -W ${worksrcpath} README LICENSE CHANGES TODO taskrc-gtk+ \
                ${destroot}${prefix}/share/doc/${name}
    xinstall ${worksrcpath}/vit.1 ${destroot}${prefix}/share/man/man1
    xinstall ${worksrcpath}/vitrc.5 ${destroot}${prefix}/share/man/man5
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     ${name}-(\[0-9\]+\.\[0-9\]+)${extract.suffix}
