]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/Jamroot.jam
import new upstream nautilus stable release 14.2.8
[ceph.git] / ceph / src / boost / tools / build / Jamroot.jam
CommitLineData
92f5a8d4
TL
1# Copyright 2019 Rene Rivera
2# Copyright 2017 Steven Watanabe
3# Copyright 2016 Vladimir Prus
4# Copyright 2017 Edward Diener
5# Distributed under the Boost Software License, Version 1.0.
6# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
7c673cae
FG
7
8import path ;
9import package ;
10import os ;
92f5a8d4
TL
11import feature ;
12import set ;
13import toolset ;
14import bison ;
15import indirect ;
16import "class" : new ;
17import type ;
18import virtual-target ;
19
20path-constant SELF : . ;
21
22project b2
23 : build-dir .build
24 ;
25
26#|
27Build the engine and its dependencies outside of the simple core build scripts.
28This allows us to keep the core build scripts as simple as possible. And lets
29us support more functionality for development of the engine core.
30|#
31
32#|
33Define custom yyacc tool.
34|#
35
36feature.feature yyacc : : dependency free ;
37toolset.flags yyacc TOOL <yyacc> ;
38
39exe yyacc
40 : src/engine/yyacc.cpp
41 : ;
42explicit yyacc ;
43
44rule yyacc-gen ( project name : property-set : sources * )
45{
46 local relevant = [ toolset.relevant $(__name__).yyacc ] ;
47 local a = [ new action $(sources[1]) : $(__name__).yyacc : [ $(property-set).add $(relevant) ] ] ;
48 local targets ;
49 for local n in $(name:S=).y $(name:S=)tab.h
50 {
51 targets += [ virtual-target.register
52 [ new file-target $(n) exact : [ type.type $(n) ]
53 : $(project) : $(a)
54 ] ] ;
55 }
56 return $(targets) ;
57}
58
59actions yyacc bind TOOL
60{
61 "$(TOOL)" "$(<)" "$(>)"
62}
63
64generate jamgram.y
65 : src/engine/jamgram.yy
66 : <generating-rule>@yyacc-gen
67 <location>src/engine
68 <yyacc>yyacc <dependency>yyacc
69 ;
70explicit jamgram.y ;
71
72#|
73Define grammar translation with Bison.
74|#
75
76rule grammar ( target : source : properties * )
77{
78 # LOCATE on $(target) = $(source:D) ;
79 local BISON = [ os.environ BISON ] ;
80 BISON ?= bison ;
81 BISON on $(target) = $(BISON) ;
82}
83
84actions grammar
85{
86 "$(BISON)" --yacc --defines -o "$(<[1])" "$(>)"
87}
88
89make jamgram.cpp
90 : src/engine/jamgram.y
91 : @grammar
92 : <dependency>jamgram.y
93 <location>src/engine ;
94explicit jamgram.cpp ;
95
96#|
97Generate the embedded jambase.
98|#
99
100feature.feature mkjambase : : dependency free ;
101toolset.flags mkjambase TOOL <mkjambase> ;
102
103exe mkjambase
104 : src/engine/mkjambase.cpp
105 ;
106explicit mkjambase ;
107
108actions mkjambase bind TOOL
109{
110 "$(TOOL)" "$(<)" "$(>)"
111}
112
113make jambase.cpp
114 : src/engine/Jambase
115 : @mkjambase
116 : <location>src/engine
117 <mkjambase>mkjambase <dependency>mkjambase ;
118explicit jambase.cpp ;
119
120#|
121Define the b2 executable. Sources are based on platform.
122TODO: Make platform specific source be no-ops when not needed.
123|#
124
125local python-exe = [ MATCH --with-python=(.*) : [ modules.peek : ARGV ] ] ;
126local python-include ;
127local python-ldlib ;
128if $(python-exe)
129{
130 python-include = [ SHELL
131 "$(python-exe) -c \"import sysconfig; print(sysconfig.get_path('include'));\""
132 : strip-eol ] ;
133 python-libdir = [ SHELL
134 "$(python-exe) -c \"import sysconfig; import os.path; print(sysconfig.get_config_var('LIBDIR'));\""
135 : strip-eol ] ;
136 python-ldlib = [ MATCH ".*(python.*)" : [ SHELL
137 "$(python-exe) -c \"import sysconfig; import os.path; print(sysconfig.get_config_var('LIBRARY'));\""
138 : strip-eol ] ] ;
139 python-ldlib = $(python-ldlib:S=) ;
140
141 lib python
142 :
143 : <name>$(python-ldlib) <search>$(python-libdir)
144 :
145 : <include>$(python-include) <define>HAVE_PYTHON ;
146}
147else
148{
149 alias python ;
150}
151
152local b2_src =
153 [ glob src/engine/*.cpp src/engine/modules/*.cpp :
154 src/engine/*nt.cpp src/engine/*unix.cpp src/engine/*vms.cpp
155 src/engine/yyacc.cpp src/engine/mkjambase.cpp
156 ] ;
157local b2_src_nt = [ glob src/engine/*nt.cpp ] ;
158local b2_src_unix = [ glob src/engine/*unix.cpp ] ;
159local b2_src_vms = [ glob src/engine/*vms.cpp ] ;
160local unix_os = [ set.difference [ feature.values <target-os> ] : windows vms ] ;
161
162exe b2
163 : $(b2_src)
164 python
165 : <target-os>windows:<source>$(b2_src_nt)
166 <target-os>vms:<source>$(b2_src_vms)
167 <target-os>$(unix_os):<source>$(b2_src_unix)
168 <dependency>jamgram.cpp
169 <dependency>jambase.cpp
170 ;
171explicit b2 ;
172
173#|
174Installation of the engine, build, and example files.
175|#
7c673cae
FG
176
177local ext = "" ;
178if [ os.on-windows ] || [ os.on-vms ]
179{
180 ext = ".exe" ;
181}
182
183package.install boost-build-engine boost-build
92f5a8d4
TL
184 : # properties
185 : # binaries
186 $(SELF)/src/engine/b2$(ext)
187 ;
188explicit boost-build-engine ;
7c673cae 189
92f5a8d4
TL
190local examples ;
191for local e in [ glob-tree-ex $(SELF)/example : * : . .svn ]
7c673cae 192{
92f5a8d4 193 if [ CHECK_IF_FILE [ path.native $(e) ] ]
7c673cae 194 {
92f5a8d4
TL
195 examples += $(e) ;
196 }
7c673cae 197}
92f5a8d4
TL
198package.install-data boost-build-examples
199 : # Which subdir of $prefix/share
200 boost-build
201 : # What to install
202 $(examples)
203 : # What is the root of the directory
204 <install-source-root>.
205 ;
206explicit boost-build-examples ;
7c673cae 207
92f5a8d4 208local .core-sources =
7c673cae
FG
209 $(SELF)/boost-build.jam
210 $(SELF)/src/build-system.jam
92f5a8d4
TL
211 [ path.glob-tree $(SELF)/src/build : *.jam ]
212 [ path.glob-tree $(SELF)/src/contrib : *.jam ]
213 [ path.glob-tree $(SELF)/src/kernel : *.jam ]
214 [ path.glob-tree $(SELF)/src/options : *.jam ]
215 [ path.glob-tree $(SELF)/src/util : *.jam ]
216 [ path.glob-tree $(SELF)/src/tools : *.jam *.xml *.xsl *.doxyfile *.hpp doxproc.py ]
217 ;
218if $(python-exe)
219{
220 .core-sources +=
221 [ path.glob-tree $(SELF)/src/build : *.py ]
222 [ path.glob-tree $(SELF)/src/contrib : *.py ]
223 [ path.glob-tree $(SELF)/src/kernel : *.py ]
224 [ path.glob-tree $(SELF)/src/options : *.py ]
225 [ path.glob-tree $(SELF)/src/util : *.py ]
226 [ path.glob-tree $(SELF)/src/tools : *.py : doxproc.py ]
227 ;
228}
229
230package.install-data boost-build-core
231 : # Which subdir of $prefix/share
232 boost-build
233 : # What to install
234 $(.core-sources)
235 : # What is the root of the directory
236 <install-source-root>.
237 ;
238explicit boost-build-core ;
239
240#|
241Only install example files when requested to avoid bloating install footprint.
242|#
243if --with-examples in [ modules.peek : ARGV ]
244{
245 alias install : boost-build-engine boost-build-core boost-build-examples ;
246}
247else
248{
249 alias install : boost-build-engine boost-build-core ;
250}
251explicit install ;