1#  Copyright (C) 2003-2004 Doug Gregor and Dave Abrahams. Distributed
2# under the Boost Software License, Version 1.0. (See accompanying
3# file LICENSE_1_0.txt or copy at
4# http://www.boost.org/LICENSE_1_0.txt)
5#
6#  This module defines rules to handle generation of PDF and
7#  PostScript files from XSL Formatting Objects via Apache FOP
8
9import generators ;
10import common ;
11import boostbook ;
12
13generators.register-standard fop.render.pdf : FO : PDF ;
14generators.register-standard fop.render.ps : FO : PS ;
15
16# Initializes the fop toolset.
17#
18rule init ( fop-command ? : java-home ? : java ? )
19{
20    local has-command = $(.has-command) ;
21
22    if $(fop-command)
23    {
24        .has-command = true ;
25    }
26
27    if $(fop-command) || ! $(has-command)
28    {
29        fop-command = [ common.get-invocation-command fop : fop : $(fop-command)
30          : [ modules.peek : FOP_DIR ] ] ;
31    }
32
33    if $(fop-command)
34    {
35        .FOP_COMMAND = $(fop-command) ;
36    }
37
38    if $(java-home) || $(java)
39    {
40        .FOP_SETUP = ;
41
42
43        # JAVA_HOME is the location that java was installed to.
44
45        if $(java-home)
46        {
47            .FOP_SETUP += [ common.variable-setting-command JAVA_HOME : $(java-home) ] ;
48        }
49
50        # JAVACMD is the location that of the java executable, useful for a
51        # non-standard java installation, where the executable isn't at
52        # $JAVA_HOME/bin/java.
53
54        if $(java)
55        {
56            .FOP_SETUP += [ common.variable-setting-command JAVACMD : $(java) ] ;
57        }
58    }
59}
60
61actions render.pdf
62{
63    $(.FOP_SETUP) $(.FOP_COMMAND:E=fop) $(>) $(<)
64}
65
66actions render.ps
67{
68    $(.FOP_SETUP) $(.FOP_COMMAND:E=fop) $(>) -ps $(<)
69}
70