# $Id: Portfile 86786 2011-11-04 05:20:35Z boeyms@macports.org $

PortSystem 1.0

name                fop-0.20
version             0.20.5
categories          textproc java
maintainers         nomaintainer
platforms           darwin
description         Apache FOP Java XSL-FO Print Formatter, 0.20 branch
long_description \
    FOP is the world's first print formatter driven by XSL formatting \
    objects. It is a Java application that reads a formatting object \
    tree conforming to the XSL-FO Version 1.0 W3C Recommendation and \
    then turns it into a PDF document or allows you to preview it \
    directly on screen.  This release is from the old 0.20 branch.
homepage            http://xmlgraphics.apache.org/fop/${version}/

# Apache recommended that this version of FOP be linked to FOP-specific versions
# of the Java libraries that it depends on (which are distributed with FOP), and
# they do not guarantee that FOP will work with any other versions.  Since this
# version of FOP and the dependencies it uses are now significantly older than
# the latest versions, we might as well only use the binary distribution (unless
# anyone else comes up with a compelling reason to change this).  For the same
# reason, we also stick to the directory structure within the archive, since it
# isolates FOP and its libraries from conflicts with other versions.
distname            fop-${version}-bin
master_sites        http://archive.apache.org/dist/xmlgraphics/fop/binaries/
checksums           md5 d6b43e3eddf9378536ad8127bc057d41 \
                    sha1 ab650c5f253b1a7994776a15bc5e9abc54ff7687 \
                    rmd160 59baae8df3642ca671fb4c6528082cf9d0b92f3b
patchfiles          patch-fop.sh.diff patch-xalan.sh.diff

worksrcdir          fop-${version}
use_configure       no
build               {}
pre-destroot {
    delete ${worksrcpath}/fop.bat
    delete ${worksrcpath}/xalan.bat
}
destroot    {
    xinstall -m 755 -d ${destroot}${prefix}/share/java/fop/${version}
    set foppaths [glob ${worksrcpath}/*]
    foreach foppath ${foppaths} {
        copy ${foppath} ${destroot}${prefix}/share/java/fop/${version}
    }
    foreach fopbin {fop xalan} {
        ln -fs ${prefix}/share/java/fop/${version}/${fopbin}.sh \
            ${destroot}${prefix}/bin/${fopbin}.sh
    }
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/fop/${version}
    foreach fopdoc {CHANGES KEYS LICENSE README ReleaseNotes.html STATUS} {
        ln -fs ${prefix}/share/java/fop/${version}/${fopdoc} \
            ${destroot}${prefix}/share/doc/fop/${version}/${fopdoc}
    }
    ln -fs ${prefix}/share/java/fop/${version}/docs/xslfoRef.pdf \
        ${destroot}${prefix}/share/doc/fop/${version}/xslfoRef.pdf
    ln -fs ${prefix}/share/java/fop/${version}/build/site \
        ${destroot}${prefix}/share/doc/fop/${version}/site
}
