blob: 14c1328aff9520daf42fbe54a9a404f4320ddc34 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
# Copyright (c) 2010 Vladimir Prus.
#
# Use, modification and distribution is subject to 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 function to help with two main tasks:
#
# - Discovering build-time configuration for the purposes of adjusting
# build process.
# - Reporting what is built, and how it is configured.
import targets ;
import errors ;
import targets ;
import sequence ;
import property ;
import property-set ;
import "class" : new ;
import common ;
import path ;
rule log-summary ( )
{
}
.width = 30 ;
rule set-width ( width )
{
.width = $(width) ;
}
# Declare that the components specified by the parameter exist.
rule register-components ( components * )
{
.components += $(components) ;
}
# Declare that the components specified by the parameters will
# be build.
rule components-building ( components * )
{
.built-components += $(components) ;
}
# Report something about component configuration that the
# user should better know.
rule log-component-configuration ( component : message )
{
# FIXME: implement per-property-set logs
.component-logs.$(component) += $(message) ;
}
rule log-check-result ( result )
{
if ! $(.announced-checks)
{
ECHO "Performing configuration checks\n" ;
.announced-checks = 1 ;
}
ECHO $(result) ;
#.check-results += $(result) ;
}
rule log-library-search-result ( library : result )
{
local x = [ PAD " - $(library) : $(result)" : $(.width) ] ;
log-check-result "$(x)" ;
}
rule print-component-configuration ( )
{
local c = [ sequence.unique $(.components) ] ;
ECHO "\nComponent configuration:\n" ;
for c in $(.components)
{
local s ;
if $(c) in $(.built-components)
{
s = "building" ;
}
else
{
s = "not building" ;
}
ECHO [ PAD " - $(c)" : $(.width) ] ": $(s)" ;
for local m in $(.component-logs.$(c))
{
ECHO " -" $(m) ;
}
}
ECHO ;
}
rule print-configure-checks-summary ( )
{
# FIXME: the problem with that approach is tha
# the user sees checks summary when all checks are
# done, and has no progress reporting while the
# checks are being executed.
if $(.check-results)
{
ECHO "Configuration checks summary\n" ;
for local r in $(.check-results)
{
ECHO $(r) ;
}
ECHO ;
}
}
# Attempt to build a metatarget named by 'metatarget-reference'
# in context of 'project' with properties 'ps'.
# Returns non-empty value if build is OK.
rule builds-raw ( metatarget-reference : project : ps : what : retry ? )
{
local result ;
if ! $(retry) && ! $(.$(what)-tested.$(ps))
{
.$(what)-tested.$(ps) = true ;
local targets = [ targets.generate-from-reference
$(metatarget-reference) : $(project) : $(ps) ] ;
local jam-targets ;
for local t in $(targets[2-])
{
jam-targets += [ $(t).actualize ] ;
}
if ! UPDATE_NOW in [ RULENAMES ]
{
# Cannot determine. Assume existance.
}
else
{
local x = [ PAD " - $(what)" : $(.width) ] ;
if [ UPDATE_NOW $(jam-targets) :
$(.log-fd) : ignore-minus-n : ignore-minus-q ]
{
.$(what)-supported.$(ps) = yes ;
result = true ;
log-check-result "$(x) : yes" ;
}
else
{
log-check-result "$(x) : no" ;
}
}
return $(result) ;
}
else
{
return $(.$(what)-supported.$(ps)) ;
}
}
rule builds ( metatarget-reference : properties * : what ? : retry ? )
{
what ?= "$(metatarget-reference) builds" ;
# FIXME: this should not be hardcoded. Other checks might
# want to consider different set of features as relevant.
local toolset = [ property.select <toolset> : $(properties) ] ;
local toolset-version-property = "<toolset-$(toolset:G=):version>" ;
local relevant = [ property.select <target-os> <toolset> $(toolset-version-property)
<address-model> <architecture>
: $(properties) ] ;
local ps = [ property-set.create $(relevant) ] ;
local t = [ targets.current ] ;
local p = [ $(t).project ] ;
return [ builds-raw $(metatarget-reference) : $(p) : $(ps) : $(what) : $(retry) ] ;
}
# Called by Boost.Build startup code to specify name of a file
# that will receive results of configure checks. This
# should never be called by users.
rule set-log-file ( log-file )
{
path.makedirs [ path.parent $(log-file) ] ;
.log-fd = [ FILE_OPEN $(log-file) : "w" ] ;
}
# Frontend rules
class check-target-builds-worker
{
import configure ;
import property-set ;
import targets ;
import property ;
rule __init__ ( target message ? : true-properties * : false-properties * )
{
self.target = $(target) ;
self.message = $(message) ;
self.true-properties = $(true-properties) ;
self.false-properties = $(false-properties) ;
}
rule check ( properties * )
{
local choosen ;
if [ configure.builds $(self.target) : $(properties) : $(self.message) ]
{
choosen = $(self.true-properties) ;
}
else
{
choosen = $(self.false-properties) ;
}
return [ property.evaluate-conditionals-in-context $(choosen) : $(properties) ] ;
}
}
rule check-target-builds ( target message ? : true-properties * : false-properties * )
{
local instance = [ new check-target-builds-worker $(target) $(message) : $(true-properties)
: $(false-properties) ] ;
return <conditional>@$(instance).check ;
}
IMPORT $(__name__) : check-target-builds : : check-target-builds ;
|