$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r80005 - in trunk/tools/build/v2: build tools util
From: jurko.gospodnetic_at_[hidden]
Date: 2012-08-13 10:35:58
Author: jurko
Date: 2012-08-13 10:35:56 EDT (Mon, 13 Aug 2012)
New Revision: 80005
URL: http://svn.boost.org/trac/boost/changeset/80005
Log:
Boost Build cleanup - minor stylistic changes.
Text files modified: 
   trunk/tools/build/v2/build/targets.jam        |    53 ++++-----                               
   trunk/tools/build/v2/build/virtual-target.jam |    46 ++++---                                 
   trunk/tools/build/v2/tools/doxygen.jam        |   213 +++++++++++++++++---------------------- 
   trunk/tools/build/v2/tools/stage.jam          |   120 ++++++++++-----------                   
   trunk/tools/build/v2/util/regex.jam           |     3                                         
   5 files changed, 204 insertions(+), 231 deletions(-)
Modified: trunk/tools/build/v2/build/targets.jam
==============================================================================
--- trunk/tools/build/v2/build/targets.jam	(original)
+++ trunk/tools/build/v2/build/targets.jam	2012-08-13 10:35:56 EDT (Mon, 13 Aug 2012)
@@ -22,7 +22,7 @@
 # create an instance of that class and add it to the list of alternatives for
 # the main target.
 #
-# Rules supplied by the build system will use only targets derived from
+# Rules supplied by the build system will use only targets derived from the
 # 'basic-target' class, which will provide some default behaviour. There will be
 # different classes derived from it such as 'make-target', created by the 'make'
 # rule, and 'typed-target', created by rules such as 'exe' and 'lib'.
@@ -1115,7 +1115,8 @@
         abstract-target.__init__ $(name) : $(project) ;
 
         self.sources = $(sources) ;
-        if ! $(requirements) {
+        if ! $(requirements)
+        {
             requirements = [ property-set.empty ] ;
         }
         self.requirements = $(requirements) ;
@@ -1153,8 +1154,8 @@
         {
             for local s in $(self.sources)
             {
-                self.source-targets +=
-                  [ targets.resolve-reference $(s) : $(self.project) ] ;
+                self.source-targets += [ targets.resolve-reference $(s) :
+                    $(self.project) ] ;
             }
         }
         return $(self.source-targets) ;
@@ -1210,7 +1211,8 @@
     }
 
     # Takes a target reference, which might be either target id or a dependency
-    # property, and generates that target using 'property-set' as build request.
+    # property, and generates that target using 'property-set' as a build
+    # request.
     #
     # The results are added to the variable called 'result-var'. Usage
     # requirements are added to the variable called 'usage-requirements-var'.
@@ -1303,7 +1305,7 @@
                 # We might get duplicate sources, for example if we link to two
                 # libraries having the same <library> usage requirement. Use
                 # stable sort, since for some targets the order is important,
-                # e.g. RUN_PY target need a python source to come first.
+                # e.g. RUN_PY targets need a python source to come first.
                 source-targets = [ sequence.unique $(source-targets) : stable ]
                     ;
 
@@ -1640,38 +1642,35 @@
 }
 
 
-# Creates a new metargets with the specified properties, using 'klass' as
-# the class. The 'name', 'sources',
-# 'requirements', 'default-build' and 'usage-requirements' are assumed to be in
-# the form specified by the user in Jamfile corresponding to 'project'.
+# Creates a metatarget with the specified properties, using 'klass' as the
+# class. The 'name', 'sources', 'requirements', 'default-build' and
+# 'usage-requirements' are assumed to be in the form specified by the user in
+# the Jamfile corresponding to 'project'.
 #
 rule create-metatarget ( klass : project : name : sources * : requirements * :
     default-build * : usage-requirements * )
 {
-    return [
-        targets.main-target-alternative
-        [ new $(klass) $(name) : $(project)
-            : [ targets.main-target-sources $(sources) : $(name) ]
-            : [ targets.main-target-requirements $(requirements) : $(project) ]
-            : [ targets.main-target-default-build $(default-build) : $(project) ]
-            : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ]
-        ] ] ;
+    return [ targets.main-target-alternative [ new $(klass) $(name) : $(project)
+        : [ targets.main-target-sources $(sources) : $(name) ]
+        : [ targets.main-target-requirements $(requirements) : $(project) ]
+        : [ targets.main-target-default-build $(default-build) : $(project) ]
+        : [ targets.main-target-usage-requirements $(usage-requirements) :
+            $(project) ] ] ] ;
 }
 
 
 # Creates a typed-target with the specified properties. The 'name', 'sources',
 # 'requirements', 'default-build' and 'usage-requirements' are assumed to be in
