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

github.setup        garabik grc 1.13 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            2

conflicts           cc65

categories          textproc
license             GPL-2
maintainers         nomaintainer
supported_archs     noarch
platforms           any

description         Generic Colouriser for colourising logfiles and output of commands
long_description    Generic Colouriser makes text files or outputs of different programs \
                    more readable by inserting ANSI colour control codes into them. \
                    It provides the grc and grcat Python scripts for filtering \
                    text output and colourising it.

checksums           rmd160  06578c83ffae331825fc1b5fe8ac1b5279f1f44a \
                    sha256  1468c50237fc260840384cc2063f3031689e95e5c6dc22533aa5d25a3d17f2f9 \
                    size    49236

python.default_version 313

build {}
destroot {
    reinplace "s|\$(which grc)|${prefix}/bin/grc|" \
        ${worksrcpath}/grc.sh
    reinplace "s|#! /usr/bin/env python3|#!${python.bin}|" \
        ${worksrcpath}/grc ${worksrcpath}/grcat
    reinplace "s|/etc|${prefix}/etc|g" \
        ${worksrcpath}/grc ${worksrcpath}/grc.1
    reinplace "s|/usr/local|${prefix}|g" \
        ${worksrcpath}/grcat ${worksrcpath}/grcat.1
    xinstall -m 755 -W ${worksrcpath} \
        grc grcat ${destroot}${prefix}/bin
    xinstall -m 644 -W ${worksrcpath} \
        grc.1 grcat.1 ${destroot}${prefix}/share/man/man1
    xinstall -m 644 -W ${worksrcpath} \
        grc.conf ${destroot}${prefix}/etc
    xinstall -m 755 -d ${destroot}${prefix}/share/${name}
    xinstall -m 644 {*}[glob ${worksrcpath}/colourfiles/conf.*] \
        ${destroot}${prefix}/share/${name}
    xinstall -m 755 -d ${destroot}${prefix}/etc/${name}.d
    xinstall -m 644 -W ${worksrcpath} \
        grc.sh grc.zsh grc.fish ${destroot}${prefix}/etc/${name}.d
    set docdir ${prefix}/share/doc/${subport}
    xinstall -d ${destroot}${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        CHANGES \
        COPYING \
        CREDITS \
        INSTALL \
        README.markdown \
        Regexp.txt \
        TODO \
        ${destroot}${docdir}
}
