Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/build/v2/tools/fop.jam @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

File size: 2.9 KB
Line 
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 os ;
10import generators ;
11import common ;
12import errors ;
13
14generators.register-standard fop.render.pdf : FO : PDF ;
15generators.register-standard fop.render.ps : FO : PS ;
16
17rule init ( fop-command ? : java-home ? : java ? )
18{
19    fop-command = [ common.get-invocation-command fop : fop : $(fop-command)
20      : [ modules.peek : FOP_DIR ] ] ;
21       
22    if $(.initialized)
23    {
24        if $(.FOP_COMMAND) != $(fop-command) || $(JAVA_HOME) != $(java-home)
25           || $(JAVACMD) != $(java)
26        {
27            errors.user-error "fop: reinitialization with different options" ;
28        }       
29    }
30    else
31    {
32        .initialized = true ;
33        .FOP_COMMAND = $(fop-command) ;
34        # What is the meaning of this logic?  Needs more comments!!  --DWA
35        java-home ?= $(java) ;
36        .FOP_SETUP = [ common.variable-setting-command JAVA_HOME : $(java-home) ] ;
37    }
38   
39    # Make sure the fop command is executed from within the directory where it's located.
40
41    # DPG: I can't see how this could ever be correct, because it
42    # messes up path names that are used in the command.
43
44    # if $(.FOP_COMMAND:D)
45    # {
46    #     .FOP_SETUP = $(.FOP_SETUP)"
47# cd "$(.FOP_COMMAND:D) ;
48    # }
49     
50}
51
52local rule find-by-absolute-path ( target )
53{
54    # Mask off any vars by these names that may be hanging around in
55    # outer dynamic scopes.
56    local LOCATE SEARCH ;
57   
58    # simulate the target binding process to find the target
59   
60    local found =  [ on $(target) GLOB $(LOCATE) (SEARCH) : $(target:G=) ] ;
61   
62    if $(found)
63    {
64        # Re-LOCATE the target with an absolute path if it isn't
65        # already absolute.
66        local found-dir = $(found[1]:D) ;
67        local cwd = [ PWD ] ;
68        local absolute-dir = $(found-dir:R=$(cwd)) ;
69       
70        # Translate cygwin paths to Windows iff the user is running on
71        # cygwin but using a Windows FOP.  We detect a Windows FOP by
72        # looking to see if FOP_COMMAND ends with ".bat"
73        if [ os.name ] = CYGWIN && [ MATCH .*\\.([Bb][Aa][Tt])$ : $(.FOP_COMMAND) ]
74        {
75            absolute-dir = "`cygpath --windows '$(absolute-dir)'`" ;
76        }
77        LOCATE on $(target) = $(absolute-dir) ;
78    }
79}
80
81rule render.pdf ( source : target : properties * )
82{
83    find-by-absolute-path $(source) ;
84    find-by-absolute-path $(target) ;
85}
86
87rule render.ps ( source : target : properties * )
88{
89    find-by-absolute-path $(source) ;
90    find-by-absolute-path $(target) ;
91}
92
93
94actions render.pdf
95{
96  $(.FOP_SETUP) $(.FOP_COMMAND) $(>) $(<)
97}
98
99actions render.ps
100{
101  $(.FOP_SETUP) $(.FOP_COMMAND) $(>) -ps $(<)
102}
Note: See TracBrowser for help on using the repository browser.