# $Id: Portfile,v 1.2 2004/01/14 21:57:10 toby Exp $

PortSystem       1.0
name             ghostview
version          1.5
categories       print
maintainers      toby@opendarwin.org
description      X11 frontend for ghostscript
long_description \
    Ghostview is a full function user interface for Ghostscript \
    (versions 2.4 and later).
homepage         http://www.gnu.org/software/ghostview/
platforms        darwin
master_sites     gnu
depends_run      bin:gs:ghostscript
checksums        md5 4f5c1bced73fe14b03109cfa7aacfd90
patch {
    reinplace "s|extern int sys_nerr;||" "${worksrcpath}/misc.c" "${worksrcpath}/SelFile.c"
    reinplace "s|extern char .sys_errlist..;||" "${worksrcpath}/misc.c" "${worksrcpath}/SelFile.c"
}
use_xmkmf        yes
pre-build {
    reinplace "s|BINDIR = /usr/X11R6/bin|BINDIR = ${prefix}/bin|" "${worksrcpath}/Makefile"
    reinplace "s|MANPATH = /usr/X11R6/man|MANPATH = ${prefix}/share/man|" "${worksrcpath}/Makefile"
    reinplace "s|LIBDIR = /usr/X11R6/lib/X11|LIBDIR=${prefix}/share/ghostview|" "${worksrcpath}/Makefile"
}
post-destroot {
    cd ${worksrcpath}
    system "make DESTDIR=${destroot} install.man"
}
