Blame tools/build/src/tools/fop.jam

Packit 58578d
#  Copyright (C) 2003-2004 Doug Gregor and Dave Abrahams. Distributed
Packit 58578d
# under the Boost Software License, Version 1.0. (See accompanying
Packit 58578d
# file LICENSE_1_0.txt or copy at
Packit 58578d
# http://www.boost.org/LICENSE_1_0.txt)
Packit 58578d
#
Packit 58578d
#  This module defines rules to handle generation of PDF and
Packit 58578d
#  PostScript files from XSL Formatting Objects via Apache FOP
Packit 58578d
Packit 58578d
import generators ;
Packit 58578d
import common ;
Packit 58578d
import boostbook ;
Packit 58578d
Packit 58578d
generators.register-standard fop.render.pdf : FO : PDF ;
Packit 58578d
generators.register-standard fop.render.ps : FO : PS ;
Packit 58578d
Packit 58578d
# Initializes the fop toolset.
Packit 58578d
#
Packit 58578d
rule init ( fop-command ? : java-home ? : java ? )
Packit 58578d
{
Packit 58578d
    local has-command = $(.has-command) ;
Packit 58578d
Packit 58578d
    if $(fop-command)
Packit 58578d
    {
Packit 58578d
        .has-command = true ;
Packit 58578d
    }
Packit 58578d
Packit 58578d
    if $(fop-command) || ! $(has-command)
Packit 58578d
    {
Packit 58578d
        fop-command = [ common.get-invocation-command fop : fop : $(fop-command) 
Packit 58578d
          : [ modules.peek : FOP_DIR ] ] ;
Packit 58578d
    }
Packit 58578d
    
Packit 58578d
    if $(fop-command)
Packit 58578d
    {
Packit 58578d
        .FOP_COMMAND = $(fop-command) ;
Packit 58578d
    }
Packit 58578d
Packit 58578d
    if $(java-home) || $(java)
Packit 58578d
    {
Packit 58578d
        .FOP_SETUP = ;
Packit 58578d
Packit 58578d
    
Packit 58578d
        # JAVA_HOME is the location that java was installed to.
Packit 58578d
    
Packit 58578d
        if $(java-home)
Packit 58578d
        {
Packit 58578d
            .FOP_SETUP += [ common.variable-setting-command JAVA_HOME : $(java-home) ] ;
Packit 58578d
        }
Packit 58578d
Packit 58578d
        # JAVACMD is the location that of the java executable, useful for a
Packit 58578d
        # non-standard java installation, where the executable isn't at
Packit 58578d
        # $JAVA_HOME/bin/java.
Packit 58578d
    
Packit 58578d
        if $(java)
Packit 58578d
        {
Packit 58578d
            .FOP_SETUP += [ common.variable-setting-command JAVACMD : $(java) ] ;
Packit 58578d
        }
Packit 58578d
    }
Packit 58578d
}
Packit 58578d
Packit 58578d
actions render.pdf
Packit 58578d
{
Packit 58578d
    $(.FOP_SETUP) $(.FOP_COMMAND:E=fop) $(>) $(<)
Packit 58578d
}
Packit 58578d
Packit 58578d
actions render.ps
Packit 58578d
{
Packit 58578d
    $(.FOP_SETUP) $(.FOP_COMMAND:E=fop) $(>) -ps $(<)
Packit 58578d
}