blob: d466c9be12e36e179723aef208dffc8b2408a06b (
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
|
# Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
# Copyright (c) 2016-2018 Rene Rivera
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
project boost/doc
: requirements
<xsl:param>boost.libraries=../../libs/libraries.htm
<format>html:<xsl:param>chunker.output.doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
<format>html:<xsl:param>chunker.output.doctype-system="http://www.w3.org/TR/html4/loose.dtd"
;
import boostbook : boostbook ;
import project ;
import targets ;
import print ;
import type ;
import generators ;
import sequence ;
import path ;
import "class" : is-a ;
import regex ;
path-constant BOOST_DOC : . ;
local lib-docs = [ path.glob [ path.glob $(BOOST_DOC)/../libs $(BOOST_DOC)/../tools : */doc ]
: [ modules.peek project : JAMFILE ] ] ;
local rule find-target-of-class-or-type ( root-target : klass ? : type ? )
{
local result ;
if ! $(result) && $(klass) && [ is-a $(root-target) : $(klass) ]
{
result ?= $(root-target) $(klass) ;
}
if ! $(result) && $(type) && $(type:U) = [ modules.peek $(root-target) : self.type ]
{
result ?= $(root-target) $(type:U) ;
}
local alternatives = [ modules.peek $(root-target) : self.alternatives ] ;
if ! $(result)
{
for local alternative in $(alternatives)
{
if $(result) { break ; }
result ?= [ find-target-of-class-or-type $(alternative) : $(klass) : $(type) ] ;
}
}
if ! $(result)
{
for local alternative in $(alternatives)
{
if $(result) { break ; }
local sources = [ modules.peek $(alternative) : self.sources ] ;
for local source in [ $(alternative).sources ]
{
if $(result) { break ; }
result ?= [ find-target-of-class-or-type $(source) : $(klass) : $(type) ] ;
}
}
}
return $(result) ;
}
local rule docbook-target-spec ( main-target )
{
local spec ;
local doc-sub-target
= [ find-target-of-class-or-type $(main-target) : boostbook-target-class : XML ] ;
if $(doc-sub-target)
{
#ECHO *** $(main-target) ;
#ECHO " ::" [ $(main-target).full-name ] ;
#ECHO " ::" $(doc-sub-target) :: [ $(doc-sub-target[0]).full-name ] ;
local full-name = [ $(doc-sub-target[0]).full-name ] ;
local target-path = $(full-name:D) ;
local target-name = $(full-name:B) ;
local this-path = [ path.root [ project.attribute $(__name__) location ] [ path.pwd ] ] ;
target-path = [ path.relative-to $(this-path) $(target-path) ] ;
#ECHO " ::" $(target-path) :: $(target-name) ;
spec = $(target-path)//$(target-name) ;
}
return $(spec) ;
}
local exclude-libs = [ MATCH "^--exclude-libraries=(.*)" : [ modules.peek : ARGV ] ] ;
exclude-libs = [ regex.split-list $(exclude-libs) : "," ] ;
#ECHO "=== --exclude-libraries:" $(exclude-libs) ;
local lib-doc-boostdoc-refs ;
local lib-doc-boostrelease-refs ;
local this-path = [ path.root [ project.attribute $(__name__) location ] [ path.pwd ] ] ;
for local lib-doc in $(lib-docs)
{
#ECHO === $(lib-doc) ... ;
local doc-project = $(lib-doc:D) ;
local lib-dir = $(doc-project:D) ;
local lib-name = $(lib-dir:BS) ;
#ECHO "=== lib-name:" $(lib-name) ... ;
if $(lib-name) in $(exclude-libs)
{
ECHO "-- Excluded library" '$(lib-name)' ;
}
else
{
local doc-module = [ project.find $(doc-project)
: [ project.attribute $(__name__) location ] ] ;
local doc-target = [ project.target $(doc-module) ] ;
$(doc-target).build-main-targets ;
local boostrelease-target = [ $(doc-target).main-target boostrelease ] ;
if $(boostrelease-target)
{
local full-name = [ $(boostrelease-target).full-name ] ;
local target-path = [ path.relative-to $(this-path) $(full-name:D) ] ;
lib-doc-boostrelease-refs += $(target-path)//boostrelease ;
#ECHO " ::" $(target-path)//boostrelease ;
}
local boostdoc-target = [ $(doc-target).main-target boostdoc ] ;
if $(boostdoc-target)
{
local full-name = [ $(boostdoc-target).full-name ] ;
local target-path = [ path.relative-to $(this-path) $(full-name:D) ] ;
lib-doc-boostdoc-refs += $(target-path)//boostdoc ;
#ECHO " ::" $(target-path)//boostdoc ;
}
}
}
# Build non-integrated library docs for release.
if "--release-build" in [ modules.peek : ARGV ]
{
alias release-build : $(lib-doc-boostrelease-refs) ;
}
local rule component-order ( x y )
{
local a = [ MATCH "(/libs/[^/]+)" "(/tools/[^/]+)" : $(x:G) $(x:G=) ] ;
local b = [ MATCH "(/libs/[^/]+)" "(/tools/[^/]+)" : $(y:G) $(y:G=) ] ;
if $(a[1]) < $(b[1])
{
return true ;
}
else if $(a[1]) = $(b[1]) && $(x) < $(y)
{
return true ;
}
}
rule xinclude-generator ( target : sources * : properties * )
{
print.output $(target) ;
local includes ;
sources = [ sequence.insertion-sort $(sources) : component-order ] ;
locate = [ path.root [ on $(target) return $(LOCATE) ] [ path.pwd ] ] ;
for local xml in $(sources)
{
local dir ;
dir ?= [ on $(xml) return $(LOCATE) ] ;
dir ?= [ on $(xml) return $(SEARCH) ] ;
dir ?= "" ;
dir = [ path.root $(dir[1]) [ path.pwd ] ] ;
dir = [ path.relative-to $(locate) $(dir) ] ;
includes += "<xi:include href=\"$(dir[1])/$(xml:G=)\"/>" ;
}
print.text
"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
"<xml xmlns:xi=\"http://www.w3.org/2003/XInclude\">"
$(includes)
"</xml>"
: overwrite ;
}
type.register XINCLUDE_XML : xinclude : XML ;
generators.register-composing $(__name__).xinclude-generator : XML : XINCLUDE_XML ;
rule xinclude ( name : sources * : requirements * : default-build * : usage-requirements * )
{
targets.create-typed-target XINCLUDE_XML
: [ project.current ]
: $(name)
: $(sources)
: $(requirements)
: $(default-build)
: $(usage-requirements)
;
}
xinclude libraries :
$(lib-doc-boostdoc-refs)
;
explicit libraries ;
xinclude tools :
../tools/quickbook/doc//quickbook
../tools/boostbook/doc/boostbook.xml
;
explicit tools ;
boostbook doc
:
src/boost.xml
:
<xsl:param>generate.consistent.ids=1
<use>$(lib-doc-boostdoc-refs)
<dependency>libraries
<implicit-dependency>libraries
<dependency>tools
<implicit-dependency>tools
<dependency>images
<dependency>callouts
<xsl:path>$(BOOST_DOC)
;
install images : [ glob src/images/*.png ] : <location>html/images ;
explicit images ;
install callouts : [ glob src/images/callouts/*.png ] : <location>html/images/callouts ;
explicit callouts ;
|