# -*- 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                jgraph
version             8.5
categories          graphics
license             BSD
homepage \
    http://www.cs.utk.edu/~plank/plank/jgraph/jgraph.html
maintainers         nomaintainer
description         A Filter for Plotting Graphs in PostScript
long_description    Jgraph is a program that takes the description \
                    a graph or graphs as input, and produces a \
                    PostScript file on the standard output. Jgraph \
                    is ideal for plotting any mixture of scatter \
                    point graphs, line graphs, and/or bar graphs, \
                    and embedding the output into LaTeX, or any \
                    other text processing system that can read \
                    PostScript
distname            2017-11-28-Jgraph
dist_subdir         ${name}/${version}
worksrcdir          ${name}
master_sites        https://web.eecs.utk.edu/~jplank/plank/jgraph/
checksums           rmd160  dbdd95cd53eeeb6797967efddb5fc2b925f083d9 \
                    sha256  fd6a71d917b57a3b4fe25b6c8f9d00569124f5eaa76caa41565c09f553b6ccda \
                    size    788480
use_tar             yes
use_configure       no
use_test            no

patchfiles          patch-decls.diff

post-patch {
    reinplace s|gcc|${configure.cc}| ${worksrcpath}/makefile
    # Replace JGRAPH_DIR with the actual directory
    reinplace "s,JGRAPH_DIR,${prefix}/share/examples/${name}," ${worksrcpath}/jgraph.1
}

destroot {
    xinstall -m 0755 -d ${destroot}${prefix}/bin
    xinstall -m 0755 ${worksrcpath}/jgraph ${destroot}${prefix}/bin
    xinstall -m 0755 -d ${destroot}${prefix}/share/man
    xinstall -m 0755 -d ${destroot}${prefix}/share/man/man1
    xinstall -m 0644 ${worksrcpath}/jgraph.1 \
        ${destroot}${prefix}/share/man/man1
    xinstall -m 0755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 ${worksrcpath}/README \
        ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0755 -d ${destroot}${prefix}/share/examples/${name}
    xinstall -m 0644 {*}[glob ${worksrcpath}/*.{jgr,pts}] \
        ${destroot}${prefix}/share/examples/${name}
}

livecheck.type      regex
livecheck.url       ${homepage}
livecheck.regex     {The Software \(version (\d+(?:\.\d+)*)\)}
