2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 00:52:16 +00:00

Minor stylistic Boost Build code changes.

[SVN r45023]
This commit is contained in:
Jurko Gospodnetić
2008-05-02 15:26:44 +00:00
parent b800e2be7a
commit 47b22866b8
3 changed files with 120 additions and 120 deletions

View File

@@ -4,8 +4,8 @@
# 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)
# This module defines the 'install' rule, used to copy a set of targets to a
# single location
# This module defines the 'install' rule, used to copy a set of targets to a
# single location.
import targets ;
import "class" : new ;
@@ -49,6 +49,7 @@ class install-target-class : basic-target
}
# If <location> is not set, sets it based on the project data.
#
rule update-location ( property-set )
{
local loc = [ $(property-set).get <location> ] ;
@@ -62,8 +63,9 @@ class install-target-class : basic-target
return $(property-set) ;
}
# Takes a target that is installed and property set which is
# used when installing.
# Takes a target that is installed and a property set which is used when
# installing.
#
rule adjust-properties ( target : build-property-set )
{
local ps-raw ;
@@ -73,33 +75,31 @@ class install-target-class : basic-target
local ps = [ $(a).properties ] ;
ps-raw = [ $(ps).raw ] ;
# Unless <hardcode-dll-paths>true is in properties, which can
# happen only if the user has explicitly requested it, nuke all
# Unless <hardcode-dll-paths>true is in properties, which can happen
# only if the user has explicitly requested it, nuke all.
# <dll-path> properties
if [ $(property-set).get <hardcode-dll-paths> ] != true
{
ps-raw = [ property.change $(ps-raw) : <dll-path> ] ;
}
# If any <dll-path> properties were specified for installing,
# add them.
# If any <dll-path> properties were specified for installing, add
# them.
local l = [ $(build-property-set).get <dll-path> ] ;
ps-raw += $(l:G=<dll-path>) ;
# Also copy <linkflags> feature from current build
# set, to be used for relinking.
# Also copy <linkflags> feature from current build set, to be used
# for relinking.
local l = [ $(build-property-set).get <linkflags> ] ;
ps-raw += $(l:G=<linkflags>) ;
}
# Remove the <tag> feature on original targets.
ps-raw = [ property.change $(ps-raw) : <tag> ] ;
# And <location>. If stage target has another stage target
# in sources, then we'll get virtual targets with <location>
# property set.
# And <location>. If stage target has another stage target in sources,
# then we'll get virtual targets with <location> property set.
ps-raw = [ property.change $(ps-raw) : <location> ] ;
local d = [ $(build-property-set).get <dependency> ] ;
ps-raw += $(d:G=<dependency>) ;
@@ -110,8 +110,8 @@ class install-target-class : basic-target
ps-raw += $(ns:G=<install-no-version-symlinks>) ;
local d = [ $(build-property-set).get <install-source-root> ] ;
# Make the path absolute: we'll use it to compute relative
# paths and making the path absolute will help.
# Make the path absolute: we'll use it to compute relative paths and
# making the path absolute will help.
if $(d)
{
d = [ path.root $(d) [ path.pwd ] ] ;
@@ -130,8 +130,8 @@ class install-target-class : basic-target
rule construct ( name : source-targets * : property-set )
{
source-targets = [
targets-to-stage $(source-targets) : $(property-set) ] ;
source-targets = [ targets-to-stage $(source-targets) :
$(property-set) ] ;
property-set = [ update-location $(property-set) ] ;
@@ -139,8 +139,8 @@ class install-target-class : basic-target
if $(ename) && $(source-targets[2])
{
errors.error
"When <name> property is used in 'install', only one source is allowed" ;
errors.error "When <name> property is used in 'install', only one"
"source is allowed" ;
}
local result ;
@@ -148,11 +148,11 @@ class install-target-class : basic-target
{
local staged-targets ;
local new-properties =
[ adjust-properties $(i) : $(property-set) ] ;
local new-properties = [ adjust-properties $(i) :
$(property-set) ] ;
# See if something special should be done when staging this
# type. It is indicated by presense of special "staged" type
# See if something special should be done when staging this type. It
# is indicated by the presense of special "INSTALLED_" type.
local t = [ $(i).type ] ;
if $(t) && [ type.registered INSTALLED_$(t) ]
{
@@ -162,8 +162,8 @@ class install-target-class : basic-target
}
else
{
local targets = [ generators.construct $(self.project) $(name) :
INSTALLED_$(t) : $(new-properties) : $(i) ] ;
local targets = [ generators.construct $(self.project)
$(name) : INSTALLED_$(t) : $(new-properties) : $(i) ] ;
staged-targets += $(targets[2-]) ;
}
}
@@ -187,8 +187,9 @@ class install-target-class : basic-target
return [ property-set.empty ] $(result) ;
}
# Given the list of source targets explicitly passed to 'stage',
# returns the list of targets which must be staged.
# Given the list of source targets explicitly passed to 'stage', returns the
# list of targets which must be staged.
#
rule targets-to-stage ( source-targets * : property-set )
{
local result ;
@@ -206,7 +207,7 @@ class install-target-class : basic-target
local ty = [ $(r).type ] ;
if $(ty)
{
# Don't stage searched libs.
# Do not stage searched libs.
if $(ty) != SEARCHED_LIB
{
if $(included-types)
@@ -224,8 +225,8 @@ class install-target-class : basic-target
}
else if ! $(included-types)
{
# Don't install typeless target if there's
# explicit list of allowed types.
# Don't install typeless target if there is an explicit list of
# allowed types.
result += $(r) ;
}
}
@@ -234,6 +235,7 @@ class install-target-class : basic-target
}
# CONSIDER: figure out why we can't use virtual-target.traverse here.
#
rule collect-targets ( targets * )
{
# Find subvariants
@@ -261,6 +263,7 @@ class install-target-class : basic-target
}
# Returns true iff 'type' is subtype of some element of 'types-to-include'.
#
local rule include-type ( type : types-to-include * )
{
local found ;
@@ -280,41 +283,42 @@ class install-target-class : basic-target
# Creates a copy of target 'source'. The 'properties' object should have a
# <location> property which specifies where the target must be placed.
#
rule copy-file ( project name ? : source : properties )
{
local targets ;
name ?= [ $(source).name ] ;
new-a = [
new non-scanning-action $(source) : common.copy : $(properties) ] ;
local new-a = [ new non-scanning-action $(source) : common.copy :
$(properties) ] ;
local source-root = [ $(properties).get <install-source-root> ] ;
if $(source-root)
{
# Get the real path of the target. We probably need to strip
# relative path from the target name at construction...
# Get the real path of the target. We probably need to strip relative
# path from the target name at construction.
local path = [ $(source).path ] ;
path = [ path.root $(name:D) $(path) ] ;
# Make the path absolute. Otherwise, it's hard to compute relative
# path. The 'source-root' is already absolute, see the
# Make the path absolute. Otherwise, it would be hard to compute the
# relative path. The 'source-root' is already absolute, see the
# 'adjust-properties' method above.
path = [ path.root $(path) [ path.pwd ] ] ;
relative = [ path.relative-to $(source-root) $(path) ] ;
# Note: using $(name:D=$(relative)) might be faster
# here, but then we need to explicitly check that
# relative is not ".", otherwise we might get paths like
# Note: using $(name:D=$(relative)) might be faster here, but then we
# need to explicitly check that relative is not ".", otherwise we might
# get paths like
#
# <prefix>/boost/.
#
# try to create it, and mkdir will obviously fail.
name = [ path.root $(name:D=) $(relative) ] ;
targets = [ new file-target $(name) exact : [ $(source).type ]
: $(project) : $(new-a) ] ;
targets = [ new file-target $(name) exact : [ $(source).type ] :
$(project) : $(new-a) ] ;
}
else
{
targets = [ new file-target $(name:D=) exact : [ $(source).type ]
: $(project) : $(new-a) ] ;
targets = [ new file-target $(name:D=) exact : [ $(source).type ] :
$(project) : $(new-a) ] ;
}
return $(targets) ;
@@ -323,12 +327,9 @@ rule copy-file ( project name ? : source : properties )
rule symlink ( name : project : source : properties )
{
local a = [ new action $(source) : symlink.ln :
$(properties) ] ;
local targets = [
new file-target $(name) exact : [ $(source).type ] : $(project) : $(a) ] ;
return $(targets) ;
local a = [ new action $(source) : symlink.ln : $(properties) ] ;
return [ new file-target $(name) exact : [ $(source).type ] : $(project) :
$(a) ] ;
}
@@ -336,10 +337,8 @@ rule relink-file ( project : source : property-set )
{
local action = [ $(source).action ] ;
local cloned-action = [ virtual-target.clone-action $(action) : $(project) :
"" : $(property-set) ] ;
local result = [ $(cloned-action).targets ] ;
return $(result) ;
"" : $(property-set) ] ;
return [ $(cloned-action).targets ] ;
}
@@ -347,6 +346,7 @@ rule relink-file ( project : source : property-set )
# relinking to the new location.
type.register INSTALLED_EXE : : EXE ;
class installed-exe-generator : generator
{
import type ;
@@ -376,6 +376,7 @@ class installed-exe-generator : generator
}
}
generators.register [ new installed-exe-generator ] ;
@@ -383,6 +384,7 @@ generators.register [ new installed-exe-generator ] ;
# links.
type.register INSTALLED_SHARED_LIB : : SHARED_LIB ;
class installed-shared-lib-generator : generator
{
import type ;
@@ -401,12 +403,9 @@ class installed-shared-lib-generator : generator
if [ $(property-set).get <os> ] in NT CYGWIN ||
[ $(property-set).get <target-os> ] in windows cygwin
{
local copied = [ stage.copy-file $(project)
: $(source) : $(property-set) ] ;
copied = [ virtual-target.register $(copied) ] ;
return $(copied) ;
local copied = [ stage.copy-file $(project) : $(source) :
$(property-set) ] ;
return [ virtual-target.register $(copied) ] ;
}
else
{
@@ -415,8 +414,8 @@ class installed-shared-lib-generator : generator
if ! $(a)
{
# Non-derived file, just copy.
copied = [ stage.copy-file $(project)
: $(source) : $(property-set) ] ;
copied = [ stage.copy-file $(project) : $(source) :
$(property-set) ] ;
}
else
{
@@ -427,38 +426,38 @@ class installed-shared-lib-generator : generator
if $(current-dll-path) != $(new-dll-path)
{
# Rpath changed, need to relink.
copied = [ stage.relink-file
$(project) : $(source) : $(property-set) ] ;
copied = [ stage.relink-file $(project) : $(source) :
$(property-set) ] ;
}
else
{
copied = [ stage.copy-file $(project)
: $(source) : $(property-set) ] ;
copied = [ stage.copy-file $(project) : $(source) :
$(property-set) ] ;
}
}
copied = [ virtual-target.register $(copied) ] ;
local result = $(copied) ;
# 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.
# 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 ] ] ;
if $(m)
{
# Symlink without version at all is used to make
# -lsome_library work.
result += [ stage.symlink $(m[1]) : $(project)
: $(copied) : $(property-set) ] ;
result += [ stage.symlink $(m[1]) : $(project) : $(copied) :
$(property-set) ] ;
# Symlinks of some libfoo.N and libfoo.N.M are used
# so that library can found at runtime, if libfoo.N.M.X
# has soname of libfoo.N. That happens when the library
# makes some binary compatibility guarantees. If not,
# it's possible to skip those symlinks.
# Symlinks of some libfoo.N and libfoo.N.M are used so that
# library can found at runtime, if libfoo.N.M.X has soname of
# 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> ] ;
[ $(property-set).get <install-no-version-symlinks> ] ;
if $(suppress) != "on"
{
@@ -478,13 +477,13 @@ generators.register [ new installed-shared-lib-generator ] ;
# Main target rule for 'install'.
#
rule install ( name : sources * : requirements * : default-build * )
{
local project = [ project.current ] ;
# Unless the user has explicitly asked us to hardcode dll paths, add
# <hardcode-dll-paths>false in requirements, to override default
# value.
# <hardcode-dll-paths>false in requirements, to override default value.
if ! <hardcode-dll-paths>true in $(requirements)
{
requirements += <hardcode-dll-paths>false ;
@@ -504,5 +503,6 @@ rule install ( name : sources * : requirements * : default-build * )
] ;
}
IMPORT $(__name__) : install : : install ;
IMPORT $(__name__) : install : : stage ;