-# the form specified by the user in Jamfile corresponding to 'project'.
+# the form specified by the user in the Jamfile corresponding to 'project'.
 #
 rule create-typed-target ( type : project : name : sources * : requirements * :
     default-build * : usage-requirements * )
 {
-    return [
-        targets.main-target-alternative
-        [ new typed-target $(name) : $(project) : $(type)
-            : [ targets.main-target-sources $(sources) : $(name) ]
-            : [ targets.main-target-requirements $(requirements) : $(project) ]
-            : [ targets.main-target-default-build $(default-build) : $(project) ]
-            : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ]
-        ] ] ;
+    return [ targets.main-target-alternative [ new typed-target $(name) :
+        $(project) : $(type)
+        : [ targets.main-target-sources $(sources) : $(name) ]
+        : [ targets.main-target-requirements $(requirements) : $(project) ]
+        : [ targets.main-target-default-build $(default-build) : $(project) ]
+        : [ targets.main-target-usage-requirements $(usage-requirements) :
+            $(project) ] ] ] ;
 }
Modified: trunk/tools/build/v2/build/virtual-target.jam
==============================================================================
--- trunk/tools/build/v2/build/virtual-target.jam	(original)
+++ trunk/tools/build/v2/build/virtual-target.jam	2012-08-13 10:35:56 EDT (Mon, 13 Aug 2012)
@@ -9,16 +9,7 @@
 # build, but are not yet targets in Jam sense. They are needed, for example,
 # when searching for possible transformation sequences, when it is not yet known
 # whether a particular target should be created at all.
-
-import "class" : new ;
-import errors ;
-import path ;
-import sequence ;
-import set ;
-import type ;
-import utility ;
-
-
+#
 #                       +--------------------------+
 #                       | virtual-target           |
 #                       +==========================+
@@ -66,6 +57,13 @@
 # The 'compile-action' and 'link-action' classes are not defined here but in
 # builtin.jam modules. They are shown in the diagram to give the big picture.
 
+import "class" : new ;
+import path ;
+import sequence ;
+import set ;
+import type ;
+import utility ;
+
 
 # Models a potential target. It can be converted into a Jam target and used in
 # building, if needed. However, it can be also dropped, which allows us to
@@ -168,6 +166,7 @@
     #
     rule actualize-action ( target )
     {
+        import errors : error : errors.error ;
         errors.error "method should be defined in derived classes" ;
     }
 
@@ -175,6 +174,7 @@
     #
     rule actualize-location ( target )
     {
+        import errors : error : errors.error ;
         errors.error "method should be defined in derived classes" ;
     }
 
@@ -183,6 +183,7 @@
     #
     rule path ( )
     {
+        import errors : error : errors.error ;
         errors.error "method should be defined in derived classes" ;
     }
 
@@ -191,6 +192,7 @@
     #
     rule actual-name ( )
     {
+        import errors : error : errors.error ;
         errors.error "method should be defined in derived classes" ;
     }
 
@@ -201,6 +203,7 @@
         # abstract-file-target as the latter is the only class derived from the
         # former. But that has been left for later.
 
+        import errors : error : errors.error ;
         errors.error "method should be defined in derived classes" ;
     }
 }
@@ -286,8 +289,8 @@
 
     # Gets or sets the subvariant which created this target. Subvariant is set
     # when target is brought into existance and is never changed after that. In
