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