# -*- 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 85766 2011-10-16 05:21:29Z dports@macports.org $

PortSystem 1.0

name			    grace
version			    5.1.22
revision		    6
categories		    x11 math science print
license             GPL-2+
platforms		    darwin
maintainers		    nomaintainer
description		    WYSIWYG tool to make two-dimensional plots of numerical data
long_description	${description}
use_parallel_build	yes

homepage		    http://plasma-gate.weizmann.ac.il/Grace/
set sub			    grace/src/stable
master_sites	    ftp://ftp.fu-berlin.de/unix/graphics/${sub} \
				    ftp://ftp.u-aizu.ac.jp/pub/SciEng/math/${sub} \
				    freebsd

checksums		    md5 672356466f18fe59ed21a8fb44f9851d \
                    sha1 3ce88c7c264d2de73b8935f835a1c1f8e368c78f \
                    rmd160 ca7b1abe240de7cd3dbdc52d5182020c410b9772 

depends_lib \
	port:xorg-libXmu \
	port:xorg-libXp \
	port:xpm \
	port:libpng \
	lib:libXm:openmotif \
	port:pdflib \
	port:jpeg \
	port:zlib


patchfiles          patch-configure.diff

configure.pre_args  --prefix=${prefix}/lib
configure.args      --with-helpviewer="open ${prefix}/share/doc/${name}/`basename %s`" \
                    --x-include=${prefix}/include --x-lib=${prefix}/lib

post-destroot {
	xinstall -m 755 -d ${destroot}${prefix}/share/doc
	file delete ${destroot}${prefix}/bin
	file rename ${destroot}${prefix}/lib/grace/bin ${destroot}${prefix}/bin
	file rename ${destroot}${prefix}/lib/grace/doc ${destroot}${prefix}/share/doc/${name}
	file rename ${destroot}${prefix}/lib/grace/examples ${destroot}${prefix}/share/doc/${name}/examples
	file rename ${destroot}${prefix}/lib/grace/include/grace_np.h ${destroot}${prefix}/include/grace_np.h
	file rename ${destroot}${prefix}/lib/grace/lib/libgrace_np.a ${destroot}${prefix}/lib/libgrace_np.a
	system "cd ${destroot}${prefix}/share/doc/${name} && ln -s . doc"
	system "cd ${destroot}${prefix}/share && mv doc/grace/*.1 man/man1/"
}

variant netcdf description {Support for NetCDF data files} {
  depends_lib-append       port:netcdf
  configure.args-append    --enable-netcdf
}

livecheck.type		regex
livecheck.url		${homepage}news.js
livecheck.regex		{Grace-([0-9.]+) released}