-    # particular, if a target is shared by a subvariant, only the first is
-    # stored.
+    # particular, if a target is shared by multiple subvariants, only the first
+    # one is stored.
     #
     rule creating-subvariant ( s ?  # If specified, specifies the value to set,
                                     # which should be a 'subvariant' class
@@ -446,8 +449,9 @@
             {
                 if $(tag[2])
                 {
-                    errors.error "<tag>@rulename is present but is not the only"
-                        "<tag> feature" ;
+                    import errors : error : errors.error ;
+                    errors.error <tag>@rulename is present but is not the only
+                        <tag> feature. ;
                 }
 
                 self.name = [ indirect.call $(rule-name) $(specified-name)
@@ -455,8 +459,8 @@
             }
             else
             {
-                errors.error
-                    "The value of the <tag> feature must be '@rule-name'" ;
+                import errors : error : errors.error ;
+                errors.error <tag> property value must be '@rule-name'. ;
             }
         }
 
@@ -547,7 +551,6 @@
 {
     import "class" : new ;
     import common ;
-    import errors ;
 
     rule __init__ (
         name exact ?
@@ -702,13 +705,12 @@
 class action
 {
     import "class" ;
-    import errors ;
-    import type ;
-    import toolset ;
-    import property-set ;
     import indirect ;
     import path ;
+    import property-set ;
     import set : difference ;
+    import toolset ;
+    import type ;
 
     rule __init__ ( sources * : action-name + : property-set ? )
     {
@@ -723,6 +725,7 @@
 
         if ! [ class.is-instance $(property-set) ]
         {
+            import errors : error : errors.error ;
             errors.error "Property set instance required" ;
         }
 
@@ -1075,6 +1078,7 @@
             properties-added = [ set.difference $(p2) : $(p1) ] ;
             properties-added ?= "none" ;
         }
+        import errors : error : errors.error ;
         errors.error "Duplicate name of actual target:" $(actual-name)
             : "previous virtual target" [ $(.actual.$(actual-name)).str ]
             : "created from"            [ $(cmt1).full-name ]
Modified: trunk/tools/build/v2/tools/doxygen.jam
==============================================================================
--- trunk/tools/build/v2/tools/doxygen.jam	(original)
+++ trunk/tools/build/v2/tools/doxygen.jam	2012-08-13 10:35:56 EDT (Mon, 13 Aug 2012)
@@ -33,15 +33,14 @@
 import path ;
 import print ;
 import project ;
-import regex ;
 import stage ;
 import toolset ;
 import utility ;
 import xsltproc ;
 
 
-# Use to specify extra configuration paramters. These get translated
-# into a doxyfile which configures the building of the docs.
+# Use to specify extra configuration paramters. These get translated into a
+# doxyfile which configures the building of the docs.
 feature.feature doxygen:param : : free ;
 
 # Specify the "<xsl:param>boost.doxygen.header.prefix" XSLT option.
@@ -85,6 +84,7 @@
 
 type.register DOXYGEN_XML_IMAGES : doxygen-xml-images ;
 
+
 # Initialize the Doxygen module. Parameters are:
 #   name: the name of the 'doxygen' executable. If not specified, the name
 #         'doxygen' will be used
@@ -131,17 +131,17 @@
     }
 }
 
+
 local rule freeze-config ( )
 {
     if ! $(.initialized)
     {
         import errors ;
-        errors.user-error "doxygen must be initialized before it can be used." ;
+        errors.user-error doxygen must be initialized before it can be used. ;
     }
     if ! $(.config-frozen)
     {
         .config-frozen = true ;
-
         if [ .is-cygwin ]
         {
             .is-cygwin = true ;
@@ -149,6 +149,7 @@
     }
 }
 
+
 local rule modify-config ( )
 {
     if $(.config-frozen)
@@ -158,6 +159,7 @@
     }
 }
 
+
 local rule check-doxygen ( )
 {
     if --debug-configuration in [ modules.peek : ARGV ]
@@ -181,12 +183,14 @@
         $(extra-paths) ] ;
 }
 
+
 rule name ( )
 {
     freeze-config ;
     return $(.doxygen) ;
 }
 
+
 local rule .is-cygwin ( )
 {
     if [ os.on-windows ]
@@ -205,6 +209,7 @@
     }
 }
 
+
 # Runs Doxygen on the given Doxygen configuration file (the source) to generate
 # the Doxygen files. The output is dumped according to the settings in the
 # Doxygen configuration file, not according to the target! Because of this, we
