Portfile

# $Id: Portfile 23056 2007-03-24 01:35:22Z pipping@macports.org $

PortSystem 1.0
name gplghostscript
version 8.54
homepage http://www.cs.wisc.edu/~ghost/
description GPL Ghostscript, An interpreter for PostScript and PDF
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. This provides the GPL version.

categories print
platforms darwin
maintainers nomaintainer@macports.org

master_sites sourceforge:ghostscript:source \
sourceforge:gs-fonts:fonts

distname ghostscript-${version}-gpl
use_bzip2 yes
set gplgs_file ${distname}${extract.suffix}
set gplgs_fonts ghostscript-fonts-std-8.11.tar.gz
distfiles ${gplgs_file}:source ${gplgs_fonts}:fonts
extract.only ${gplgs_file}

checksums ${gplgs_file} md5 5d0ad0da8297fe459a788200f0eaeeba \
${gplgs_file} sha1 5da69b04ddc8a4660a2c40b0e561a358c737c310 \
${gplgs_file} rmd160 f61f6da568ffe440a466cd0d7b5871a3d87d1116 \
\
${gplgs_fonts} md5 6865682b095f8c4500c54b285ff05ef6 \
${gplgs_fonts} sha1 2a7198e8178b2e7dba87cb5794da515200b568f5 \
${gplgs_fonts} rmd160 10a19a10d0388bc084a7c1d3da845068d7169054

depends_lib port:gtk1 port:libpng port:zlib

post-extract {
cd ${worksrcpath}
system "ln -s src/unix-gcc.mak makefile"
cd ${workpath}
system "gunzip -c ${distpath}/${gplgs_fonts} | tar xf -"
}

patchfiles patch-src-unix-dll.mak
post-patch {
reinplace "s|XLIBS=Xt|XLIBS=Xt SM ICE|g" ${worksrcpath}/src/unix-gcc.mak
reinplace "s|@@FILESPATH@@|${filespath}|" ${worksrcpath}/src/unix-dll.mak
}

use_configure no

build.target so
build.args SHARE_LIBPNG=1 \
SHARE_ZLIB=1 \
XCFLAGS="-I${prefix}/include -no-cpp-precomp" \
XLDFLAGS="-L${prefix}/lib" \
prefix=${prefix} \
mandir=${prefix}/share/man

destroot.target soinstall
destroot.destdir prefix=${destroot}${prefix}
destroot.args SHARE_LIBPNG=1 \
SHARE_ZLIB=1 \
XCFLAGS="-I${prefix}/include -no-cpp-precomp" \
XLDFLAGS="-L${prefix}/lib" \
mandir=${destroot}${prefix}/share/man

post-destroot {
file mkdir ${destroot}${prefix}/share/ghostscript/ \
${destroot}${prefix}/include/ghostscript
file copy ${workpath}/fonts ${destroot}${prefix}/share/ghostscript
file copy ${worksrcpath}/src/iapi.h ${worksrcpath}/src/errors.h \
${worksrcpath}/src/gdevdsp.h ${worksrcpath}/src/ierrors.h \
${destroot}${prefix}/include/ghostscript
system "ln -s gsc ${destroot}${prefix}/bin/gs"
}

files