# -*- 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
# $Id: Portfile 56055 2009-08-23 23:03:40Z ryandesign@macports.org $

PortSystem          1.0

name                jgraph
version             8.3
categories          graphics
homepage \
    http://www.cs.utk.edu/~plank/plank/jgraph/jgraph.html
maintainers         cs.ucsd.edu:s
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
platforms           darwin
distname            ${name}
dist_subdir         ${name}/${version}
master_sites        http://www.cs.utk.edu/~plank/plank/jgraph/
checksums           md5 f73fa282f7fe6cf562e08c70da7bfb65 \
                    sha1 4ea864f7bca8cf03217fc57a745753092493ddfa \
                    rmd160 b575acd5fa8f99c8433e81128619a7247881c306
patchfiles          patch-jgraph.h.diff \
                    patch-list.c.diff \
                    patch-makefile.diff \
                    patch-token.c.diff

post-extract {
    # The tarball comes with object files!
    file delete ${worksrcpath}/jgraph
    file delete ${worksrcpath}/draw.o
    file delete ${worksrcpath}/edit.o
    file delete ${worksrcpath}/jgraph.o
    file delete ${worksrcpath}/list.o
    file delete ${worksrcpath}/printline.o
    file delete ${worksrcpath}/prio_list.o
    file delete ${worksrcpath}/process.o
    file delete ${worksrcpath}/show.o
    file delete ${worksrcpath}/token.o
    # Replace JGRAPH_DIR with the actual directory
    reinplace "s,JGRAPH_DIR,${prefix}/share/examples/${name}," ${worksrcpath}/jgraph.1
}

use_configure no
use_test no
destroot {
    xinstall -m 755 -d ${destroot}$prefix/bin
    xinstall -m 755 ${worksrcpath}/jgraph ${destroot}${prefix}/bin
    xinstall -m 755 -d ${destroot}$prefix/share/man
    xinstall -m 755 -d ${destroot}$prefix/share/man/man1
    xinstall -m 644 ${worksrcpath}/jgraph.1 \
        ${destroot}${prefix}/share/man/man1
    xinstall -m 755 -d ${destroot}$prefix/share/doc/${name}
    xinstall -m 644 ${worksrcpath}/README \
        ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 -d ${destroot}${prefix}/share/examples/${name}
    eval xinstall -m 644 [glob ${worksrcpath}/*.jgr] \
        ${destroot}${prefix}/share/examples/${name}
}