@@ -281,7 +286,7 @@
     # Translate <doxygen:param> into command line flags.
     for local param in [ feature.get-values <doxygen:param> : $(properties) ]
     {
-        local namevalue = [ regex.match ([^=]*)=(.*) : $(param) ] ;
+        local namevalue = [ MATCH ([^=]*)=(.*) : $(param) ] ;
         if $(namevalue[1]) = OUTPUT_DIRECTORY
         {
             output-dir = [ translate-path [ utility.unquote $(namevalue[2]) ] ]
@@ -343,6 +348,7 @@
         return $(LOCATE) ] ] $(target:B:S=) *.xml ] ] ;
 }
 
+
 if [ os.name ] = NT
 {
     RMDIR = rmdir /s /q ;
@@ -357,6 +363,7 @@
     $(RMDIR) $(HTMLDIR)
 }
 
+
 # The rules below require Boost.Book stylesheets, so we need some code to check
 # that the boostbook module has actualy been initialized.
 #
@@ -499,6 +506,7 @@
     echo "Stamped" > "$(<)"
 }
 
+
 # Building latex images for doxygen XML depends on latex, dvips, and ps being in
 # your PATH. This is true for most Unix installs, but not on Win32, where you
 # will need to install MkTex and Ghostscript and add these tools to your path.
@@ -528,6 +536,7 @@
     }
 }
 
+
 rule check-tools ( project )
 {
     if ! $(.check-tools-targets)
@@ -561,6 +570,7 @@
     return $(.check-tools-targets) ;
 }
 
+
 project.initialize $(__name__) ;
 project doxygen ;
 
@@ -573,17 +583,14 @@
     }
 }
 
-{
-    local project = [ project.current ] ;
-    targets.main-target-alternative
-        [ new doxygen-check-tools-target-class check-tools : $(project)
-            : [ targets.main-target-sources : check-tools : no-renaming ]
-            : [ targets.main-target-requirements : $(project) ]
-            : [ targets.main-target-default-build : $(project) ]
-            : [ targets.main-target-usage-requirements : $(project) ] ] ;
+
+targets.create-metatarget doxygen-check-tools-target-class : [ project.current ]
+    : check-tools ;
 }
 
-# User-level rule to generate BoostBook XML from a set of headers via Doxygen.
+
+# User-level rule to generate HTML files or BoostBook XML from a set of headers
+# via Doxygen.
 #
 rule doxygen ( target : sources * : requirements * : default-build * :
     usage-requirements * )
@@ -614,42 +621,32 @@
         local output-dir-native = [ path.native $(output-dir) ] ;
         requirements = [ property.change $(requirements) : <location> ] ;
 
-        ## The doxygen configuration file.
-        targets.main-target-alternative
-            [ new typed-target $(target:S=.tag) : $(project) : DOXYFILE
-                : [ targets.main-target-sources $(sources) : $(target:S=.tag) ]
-                : [ targets.main-target-requirements $(requirements)
-                    <doxygen:param>GENERATE_HTML=YES
-                    <doxygen:param>GENERATE_XML=NO
-                    <doxygen:param>"OUTPUT_DIRECTORY=\"$(output-dir-native)\""
-                    <doxygen:param>HTML_OUTPUT=$(target:B)
-                    : $(project) ]
-                : [ targets.main-target-default-build $(default-build) :
-                    $(project) ] ] ;
+        # The doxygen configuration file.
+        targets.create-typed-target DOXYFILE : $(project) : $(target:S=.tag)
+            : $(sources)
+            : $(requirements)
+                <doxygen:param>GENERATE_HTML=YES
+                <doxygen:param>GENERATE_XML=NO
+                <doxygen:param>"OUTPUT_DIRECTORY=\"$(output-dir-native)\""
+                <doxygen:param>HTML_OUTPUT=$(target:B)
+            : $(default-build) ;
         $(project).mark-target-as-explicit $(target:S=.tag) ;
 
