|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r70775 - trunk/tools/build/v2/tools
From: steven_at_[hidden]
Date: 2011-03-30 23:06:06
Author: steven_watanabe
Date: 2011-03-30 23:06:05 EDT (Wed, 30 Mar 2011)
New Revision: 70775
URL: http://svn.boost.org/trac/boost/changeset/70775
Log:
Clean up the fop module. Also modify the reinitialization behavior to match what I did for the other documentation tools.
Text files modified:
trunk/tools/build/v2/tools/fop.jam | 94 ++++++++++++---------------------------
1 files changed, 29 insertions(+), 65 deletions(-)
Modified: trunk/tools/build/v2/tools/fop.jam
==============================================================================
--- trunk/tools/build/v2/tools/fop.jam (original)
+++ trunk/tools/build/v2/tools/fop.jam 2011-03-30 23:06:05 EDT (Wed, 30 Mar 2011)
@@ -6,100 +6,64 @@
# This module defines rules to handle generation of PDF and
# PostScript files from XSL Formatting Objects via Apache FOP
-import os ;
import generators ;
import common ;
-import errors ;
import boostbook ;
generators.register-standard fop.render.pdf : FO : PDF ;
generators.register-standard fop.render.ps : FO : PS ;
+# Initializes the fop toolset.
+#
rule init ( fop-command ? : java-home ? : java ? )
{
- fop-command = [ common.get-invocation-command fop : fop : $(fop-command)
- : [ modules.peek : FOP_DIR ] ] ;
-
- .FOP_COMMAND = $(fop-command) ;
- .FOP_SETUP = ;
-
- # JAVA_HOME is the location that java was installed to.
-
- if $(java-home)
+ local has-command = $(.has-command) ;
+
+ if $(fop-command)
{
- .FOP_SETUP += [ common.variable-setting-command JAVA_HOME : $(java-home) ] ;
+ .has-command = true ;
}
- # JAVACMD is the location that of the java executable, useful for a
- # non-standard java installation, where the executable isn't at
- # $JAVA_HOME/bin/java.
-
- if $(java)
+ if $(fop-command) || ! $(has-command)
{
- .FOP_SETUP += [ common.variable-setting-command JAVACMD : $(java) ] ;
+ fop-command = [ common.get-invocation-command fop : fop : $(fop-command)
+ : [ modules.peek : FOP_DIR ] ] ;
}
- # Make sure the fop command is executed from within the directory where it's located.
-
- # DPG: I can't see how this could ever be correct, because it
- # messes up path names that are used in the command.
+ if $(fop-command)
+ {
+ .FOP_COMMAND = $(fop-command) ;
+ }
- # if $(.FOP_COMMAND:D)
- # {
- # .FOP_SETUP = $(.FOP_SETUP)"
-# cd "$(.FOP_COMMAND:D) ;
- # }
-
-}
+ if $(java-home) || $(java)
+ {
+ .FOP_SETUP = ;
-local rule find-by-absolute-path ( target )
-{
- # Mask off any vars by these names that may be hanging around in
- # outer dynamic scopes.
- local LOCATE SEARCH ;
- # simulate the target binding process to find the target
+ # JAVA_HOME is the location that java was installed to.
- local found = [ on $(target) GLOB $(LOCATE) (SEARCH) : $(target:G=) ] ;
+ if $(java-home)
+ {
+ .FOP_SETUP += [ common.variable-setting-command JAVA_HOME : $(java-home) ] ;
+ }
+
+ # JAVACMD is the location that of the java executable, useful for a
+ # non-standard java installation, where the executable isn't at
+ # $JAVA_HOME/bin/java.
- if $(found)
- {
- # Re-LOCATE the target with an absolute path if it isn't
- # already absolute.
- local found-dir = $(found[1]:D) ;
- local cwd = [ PWD ] ;
- local absolute-dir = $(found-dir:R=$(cwd)) ;
-
- # Translate cygwin paths to Windows iff the user is running on
- # cygwin but using a Windows FOP. We detect a Windows FOP by
- # looking to see if FOP_COMMAND ends with ".bat"
- if [ os.name ] = CYGWIN && [ MATCH .*\\.([Bb][Aa][Tt])$ : $(.FOP_COMMAND) ]
+ if $(java)
{
- absolute-dir = "`cygpath --windows '$(absolute-dir)'`" ;
+ .FOP_SETUP += [ common.variable-setting-command JAVACMD : $(java) ] ;
}
- LOCATE on $(target) = $(absolute-dir) ;
}
}
-rule render.pdf ( source : target : properties * )
-{
- find-by-absolute-path $(source) ;
- find-by-absolute-path $(target) ;
-}
-
-rule render.ps ( source : target : properties * )
-{
- find-by-absolute-path $(source) ;
- find-by-absolute-path $(target) ;
-}
-
-
actions render.pdf
{
- $(.FOP_SETUP) $(.FOP_COMMAND) $(>) $(<)
+ $(.FOP_SETUP) $(.FOP_COMMAND:E=fop) $(>) $(<)
}
actions render.ps
{
- $(.FOP_SETUP) $(.FOP_COMMAND) $(>) -ps $(<)
+ $(.FOP_SETUP) $(.FOP_COMMAND:E=fop) $(>) -ps $(<)
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk