]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/engine/build.bat
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / src / engine / build.bat
1 @ECHO OFF
2
3 REM ~ Copyright 2002-2007 Rene Rivera.
4 REM ~ Distributed under the Boost Software License, Version 1.0.
5 REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7 setlocal
8 goto Start
9
10
11 :Set_Error
12 color 00
13 goto :eof
14
15
16 :Clear_Error
17 ver >nul
18 goto :eof
19
20
21 :Error_Print
22 REM Output an error message and set the errorlevel to indicate failure.
23 setlocal
24 ECHO ###
25 ECHO ### %1
26 ECHO ###
27 ECHO ### You can specify the toolset as the argument, i.e.:
28 ECHO ### .\build.bat msvc
29 ECHO ###
30 ECHO ### Toolsets supported by this script are: borland, como, gcc,
31 ECHO ### gcc-nocygwin, intel-win32, metrowerks, mingw, msvc, vc7, vc8,
32 ECHO ### vc9, vc10, vc11, vc12, vc14, vc141
33 ECHO ###
34 ECHO ### If you have Visual Studio 2017 installed you will need either update
35 ECHO ### the Visual Studio 2017 installer or run from VS 2017 Command Prompt
36 ECHO ### as we where unable to detect your toolset installation.
37 ECHO ###
38 call :Set_Error
39 endlocal
40 goto :eof
41
42
43 :Test_Option
44 REM Tests whether the given string is in the form of an option: "--*"
45 call :Clear_Error
46 setlocal
47 set test=%1
48 if not defined test (
49 call :Set_Error
50 goto Test_Option_End
51 )
52 set test=###%test%###
53 set test=%test:"###=%
54 set test=%test:###"=%
55 set test=%test:###=%
56 if not "-" == "%test:~1,1%" call :Set_Error
57 :Test_Option_End
58 endlocal
59 goto :eof
60
61
62 :Test_Empty
63 REM Tests whether the given string is not empty
64 call :Clear_Error
65 setlocal
66 set test=%1
67 if not defined test (
68 call :Clear_Error
69 goto Test_Empty_End
70 )
71 set test=###%test%###
72 set test=%test:"###=%
73 set test=%test:###"=%
74 set test=%test:###=%
75 if not "" == "%test%" call :Set_Error
76 :Test_Empty_End
77 endlocal
78 goto :eof
79
80
81 :Guess_Toolset
82 REM Try and guess the toolset to bootstrap the build with...
83 REM Sets BOOST_JAM_TOOLSET to the first found toolset.
84 REM May also set BOOST_JAM_TOOLSET_ROOT to the
85 REM location of the found toolset.
86
87 call :Clear_Error
88 call :Test_Empty "%ProgramFiles%"
89 if not errorlevel 1 set "ProgramFiles=C:\Program Files"
90
91 REM Visual studio is by default installed to %ProgramFiles% on 32-bit machines and
92 REM %ProgramFiles(x86)% on 64-bit machines. Making a common variable for both.
93 call :Clear_Error
94 call :Test_Empty "%ProgramFiles(x86)%"
95 if errorlevel 1 (
96 set "VS_ProgramFiles=%ProgramFiles(x86)%"
97 ) else (
98 set "VS_ProgramFiles=%ProgramFiles%"
99 )
100
101 call guess_toolset.bat
102 if errorlevel 1 (
103 call :Error_Print "Could not find a suitable toolset."
104 goto :eof)
105
106
107 :Guess_Yacc
108 call guess_toolset.bat yacc
109 if errorlevel 1 (
110 call :Error_Print "Could not find Yacc to build the Jam grammar.")
111 goto :eof
112
113
114 :Start
115 set BOOST_JAM_TOOLSET=
116 set BOOST_JAM_ARGS=
117
118 REM If no arguments guess the toolset;
119 REM or if first argument is an option guess the toolset;
120 REM otherwise the argument is the toolset to use.
121 call :Clear_Error
122 call :Test_Empty %1
123 if not errorlevel 1 (
124 call :Guess_Toolset
125 if not errorlevel 1 ( goto Setup_Toolset ) else ( goto Finish )
126 )
127
128 call :Clear_Error
129 call :Test_Option %1
130 if not errorlevel 1 (
131 call :Guess_Toolset
132 if not errorlevel 1 ( goto Setup_Toolset ) else ( goto Finish )
133 )
134
135 call :Clear_Error
136 set BOOST_JAM_TOOLSET=%1
137 shift
138 goto Setup_Toolset
139
140
141 :Setup_Toolset
142 REM Setup the toolset command and options. This bit of code
143 REM needs to be flexible enough to handle both when
144 REM the toolset was guessed at and found, or when the toolset
145 REM was indicated in the command arguments.
146 REM NOTE: The strange multiple "if ?? == _toolset_" tests are that way
147 REM because in BAT variables are subsituted only once during a single
148 REM command. A complete "if ... else ..."
149 REM is a single command, even though it's in multiple lines here.
150 :Setup_Args
151 call :Clear_Error
152 call :Test_Empty %1
153 if not errorlevel 1 goto Config_Toolset
154 call :Clear_Error
155 call :Test_Option %1
156 if errorlevel 1 (
157 set BOOST_JAM_ARGS=%BOOST_JAM_ARGS% %1
158 shift
159 goto Setup_Args
160 )
161 :Config_Toolset
162 call config_toolset.bat
163 if "_%_known_%_" == "__" (
164 call :Error_Print "Unknown toolset: %BOOST_JAM_TOOLSET%"
165 )
166 if errorlevel 1 goto Finish
167
168 echo ###
169 echo ### Using '%BOOST_JAM_TOOLSET%' toolset.
170 echo ###
171
172 set YYACC_SOURCES=yyacc.c
173 set MKJAMBASE_SOURCES=mkjambase.c
174 set BJAM_SOURCES=
175 set BJAM_SOURCES=%BJAM_SOURCES% command.c compile.c constants.c debug.c
176 set BJAM_SOURCES=%BJAM_SOURCES% execcmd.c execnt.c filent.c frames.c function.c
177 set BJAM_SOURCES=%BJAM_SOURCES% glob.c hash.c hdrmacro.c headers.c jam.c
178 set BJAM_SOURCES=%BJAM_SOURCES% jambase.c jamgram.c lists.c make.c make1.c
179 set BJAM_SOURCES=%BJAM_SOURCES% object.c option.c output.c parse.c pathnt.c
180 set BJAM_SOURCES=%BJAM_SOURCES% pathsys.c regexp.c rules.c scan.c search.c
181 set BJAM_SOURCES=%BJAM_SOURCES% subst.c timestamp.c variable.c modules.c
182 set BJAM_SOURCES=%BJAM_SOURCES% strings.c filesys.c builtins.c md5.c class.c
183 set BJAM_SOURCES=%BJAM_SOURCES% cwd.c w32_getreg.c native.c modules/set.c
184 set BJAM_SOURCES=%BJAM_SOURCES% modules/path.c modules/regex.c
185 set BJAM_SOURCES=%BJAM_SOURCES% modules/property-set.c modules/sequence.c
186 set BJAM_SOURCES=%BJAM_SOURCES% modules/order.c
187
188 set BJAM_UPDATE=
189 :Check_Update
190 call :Test_Empty %1
191 if not errorlevel 1 goto Check_Update_End
192 call :Clear_Error
193 setlocal
194 set test=%1
195 set test=###%test%###
196 set test=%test:"###=%
197 set test=%test:###"=%
198 set test=%test:###=%
199 if "%test%" == "--update" goto Found_Update
200 endlocal & set BOOST_JAM_TOOLSET=%BOOST_JAM_TOOLSET%
201 shift
202 if not "_%BJAM_UPDATE%_" == "_update_" goto Check_Update
203 :Found_Update
204 endlocal & set BOOST_JAM_TOOLSET=%BOOST_JAM_TOOLSET%
205 set BJAM_UPDATE=update
206 :Check_Update_End
207 if "_%BJAM_UPDATE%_" == "_update_" (
208 if not exist ".\bootstrap\jam0.exe" (
209 set BJAM_UPDATE=
210 )
211 )
212
213 @echo ON
214 @if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Bootstrap
215 if exist bootstrap rd /S /Q bootstrap
216 md bootstrap
217 @if not exist jamgram.y goto Bootstrap_GrammarPrep
218 @if not exist jamgramtab.h goto Bootstrap_GrammarPrep
219 @goto Skip_GrammarPrep
220 :Bootstrap_GrammarPrep
221 %BOOST_JAM_CC% %BOOST_JAM_OPT_YYACC% %YYACC_SOURCES%
222 @if not exist ".\bootstrap\yyacc0.exe" goto Skip_GrammarPrep
223 .\bootstrap\yyacc0 jamgram.y jamgramtab.h jamgram.yy
224 :Skip_GrammarPrep
225 @if not exist jamgram.c goto Bootstrap_GrammarBuild
226 @if not exist jamgram.h goto Bootstrap_GrammarBuild
227 @goto Skip_GrammarBuild
228 :Bootstrap_GrammarBuild
229 @echo OFF
230 if "_%YACC%_" == "__" (
231 call :Guess_Yacc
232 )
233 if errorlevel 1 goto Finish
234 @echo ON
235 %YACC% jamgram.y
236 @if errorlevel 1 goto Finish
237 del /f jamgram.c
238 rename y.tab.c jamgram.c
239 del /f jamgram.h
240 rename y.tab.h jamgram.h
241 :Skip_GrammarBuild
242 @echo ON
243 @if exist jambase.c goto Skip_Jambase
244 %BOOST_JAM_CC% %BOOST_JAM_OPT_MKJAMBASE% %MKJAMBASE_SOURCES%
245 @if not exist ".\bootstrap\mkjambase0.exe" goto Skip_Jambase
246 .\bootstrap\mkjambase0 jambase.c Jambase
247 :Skip_Jambase
248 %BOOST_JAM_CC% %BOOST_JAM_OPT_JAM% %BJAM_SOURCES%
249 :Skip_Bootstrap
250 @if not exist ".\bootstrap\jam0.exe" goto Skip_Jam
251 @set args=%*
252 @echo OFF
253 :Set_Args
254 setlocal
255 call :Test_Empty %args%
256 if not errorlevel 1 goto Set_Args_End
257 set test=###%args:~0,2%###
258 set test=%test:"###=%
259 set test=%test:###"=%
260 set test=%test:###=%
261 set test1=%test:~0,1%
262 set test2=%test:~1,1%
263 REM We can't just search for dash because it might be a part of
264 REM toolset name, like in `intel-win32'.
265 if "-" == "%test1%" goto Set_Args_End
266 if "-" == "%test2%" if not " " == "%test1" if not """" == "%test1" goto Set_Args_bite_Two
267 goto Set_Args_Bite_One
268 endlocal
269 :Set_Args_Bite_Two
270 set args=%args:~1%
271 :Set_Args_Bite_One
272 set args=%args:~1%
273 goto Set_Args
274 :Set_Args_End
275 @echo ON
276 @if "_%BJAM_UPDATE%_" == "_update_" goto Skip_Clean
277 .\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " %args% clean
278 :Skip_Clean
279 .\bootstrap\jam0 -f build.jam --toolset=%BOOST_JAM_TOOLSET% "--toolset-root=%BOOST_JAM_TOOLSET_ROOT% " %args%
280 :Skip_Jam
281
282 :Finish
283 exit /b %ERRORLEVEL%