-        ## The html directory to generate by running doxygen.
-        targets.main-target-alternative
-            [ new typed-target $(target:S=.dir) : $(project)
-                : DOXYGEN_HTML_MULTIFILE
-                : $(target:S=.tag)
-                : [ targets.main-target-requirements $(requirements)
-                    <doxygen:param>"OUTPUT_DIRECTORY=\"$(output-dir-native)\""
-                    <doxygen:param>HTML_OUTPUT=$(target:B)
-                    : $(project) ]
-                : [ targets.main-target-default-build $(default-build) :
-                    $(project) ] ] ;
+        # The html directory to generate by running doxygen.
+        targets.create-typed-target DOXYGEN_HTML_MULTIFILE : $(project)
+            : $(target:S=.dir)  # Name.
+            : $(target:S=.tag)  # Sources.
+            : $(requirements)
+                <doxygen:param>"OUTPUT_DIRECTORY=\"$(output-dir-native)\""
+                <doxygen:param>HTML_OUTPUT=$(target:B)
+            : $(default-build) ;
         $(project).mark-target-as-explicit $(target:S=.dir) ;
 
-        ## The redirect html file into the generated html.
-        targets.main-target-alternative
-            [ new typed-target $(target) : $(project) : DOXYGEN_HTML
-                : $(target:S=.dir)
-                : [ targets.main-target-requirements $(requirements)
-                    <location>$(output-dir)
-                    : $(project) ]
-                : [ targets.main-target-default-build $(default-build) :
-                    $(project) ] ] ;
+        # The redirect html file into the generated html.
+        targets.create-typed-target DOXYGEN_HTML : $(project) : $(target)
+            : $(target:S=.dir)  # Sources.
+            : $(requirements) <location>$(output-dir)
+            : $(default-build) ;
     }
     else
     {
@@ -660,34 +657,28 @@
         local target-xml = $(target:B=$(target:B)-xml) ;
 
         # Check whether we need to build images.
-        local images-location =
-            [ feature.get-values <doxygen:xml-imagedir> : $(requirements) ] ;
+        local images-location = [ feature.get-values <doxygen:xml-imagedir> :
+            $(requirements) ] ;
         if $(images-location)
         {
-            doxygen $(target).doxygen-xml-images.html : $(sources)
-                : $(requirements)
-                  <doxygen.rmdir>on
-                  <doxygen:param>QUIET=YES
-                  <doxygen:param>WARNINGS=NO
-                  <doxygen:param>WARN_IF_UNDOCUMENTED=NO
-                  <dependency>/doxygen//check-tools ;
-            $(project).mark-target-as-explicit
-                $(target).doxygen-xml-images.html ;
-
-            targets.main-target-alternative
-                [ new typed-target $(target).doxygen-xml-images
-                    : $(project) : DOXYGEN_XML_IMAGES
-                    : $(target).doxygen-xml-images.html
-                    : [ targets.main-target-requirements $(requirements)
-                        : $(project) ]
-                    : [ targets.main-target-default-build $(default-build)
-                        : $(project) ]
-                ] ;
+            doxygen $(target).doxygen-xml-images.html : $(sources) :
+                $(requirements)
+                <doxygen.rmdir>on
+                <doxygen:param>QUIET=YES
+                <doxygen:param>WARNINGS=NO
+                <doxygen:param>WARN_IF_UNDOCUMENTED=NO
+                <dependency>/doxygen//check-tools ;
+            $(project).mark-target-as-explicit $(target).doxygen-xml-images.html
+                ;
 
-            $(project).mark-target-as-explicit
-                $(target).doxygen-xml-images ;
+            targets.create-typed-target DOXYGEN_XML_IMAGES : $(project)
+                : $(target).doxygen-xml-images  # Name.
+                : $(target).doxygen-xml-images.html  # Sources.
+                : $(requirements)
+                : $(default-build) ;
+            $(project).mark-target-as-explicit $(target).doxygen-xml-images ;
 
-            if ! [ regex.match "^(.*/)$" : $(images-location) ]
+            if ! [ MATCH (/)$ : $(images-location) ]
             {
                 images-location = $(images-location)/ ;
             }
@@ -697,61 +688,45 @@
                 <xsl:param>boost.doxygen.formuladir=$(images-location) ;
         }
 
-        ## The doxygen configuration file.
-        targets.main-target-alternative
-            [ new typed-target $(target-xml:S=.tag) : $(project) : DOXYFILE
-                : [ targets.main-target-sources $(sources) :
-                    $(target-xml:S=.tag) ]
-                : [ targets.main-target-requirements $(requirements)
-                    <doxygen:param>GENERATE_HTML=NO
-                    <doxygen:param>GENERATE_XML=YES
-                    <doxygen:param>XML_OUTPUT=$(target-xml)
-                    : $(project) ]
-                : [ targets.main-target-default-build $(default-build) :
-                    $(project) ] ] ;
+        # The doxygen configuration file.
+        targets.create-typed-target DOXYFILE : $(project) : $(target-xml:S=.tag)
+            : $(sources)
+            : $(requirements)
+                <doxygen:param>GENERATE_HTML=NO
+                <doxygen:param>GENERATE_XML=YES
+                <doxygen:param>XML_OUTPUT=$(target-xml)
+            : $(default-build) ;
         $(project).mark-target-as-explicit $(target-xml:S=.tag) ;
 
-        ## The Doxygen XML directory of the processed source files.
-        targets.main-target-alternative
-            [ new typed-target $(target-xml:S=.dir) : $(project)
-                : DOXYGEN_XML_MULTIFILE
-                : $(target-xml:S=.tag)
-                : [ targets.main-target-requirements $(requirements)
-                    : $(project) ]
-                : [ targets.main-target-default-build $(default-build) :
-                    $(project) ] ] ;
+        # The Doxygen XML directory for the processed source files.
+        targets.create-typed-target DOXYGEN_XML_MULTIFILE : $(project)
+            : $(target-xml:S=.dir)  # Name.
+            : $(target-xml:S=.tag)  # Sources.
+            : $(requirements)
+            : $(default-build) ;
         $(project).mark-target-as-explicit $(target-xml:S=.dir) ;
 
-        ## The resulting BoostBook file is generated by the processor tool. The
-        ## tool can be either the xsltproc plus accompanying XSL scripts. Or it
-        ## can be the python doxproc.py script.
-        targets.main-target-alternative
-            [ new typed-target $(target-xml) : $(project) : BOOSTBOOK
-                :  $(target-xml:S=.dir)
-                : [ targets.main-target-requirements $(requirements)
-                    : $(project) ]
-                : [ targets.main-target-default-build $(default-build) :
-                    $(project) ] ] ;
+        # The resulting BoostBook file is generated by the processor tool. The
+        # tool can be either the xsltproc plus accompanying XSL scripts. Or it
+        # can be the python doxproc.py script.
+        targets.create-typed-target BOOSTBOOK : $(project) : $(target-xml)
+            : $(target-xml:S=.dir)  # Sources.
+            : $(requirements)
+            : $(default-build) ;
         $(project).mark-target-as-explicit $(target-xml) ;
 
-        targets.main-target-alternative
-            [ new install-target-class $(target:S=.xml) : $(project)
-                : $(target-xml)
-                : [ targets.main-target-requirements $(requirements)
-                    <location>$(location-xml:E=.)
-                    <name>$(target:S=.xml)
-                    : $(project) ]
-                : [ targets.main-target-default-build $(default-build) :
-                    $(project) ] ] ;
+        stage $(target:S=.xml)  # Name.
+            : $(target-xml)  # Sources.
+            : $(requirements)
+                <location>$(location-xml:E=.)
+                <name>$(target:S=.xml)
+            : $(default-build) ;
         $(project).mark-target-as-explicit $(target:S=.xml) ;
 
-        targets.main-target-alternative
-            [ new alias-target-class $(target) : $(project) :
-                : [ targets.main-target-requirements $(requirements)
-                    : $(project) ]
-                : [ targets.main-target-default-build $(default-build) :
-                    $(project) ]
-                : [ targets.main-target-usage-requirements $(usage-requirements)
-                    <dependency>$(target:S=.xml) : $(project) ] ] ;
+        # TODO: See why this alias target is used here instead of simply naming
+        # the previous stage target $(target) and having it specify the alias
+        # target's usage requirements directly.
+        alias $(target) : : $(requirements) : $(default-build) :
+            $(usage-requirements) <dependency>$(target:S=.xml) ;
     }
 }
