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

github.setup             cooljeanius gaa 1.6.6_6 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from      tarball
revision                 0
categories               devel
maintainers              {gwmail.gwu.edu:egall @cooljeanius} openmaintainer
description              ${name} Argument Analyser
license                  GPL-2+
long_description         ${name} simplifies the life of the programmer: \
                         you do NOT have to worry about the arguments \
                         given to it! A short text written in GAA \
                         language generates C-code which analyses \
                         the arguments and creates your program's help.

homepage                 http://${name}.sf.net

fetch.type               git

depends_build-append     port:bison \
                         port:flex \
                         port:gmake \
                         bin:makeinfo:texinfo \
                         bin:tex:texlive-basic \
                         bin:latex:texlive-latex \
                         port:latex2html \
                         port:texlive-fonts-recommended

depends_lib-append       port:yydecode
depends_lib-delete       port:gobject-introspection \
                         port:poppler

configure.ccache         no

configure.args-append    --with-bison-bin=${prefix}/bin/bison \
                         --without-docs

build.type               gnu
build.cmd                ${prefix}/bin/gmake

test.run                 yes
test.target              check

variant autoreconf description {Regenerates configure script before \
                                building. Also pulls in extra \
                                dependencies.} {
    depends_build-append port:gawk \
                         port:grep \
                         port:autoconf-archive \
                         bin:ar:cctools \
                         bin:file:file \
                         bin:gsed:gsed
    use_autoreconf       yes
    autoreconf.args      -fvi -Wall
    configure.args-append --disable-silent-rules
}

variant docs description {Generate additional documentation by \
                          using latex2html} {
    # (latex2html and texlive-latex are now unconditional dependencies)
    depends_build-append port:texlive-plain-generic
    configure.args-replace --without-docs --with-docs
    use_parallel_build   no
    post-build {
        system -W ${worksrcpath}/doc "${prefix}/bin/latex2html *.tex"
    }
    post-destroot {
        foreach docdir {gaa ref tut} {
            xinstall -d ${destroot}${prefix}/share/doc/${name}/${docdir}
            xinstall -m 644 {*}[glob ${worksrcpath}/doc/${docdir}/*] ${destroot}${prefix}/share/doc/${name}/${docdir}
        }
    }
}
