2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-02 20:52:13 +00:00
Files
build/bootstrap.bat
Jurko f929602088 Return valid exit code from Windows batch scripts.
Technique used for setting Windows batch script exit codes in Boost.Build worked
correctly when the script is called from a Windows shell process and then checked
from inside that process. However, when run from a temporary shell process that
needs to terminate after running the script, such a process would always return
exit code 0.

This prevented anyone automating those scripts from detecting their success/
failure status by using their exit code without adding an additional batch script
layer.

For example, consider the following two script files:

  ret666.cmd:
    exit /b 666

  wrapper.cmd:
    call ret666.cmd

They both 'should return the value 666' and when run directly from a cmd.exe
console indeed both do (they set the shell process's ERRORLEVEL environment
variable to 666). However, when run like this:
  cmd /c <script-name>
running ret666.cmd causes the temporary cmd.exe process to exit with exit code
666, while running wrapper.cmd causes it to exit with exit code 0.
2014-10-24 11:03:15 +04:00

51 lines
1.1 KiB
Batchfile

@ECHO OFF
REM Copyright (C) 2009 Vladimir Prus
REM
REM Distributed under the Boost Software License, Version 1.0.
REM (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
ECHO Bootstrapping the build engine
if exist ".\src\engine\bin.ntx86\bjam.exe" del src\engine\bin.ntx86\bjam.exe
if exist ".\src\engine\bin.ntx86_64\bjam.exe" del src\engine\bin.ntx86_64\bjam.exe
pushd src\engine
call .\build.bat %* > ..\..\bootstrap.log
@ECHO OFF
popd
if exist ".\src\engine\bin.ntx86\b2.exe" (
copy .\src\engine\bin.ntx86\b2.exe . > nul
copy .\src\engine\bin.ntx86\bjam.exe . > nul
goto :bjam_built)
if exist ".\src\engine\bin.ntx86_64\b2.exe" (
copy .\src\engine\bin.ntx86_64\b2.exe . > nul
copy .\src\engine\bin.ntx86_64\bjam.exe . > nul
goto :bjam_built)
goto :bjam_failure
:bjam_built
ECHO.
ECHO Bootstrapping is done. To build, run:
ECHO.
ECHO .\b2 --prefix=DIR install
ECHO.
goto :end
:bjam_failure
ECHO.
ECHO Failed to bootstrap the build engine
ECHO Please consult bootstrap.log for furter diagnostics.
ECHO.
goto :end
:end
exit /b %ERRORLEVEL%