Modified: trunk/tools/build/v2/tools/stage.jam
==============================================================================
--- trunk/tools/build/v2/tools/stage.jam	(original)
+++ trunk/tools/build/v2/tools/stage.jam	2012-08-13 10:35:56 EDT (Mon, 13 Aug 2012)
@@ -2,21 +2,21 @@
 # Copyright 2005, 2006 Rene Rivera
 # Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
 # Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
 
 # This module defines the 'install' rule, used to copy a set of targets to a
 # single location.
 
-import targets ;
 import "class" : new ;
-import errors ;
-import type ;
-import generators ;
 import feature ;
-import project ;
-import virtual-target ;
+import generators ;
 import path ;
+import project ;
+import targets ;
+import type ;
 import types/register ;
+import virtual-target ;
 
 
 feature.feature <install-dependencies> : off on : incidental      ;
@@ -31,19 +31,23 @@
 
 class install-target-class : basic-target
 {
+    import "class" : new ;
     import feature ;
-    import project ;
-    import type ;
-    import errors ;
     import generators ;
     import path ;
-    import stage ;
-    import "class" : new ;
+    import project ;
     import property ;
     import property-set ;
+    import stage ;
+    import type ;
 
-    rule __init__ ( name-and-dir : project : sources * : requirements * : default-build * )
+    rule __init__ ( name-and-dir : project : sources * : requirements * :
+        default-build * : usage-requirements * )
     {
+        # The usage-requirements specified here are ignored but are taken as a
+        # parameter to have this metatarget class have the same standard
+        # instantiation interface as all the other Boost Build metatarget
+        # classes.
         basic-target.__init__ $(name-and-dir) : $(project) : $(sources) :
             $(requirements) : $(default-build) ;
     }
@@ -140,8 +144,9 @@
 
         if $(ename) && $(source-targets[2])
         {
-            errors.error "When <name> property is used in 'install', only one"
-                "source is allowed" ;
+            import errors : error : $(__name__) : errors.error ;
+            errors.error When <name> property is used "in" 'install', only one
+                source is allowed. ;
         }
 
         local result ;
@@ -159,7 +164,9 @@
             {
                 if $(ename)
                 {
-                    errors.error "In 'install': <name> property specified with target that requires relinking." ;
+                    import errors : error : $(__name__) : errors.error ;
+                    errors.error In 'install': <name> property specified with
+                        target that requires relinking. ;
                 }
                 else
                 {
@@ -176,7 +183,9 @@
 
             if ! $(staged-targets)
             {
-                errors.error "Unable to generate staged version of " [ $(source).str ] ;
+                import errors : error : $(__name__) : errors.error ;
+                errors.error Unable to generate staged version of
+                    [ $(source).str ] ;
             }
 
             for t in $(staged-targets)
@@ -226,8 +235,8 @@
             }
             else if ! $(included-types)
             {
-                # Don't install typeless target if there is an explicit list of
-                # allowed types.
+                # Do not install typeless targets if there is an explicit list
+                # of allowed types.
                 result += $(r) ;
             }
         }
@@ -246,10 +255,10 @@
             s += [ $(t).creating-subvariant ] ;
         }
         s = [ sequence.unique $(s) ] ;
