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

name                gindent
version             2.2.12
revision            1
categories          devel
license             GPL-3
maintainers         {larryv @larryv}

description         C language source code formatting program
long_description    GNU indent changes the appearance of a C program \
                    by inserting or deleting whitespace according to \
                    a plethora of options. Some canned styles of \
                    formatting are supported as well. GNU indent is \
                    a descendant of BSD indent. GNU indent does NOT \
                    work for C++, only C.
homepage            https://www.gnu.org/software/indent

depends_build       port:gperf
depends_lib         port:gettext port:libiconv
installs_libs       no

master_sites        debian:i/indent
distname            indent_${version}.orig
use_xz              yes
checksums           rmd160  a511a8f069b11c1539add0b99077942022e33c2a \
                    sha256  b745a5dfc68f86a483d7f96dc1cda7aafd1e78ecba3c7d8ad304709e91e1defb \
                    size    620280

worksrcdir          indent-${version}

patchfiles          no-html.patch \
                    no-Werror.patch \
                    respect-docdir.patch \
                    strdup.patch

configure.args      --docdir=${prefix}/share/doc/${name} \
                    --program-prefix=g \
                    --disable-debug \
                    --disable-dependency-tracking

post-destroot {
    # Documentation.
    move ${destroot}${prefix}/share/info/indent.info \
        ${destroot}${prefix}/share/info/gindent.info
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS COPYING NEWS \
        ${destroot}${prefix}/share/doc/${name}

    # Extras in libexec/gnubin.
    set gnubindir ${prefix}/libexec/gnubin
    xinstall -m 755 -d ${destroot}${gnubindir}/man/man1
    ln -s ../../../../share/man/man1/gindent.1.gz \
        ${destroot}${gnubindir}/man/man1/indent.1.gz
    ln -s ../../bin/gindent ${destroot}${gnubindir}/indent
}

# use same url for livecheck as fetch (debian mirror)
# GNU default livecheck url is not up to date
livecheck.url   http://ftp.us.debian.org/debian/pool/main/i/indent
livecheck.regex "indent_(\\d+(?:\\.\\d+)*)"
