# $Id: Portfile,v 1.5 2005/09/20 23:27:10 toby Exp $

PortSystem 1.0

name	   gv
version	   3.5.8
revision   1
categories	print
maintainers	toby@opendarwin.org

description	PostScript and PDF previewer
long_description	   gv is an X11 PostScript and PDF previewer based on Tim Theisen's \
			   ghostview-1.5. It uses the Xaw3d widget set, thus providing a \
			   much nicer look and it's said to be a bit faster.

homepage	http://wwwthep.physik.uni-mainz.de/~plass/gv/
platforms	darwin
master_sites	ftp://ftpthep.physik.uni-mainz.de/pub/gv/unix/
checksums	md5 8f2f0bd97395d6cea52926ddee736da8

depends_lib	lib:libXaw3d.7:Xaw3d
depends_run	bin:gs:ghostscript

patchfiles	patch-setenv.c
post-patch	{
		reinplace "s|DIR    = /usr/local|DIR    = ${prefix}|" "${worksrcpath}/config.Unix"
		reinplace "s|/man/man1|/share/man/man1|g" ${worksrcpath}/config.Unix
		reinplace "s|##aaa##|aaa|" "${worksrcpath}/source/paths.h"
}

use_xmkmf	yes
pre-build	{
		file copy "${worksrcpath}/doc/gv.man" "${worksrcpath}/source"
}

post-destroot	{
		cd ${worksrcpath}/source
		system "make DESTDIR=${destroot} DOCHTMLDIR=${prefix}/share/doc/gv install.man"
		file delete -force ${destroot}/usr
}