-        
+
         local result = [ new set ] ;
         $(result).add $(targets) ;
-        
+
         for local i in $(s)
         {
             $(i).all-referenced-targets $(result) ;
@@ -357,38 +366,25 @@
 
     rule run ( project name ? : property-set : source : multiple ? )
     {
-        local need-relink ;
-        
-        if [ $(property-set).get <os> ] in NT CYGWIN ||
-            [ $(property-set).get <target-os> ] in windows cygwin
-        {
-        }
-        else
+        local stage-rule = stage.copy-file ;
+
+        if ! [ $(property-set).get <os> ] in NT CYGWIN &&
+            ! [ $(property-set).get <target-os> ] in windows cygwin
         {
-            # See if the dll-path properties are not changed during
-            # install. If so, copy, don't relink.
+            # If dll-path properties have been changed for the stage target,
+            # relink instead of copying.
             local a = [ $(source).action ] ;
             local p = [ $(a).properties ] ;
             local original = [ $(p).get <dll-path> ] ;
             local current = [ $(property-set).get <dll-path> ] ;
-            
+
             if $(current) != $(original)
             {
-                need-relink = true ;
-            }            
-        }
-        
-            
-        if $(need-relink)
-        {
-            return [ stage.relink-file $(project)
-              : $(source) : $(property-set) ] ;
-        }
-        else
-        {
-            return [ stage.copy-file $(project)
-              : $(source) : $(property-set) ] ;
+                stage-rule = stage.relink-file ;
+            }
         }
+
+        return [ $(stage-rule) $(project) : $(source) : $(property-set) ] ;
     }
 }
 
