Boost logo

Boost-Build :

From: Alexey Pakhunov (alexeypa_at_[hidden])
Date: 2005-09-15 01:11:00


Vladimir Prus wrote:
> The trick used in msvc.jam for that is to define a global variable. Say:
>
> .SETUP = "x86" ;
> flags msvc .SETUP <architecture>x86/<address-model>32 : " x86" ;
> flags msvc .SETUP <architecture>x86/<address-model>64 : " x86_amd64" ;
> flags msvc .SETUP <architecture>ia64/<address-model>64 : " x86_ia64" ;
>
> Now, if neithe condition matches, you get the global value. Will that be
> enough?

No, because I want to match such conditions as

flags msvc .SETUP <architecture>/<address-model>64 : " x86_amd64" ;
flags msvc .SETUP <architecture>ia64/<address-model> : " x86_ia64" ;

> It's not a typo, I think. "iff" is math means "if and only if" ;-)

Oops. :-)

> What about
> local prop-keys = $(properties:G) ;

We all sometimes do stupid things. :-)

> This comment is hard to understand, due to double use of "such" and unclear
> meaning of "used for matching". Can you try to improve?

Sure.

> Also, I suggest that you change the description of the 'flags' rule to mention
> this use case.

Added.

Best regards/Venlig hilsen,
Alexey Pakhunov.

 --------------010604060506050509000400 Content-Type: text/plain;
name="empty-optional.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="empty-optional.diff"

? empty-optional.diff
Index: feature.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/build/feature.jam,v
retrieving revision 1.56
diff -c -r1.56 feature.jam
*** feature.jam 28 May 2004 10:45:30 -0000 1.56
--- feature.jam 14 Sep 2005 20:06:59 -0000
***************
*** 425,431 ****
values = [ regex.split $(value-string) - ] ;
}

! if ! ( $(values[1]) in $($(feature).values) )
{
error \"$(values[1])\" is not a known value of feature $(feature)
: legal values: \"$($(feature).values)\" ;
--- 425,434 ----
values = [ regex.split $(value-string) - ] ;
}

! if ! ( $(values[1]) in $($(feature).values) ) &&
!
! # An empty value is allowed for optional features
! ( $(values[1]) || ! ( optional in $($(feature).attributes) ) )
{
error \"$(values[1])\" is not a known value of feature $(feature)
: legal values: \"$($(feature).values)\" ;
***************
*** 585,591 ****

if $(composite-property) in $(components)
{
! errror composite property "$(composite-property)" cannot have itself as a component ;
}
$(composite-property).components = $(component-properties) ;
}
--- 588,594 ----

if $(composite-property) in $(components)
{
! error composite property "$(composite-property)" cannot have itself as a component ;
}
$(composite-property).components = $(component-properties) ;
}
Index: property.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/build/property.jam,v
retrieving revision 1.51
diff -c -r1.51 property.jam
*** property.jam 16 Jun 2005 10:59:03 -0000 1.51
--- property.jam 2 Sep 2005 06:04:07 -0000
***************
*** 249,255 ****
{
feature.validate-value-string $(feature) $(value) ;
}
! else if ! $(value)
{
feature = [ ungrist $(property:G) ] ; # Ungrist for better error messages
msg = "No value specified for feature '$(feature)'" ;
--- 249,255 ----
{
feature.validate-value-string $(feature) $(value) ;
}
! else if ! ( $(value) || ( optional in [ feature.attributes $(feature) ] ) )
{
feature = [ ungrist $(property:G) ] ; # Ungrist for better error messages
msg = "No value specified for feature '$(feature)'" ;
Index: toolset.jam
===================================================================
RCS file: /cvsroot/boost/boost/tools/build/v2/build/toolset.jam,v
retrieving revision 1.34
diff -c -r1.34 toolset.jam
*** toolset.jam 5 Aug 2005 09:43:15 -0000 1.34
--- toolset.jam 15 Sep 2005 06:08:32 -0000
***************
*** 66,71 ****
--- 66,74 ----
# "gcc". Subfeatures, like in "<toolset>gcc-3.2"
# are allowed. If left empty, the flag will
# always used.
+ #
+ # Propery sets may use value-less properties ('<a>'
+ # vs. '<a>value') to match absent properties.

values * : # The value to add to variable. If <feature>
***************
*** 129,140 ****
# 'properties', or an empty list if no such element exists.
rule find-property-subset ( property-sets * : properties * )
{
local result ;
for local s in $(property-sets)
{
if ! $(result)
{
! if [ feature.split $(s) ] in $(properties)
{
result = $(s) ;
}
--- 132,169 ----
# 'properties', or an empty list if no such element exists.
rule find-property-subset ( property-sets * : properties * )
{
+ # cut property values off
+ local prop-keys = $(properties:G) ;
+
local result ;
for local s in $(property-sets)
{
if ! $(result)
{
! # Handle value-less properties like '<architecture>' (compare with
! # '<architecture>x86').
!
! local set = [ feature.split $(s) ] ;
!
! local default-props ;
! for local i in $(set)
! {
! # If $(i) is a value-less property it should match default value
! # of an optional property. See the first line in the example below:
! #
! # property set properties result
! # <a> <b>foo <b>foo match
! # <a> <b>foo <a>foo <b>foo no match
! # <a>foo <b>foo <b>foo no match
! # <a>foo <b>foo <a>foo <b>foo match
!
! if ! ( $(i:G=) || ( $(i:G) in $(prop-keys) ) )
! {
! default-props += $(i) ;
! }
! }
!
! if $(set) in $(properties) $(default-props)
{
result = $(s) ;
}
***************
*** 381,384 ****
--- 410,419 ----
local p = <b>0 <c>1 <d>2 <e>3 <f>4 ;
assert.result <c>1/<d>2/<e>3 : find-property-subset <c>1/<d>2/<e>3 <a>0/<b>0/<c>1 <d>2/<e>5 <a>9 : $(p) ;
assert.result : find-property-subset <a>0/<b>0/<c>9/<d>9/<e>5 <a>9 : $(p) ;
+
+ local p-set = <a>/<b> <a>0/<b> <a>/<b>1 <a>0/<b>1 ;
+ assert.result <a>/<b> : find-property-subset $(p-set) : ;
+ assert.result <a>0/<b> : find-property-subset $(p-set) : <a>0 <c>2 ;
+ assert.result <a>/<b>1 : find-property-subset $(p-set) : <b>1 <c>2 ;
+ assert.result <a>0/<b>1 : find-property-subset $(p-set) : <a>0 <b>1 ;
}
 --------------010604060506050509000400--


Boost-Build 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