]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/tools/build/src/tools/xsltproc.jam
update sources to ceph Nautilus 14.2.1
[ceph.git] / ceph / src / boost / tools / build / src / tools / xsltproc.jam
index 56de81f36fe92d7ff45b8131dd9cde42e0a73e1d..6baf0491af4de16755d87f5668d012cfd91ec0e1 100644 (file)
@@ -6,17 +6,20 @@
 # This module defines rules to apply an XSLT stylesheet to an XML file using the
 # xsltproc driver, part of libxslt.
 
+import "class" : new ;
 import common ;
 import feature ;
+import generators ;
 import modules ;
 import os ;
 import path ;
 import regex ;
 import sequence ;
+import toolset ;
+import virtual-target ;
 
-
-feature.feature xsl:param : : free ;
-feature.feature xsl:path : : free ;
+feature.feature "xsl:param" : : free ;
+feature.feature "xsl:path" : : free ;
 feature.feature catalog : : free ;
 
 
@@ -108,42 +111,59 @@ rule .is-cygwin ( xsltproc )
     }
 }
 
-
-rule compute-xslt-flags ( target : properties * )
+class xsltproc-action : action
 {
-    # Raw flags.
-    local flags = [ feature.get-values <flags> : $(properties) ] ;
-
-    # Translate <xsl:param> into command line flags.
-    for local param in [ feature.get-values <xsl:param> : $(properties) ]
+    rule adjust-properties ( property-set )
     {
-        local namevalue = [ regex.split $(param) "=" ] ;
-        flags += --stringparam $(namevalue[1]) \"$(namevalue[2])\" ;
+        local s = [ $(self.targets[1]).creating-subvariant ] ;
+        if $(s)
+        {
+            return [ $(property-set).add-raw
+                [ $(s).implicit-includes "xsl:path" : XML ] ] ;
+        }
+        else
+        {
+            return $(property-set) ;
+        }
     }
+}
 
-    # Translate <xsl:path>.
-    for local path in [ feature.get-values <xsl:path> : $(properties) ]
+class xsltproc-generator : generator
+{
+    rule action-class ( )
     {
-        flags += --path \"$(path:G=)\" ;
+        return xsltproc-action ;
     }
+}
 
-    # Take care of implicit dependencies.
-    local other-deps ;
-    for local dep in [ feature.get-values <implicit-dependency> : $(properties)
-        ]
+rule register-generator ( id : source-types + : target-types + : requirements * )
+{
+    if ! $(id) in $(.known-rules)
     {
-        other-deps += [ $(dep:G=).creating-subvariant ] ;
+        .known-rules += $(id) ;
+        flags $(id) ;
     }
+    generators.register [ new xsltproc-generator $(id) :
+        $(source-types) : $(target-types) : $(requirements) ] ;
+}
 
-    local implicit-target-directories ;
-    for local dep in [ sequence.unique $(other-deps) ]
-    {
-        implicit-target-directories += [ $(dep).all-target-directories ] ;
-    }
+IMPORT xsltproc : register-generator : : generators.register-xslt ;
+
+rule flags ( rulename )
+{
+    toolset.uses-features $(rulename) : <xsl:param> <catalog> : unchecked ;
+    toolset.flags $(rulename) XSL-PATH : <xsl:path> : unchecked ;
+    toolset.flags $(rulename) FLAGS : <flags> : unchecked ;
+}
 
-    for local dir in $(implicit-target-directories)
+rule compute-xslt-flags ( target : properties * )
+{
+    local flags ;
+    # Translate <xsl:param> into command line flags.
+    for local param in [ feature.get-values <xsl:param> : $(properties) ]
     {
-        flags += --path \"$(dir:T)\" ;
+        local namevalue = [ regex.split $(param) "=" ] ;
+        flags += --stringparam $(namevalue[1]) \"$(namevalue[2])\" ;
     }
 
     return $(flags) ;
@@ -186,25 +206,27 @@ rule xslt-dir ( target : source stylesheet : properties * : dirname )
         $(dirname) : xslt-xsltproc-dir ] ;
 }
 
+_ = " " ;
+
 actions xslt-xsltproc.windows
 {
-    $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<)" "$(STYLESHEET:W)" "$(>:W)"
+    $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --path$(_)"$(XSL-PATH:W)" --xinclude -o "$(<)" "$(STYLESHEET:W)" "$(>:W)"
 }
 
 
 actions xslt-xsltproc bind STYLESHEET
 {
-    $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<)" "$(STYLESHEET:T)" "$(>:T)"
+    $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --path$(_)"$(XSL-PATH:T)" --xinclude -o "$(<)" "$(STYLESHEET:T)" "$(>:T)"
 }
 
 
 actions xslt-xsltproc-dir.windows bind STYLESHEET
 {
-    $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<:D)/" "$(STYLESHEET:W)" "$(>:W)"
+    $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --path$(_)"$(XSL-PATH:W)" --xinclude -o "$(<:D)/" "$(STYLESHEET:W)" "$(>:W)"
 }
 
 
 actions xslt-xsltproc-dir bind STYLESHEET
 {
-    $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --xinclude -o "$(<:D)/" "$(STYLESHEET:T)" "$(>:T)"
+    $(CATALOG) "$(NAME:E=xsltproc)" $(FLAGS) --path$(_)"$(XSL-PATH:T)" --xinclude -o "$(<:D)/" "$(STYLESHEET:T)" "$(>:T)"
 }