@@ -410,8 +406,8 @@
 
     rule __init__ ( )
     {
-        generator.__init__ install-shared-lib : SHARED_LIB
-          : INSTALLED_SHARED_LIB ;
+        generator.__init__ install-shared-lib : SHARED_LIB :
+            INSTALLED_SHARED_LIB ;
     }
 
     rule run ( project name ? : property-set : source : multiple ? )
@@ -458,8 +454,9 @@
             # If the name is in the form NNN.XXX.YYY.ZZZ, where all 'X', 'Y' and
             # 'Z' are numbers, we need to create NNN.XXX and NNN.XXX.YYY
             # symbolic links.
-            local m = [ MATCH (.*)\\.([0123456789]+)\\.([0123456789]+)\\.([0123456789]+)$
-                : [ $(copied).name ] ] ;
+            local m = [ MATCH
+                (.*)\\.([0123456789]+)\\.([0123456789]+)\\.([0123456789]+)$ :
+                [ $(copied).name ] ] ;
             if $(m)
             {
                 # Symlink without version at all is used to make
@@ -472,15 +469,15 @@
                 # libfoo.N. That happens when the library makes some binary
                 # compatibility guarantees. If not, it is possible to skip those
                 # symlinks.
-                local suppress =
-                    [ $(property-set).get <install-no-version-symlinks> ] ;
+                local suppress = [ $(property-set).get
+                    <install-no-version-symlinks> ] ;
 
                 if $(suppress) != "on"
                 {
-                    result += [ stage.symlink $(m[1]).$(m[2]) : $(project)
-                      : $(copied) : $(property-set) ] ;
-                    result += [ stage.symlink $(m[1]).$(m[2]).$(m[3])  : $(project)
-                      : $(copied) : $(property-set) ] ;
+                    result += [ stage.symlink $(m[1]).$(m[2]) : $(project) :
+                        $(copied) : $(property-set) ] ;
+                    result += [ stage.symlink $(m[1]).$(m[2]).$(m[3]) :
+                        $(project) : $(copied) : $(property-set) ] ;
                 }
             }
 
@@ -507,16 +504,13 @@
 
     if <tag> in $(requirements:G)
     {
-        errors.user-error
-            "The <tag> property is not allowed for the 'install' rule" ;
+        import errors ;
+        errors.user-error The <tag> property is not allowed for the 'install'
+            rule. ;
     }
 
-    targets.main-target-alternative
-      [ new install-target-class $(name) : $(project)
-        : [ targets.main-target-sources $(sources) : $(name) ]
-        : [ targets.main-target-requirements $(requirements) : $(project) ]
-        : [ targets.main-target-default-build $(default-build) : $(project) ]
-      ] ;
+    targets.create-metatarget install-target-class : $(project) : $(name) :
+        $(sources) : $(requirements) : $(default-build) ;
 }
 
 
Modified: trunk/tools/build/v2/util/regex.jam
==============================================================================
--- trunk/tools/build/v2/util/regex.jam	(original)
+++ trunk/tools/build/v2/util/regex.jam	2012-08-13 10:35:56 EDT (Mon, 13 Aug 2012)
@@ -3,7 +3,8 @@
 # Copyright 2003 Rene Rivera
 # Copyright 2002, 2003, 2004, 2005 Vladimir Prus
 # Distributed under the Boost Software License, Version 1.0.
-# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
+# (See accompanying file LICENSE_1_0.txt or copy at
+# http://www.boost.org/LICENSE_1_0.txt)
 
 #
 #   Returns a list of the following substrings: