# -*- 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               active_variants 1.1
PortGroup               python 1.0

name                    terminator
version                 1.0
revision                0
checksums               rmd160  95f5a822bc36d57a8162666fe597f05611953bb3 \
                        sha256  88aa09e96591c4fd7ff2765617acee6c9bae9c188db2590652a8aba53bbbdadd \
                        size    881675

categories              sysutils
platforms               {darwin any}
maintainers             {ryandesign @ryandesign} openmaintainer
license                 GPL-2
supported_archs         noarch

description             multiple terminal emulator

long_description        ${name} lets you open multiple terminal emulators in \
                        a single window.

homepage                https://gnometerminator.blogspot.com/p/introduction.html
master_sites            https://launchpad.net/terminator/trunk/${version}/+download

python.default_version  27

depends_build-append    port:intltool

depends_lib-append      port:vte-gtk2-compat \
                        port:hicolor-icon-theme \
                        port:py${python.version}-keybinder \
                        port:py${python.version}-notify-python \
                        port:py${python.version}-psutil

require_active_variants port:vte-gtk2-compat python${python.version}

patchfiles              run_tests.patch

post-patch {
    reinplace -E "s|^#!/usr/bin/env python|#!${python.bin}|" ${worksrcpath}/${name}
    reinplace -E "s|@PYTHON@|${python.bin}|g" ${worksrcpath}/run_tests
    fs-traverse item [list ${worksrcpath}] {
        if {[file extension ${item}] eq {.py}} {
            reinplace -E -q "s|^#!/usr/bin/(env )?python|#!${python.bin}|" ${item}
        }
    }
}

test.run                yes

post-destroot {
    foreach manpage {man1/terminator.1 man5/terminator_config.5} {
        ln -s ${python.prefix}/share/man/${manpage} ${destroot}${prefix}/share/man/${manpage}
    }
    
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 0644 -W ${worksrcpath} \
        COPYING \
        ChangeLog \
        README \
        ${docdir}
}

livecheck.type          regex
livecheck.url           https://launchpad.net/terminator/+download
livecheck.regex         /${name}\[-_\](\[0-9.\]+)${extract.suffix}
