# $Id: Portfile,v 1.23 2006/05/20 15:19:30 digdog Exp $

PortSystem 1.0
name        ghostscript
version     8.54
homepage    http://www.cs.wisc.edu/~ghost/
description AFPL Ghostscript, An interpreter for PostScript and PDF
categories  print
platforms   darwin
maintainers digdog@opendarwin.org

long_description    Ghostscript is the well-known PostScript interpreter which \
        is available for all common and most esoteric platforms and \
        supports many different printers and some displays. Versions \
        entitled "AFPL Ghostscript" are distributed with a licence \
        different from the GPL. 

master_sites    sourceforge:${name}:source \
        sourceforge:gs-fonts:fonts

distfiles   ${distname}.tar.gz:source \
        ghostscript-fonts-std-8.11.tar.gz:fonts \
        ghostscript-fonts-other-6.0.tar.gz:fonts

checksums   ${distname}.tar.gz md5 022c1f716b97da55bf06796466e913d5 \
        ghostscript-fonts-std-8.11.tar.gz md5 6865682b095f8c4500c54b285ff05ef6 \
        ghostscript-fonts-other-6.0.tar.gz md5 1a643ae62ef166562e4d422b1a601272

build.target

destroot.destdir    prefix=${destroot}/${prefix}

post-destroot   {
        file copy ${workpath}/fonts ${destroot}/${prefix}/share/ghostscript
        }

# Added variant that build the Ghostscript framework. (Thanks, Sal!)
variant gslib   {
        post-patch {
            cd ${workpath}/${name}-${version}
            reinplace "s|/Library/Frameworks|${destroot}${prefix}/Library/Frameworks|" \
                        src/macosx.mak
        }
      
        post-build {
            cd ${workpath}/${name}-${version}
            file rename Makefile Makefile.CONFIGURE
            file link Makefile src/macosx.mak
            system "make framework"
            file delete Makefile
            file rename Makefile.CONFIGURE Makefile
        }
      
        post-destroot {
            cd ${workpath}/${name}-${version}
            xinstall -m 755 -d ${destroot}${prefix}/Library/Frameworks
            file rename Makefile Makefile.CONFIGURE
            file link Makefile src/macosx.mak
            system "make framework_install"
            file delete Makefile
            file rename Makefile.CONFIGURE Makefile
        }
}
