diff options
-rw-r--r-- | build-mingw.bat | 39 | ||||
-rw-r--r-- | build-msvc.bat | 39 | ||||
-rwxr-xr-x | build.sh | 45 |
3 files changed, 89 insertions, 34 deletions
diff --git a/build-mingw.bat b/build-mingw.bat index ddb8a5d..a5da24c 100644 --- a/build-mingw.bat +++ b/build-mingw.bat @@ -16,6 +16,7 @@ echo --repo ^<loc^> Alternative package repository location. echo --trust ^<fp^> Repository certificate fingerprint to trust. echo --timeout ^<sec^> Network operations timeout in seconds. echo --make ^<arg^> Bootstrap using GNU make instead of batch file. +echo --verbose ^<level^> Diagnostics verbosity level between 0 and 6. echo. echo By default the batch file will install into C:\build2. It also expects echo to find the base utilities in the bin\ subdirectory of the installation @@ -57,6 +58,7 @@ set "idir=C:\build2" set "trust=" set "timeout=" set "make=" +set "verbose=" :options if "_%~1_" == "_/?_" goto usage @@ -118,6 +120,17 @@ if "_%~1_" == "_--make_" ( goto options ) +if "_%~1_" == "_--verbose_" ( + if "_%~2_" == "__" ( + echo error: diagnostics level between 0 and 6 expected after --verbose + goto error + ) + set "verbose=%~2" + shift + shift + goto options +) + if "_%~1_" == "_--_" shift rem Validate options and arguments. @@ -161,6 +174,12 @@ if not "_%timeout%_" == "__" ( set "timeout=--fetch-timeout %timeout%" ) +rem Diagnostics verbosity. +rem +if not "_%verbose%_" == "__" ( + set "verbose=--verbose %verbose%" +) + if not exist %idir%\bin\ ( echo error: %idir%\bin\ does not exist goto error @@ -172,7 +191,7 @@ if exist build\config.build ( ) if exist ..\%cdir%\ ( - echo error: ..\%cdir%\ bpkg configuration directory already exists + echo error: ..\%cdir%\ bpkg configuration directory already exists, remove it goto error ) @@ -213,7 +232,7 @@ cmd /C bootstrap-mingw.bat %cxx% -static build2\b-boot --version @if errorlevel 1 goto error -build2\b-boot config.cxx=%cxx% config.bin.lib=static +build2\b-boot %verbose% config.cxx=%cxx% config.bin.lib=static @if errorlevel 1 goto error move /y build2\b.exe build2\b-boot.exe @@ -226,14 +245,14 @@ build2\b-boot --version @rem cd .. -build2\build2\b-boot configure^ +build2\build2\b-boot %verbose% configure^ config.cxx=%cxx%^ config.bin.suffix=-stage^ config.install.root=%idir%^ config.install.data_root=root\stage @if errorlevel 1 goto error -build2\build2\b-boot install +build2\build2\b-boot %verbose% install @if errorlevel 1 goto error @rem The where command is not available on XP without the resource kit. @@ -263,23 +282,23 @@ cd %cdir% @rem @set "cdir=%CD%" -bpkg-stage create^ +bpkg-stage %verbose% create^ cc^ config.cxx=%cxx%^ config.cc.coptions=-O3^ config.install.root=%idir% @if errorlevel 1 goto error -bpkg-stage add %BUILD2_REPO% +bpkg-stage %verbose% add %BUILD2_REPO% @if errorlevel 1 goto error -bpkg-stage fetch %timeout% %trust% +bpkg-stage %verbose% fetch %timeout% %trust% @if errorlevel 1 goto error -bpkg-stage build %timeout% --yes build2 bpkg +bpkg-stage %verbose% build %timeout% --yes build2 bpkg @if errorlevel 1 goto error -bpkg-stage install build2 bpkg +bpkg-stage %verbose% install build2 bpkg @if errorlevel 1 goto error where b @@ -297,7 +316,7 @@ bpkg --version @rem Clean up stage. @rem cd %owd% -b uninstall +b %verbose% uninstall @if errorlevel 1 goto error @echo off diff --git a/build-msvc.bat b/build-msvc.bat index 0602422..e8d9b90 100644 --- a/build-msvc.bat +++ b/build-msvc.bat @@ -15,6 +15,7 @@ echo --install-dir ^<dir^> Alternative installation directory. echo --repo ^<loc^> Alternative package repository location. echo --trust ^<fp^> Repository certificate fingerprint to trust. echo --timeout ^<sec^> Network operations timeout in seconds. +echo --verbose ^<level^> Diagnostics verbosity level between 0 and 6. echo. echo By default the batch file will use cl.exe as the C++ compiler and install echo into C:\build2. It also expects to find the base utilities in the bin\ @@ -49,6 +50,7 @@ rem set "idir=C:\build2" set "trust=" set "timeout=" +set "verbose=" :options if "_%~1_" == "_/?_" goto usage @@ -99,6 +101,17 @@ if "_%~1_" == "_--timeout_" ( goto options ) +if "_%~1_" == "_--verbose_" ( + if "_%~2_" == "__" ( + echo error: diagnostics level between 0 and 6 expected after --verbose + goto error + ) + set "verbose=%~2" + shift + shift + goto options +) + if "_%~1_" == "_--_" shift rem Validate options and arguments. @@ -140,6 +153,12 @@ if not "_%timeout%_" == "__" ( set "timeout=--fetch-timeout %timeout%" ) +rem Diagnostics verbosity. +rem +if not "_%verbose%_" == "__" ( + set "verbose=--verbose %verbose%" +) + if not exist %idir%\bin\ ( echo error: %idir%\bin\ does not exist goto error @@ -151,7 +170,7 @@ if exist build\config.build ( ) if exist ..\%cdir%\ ( - echo error: ..\%cdir%\ bpkg configuration directory already exists + echo error: ..\%cdir%\ bpkg configuration directory already exists, remove it goto error ) @@ -179,7 +198,7 @@ cmd /C bootstrap-msvc.bat %cxx% build2\b-boot --version @if errorlevel 1 goto error -build2\b-boot config.cxx=%cxx% config.bin.lib=static +build2\b-boot %verbose% config.cxx=%cxx% config.bin.lib=static @if errorlevel 1 goto error move /y build2\b.exe build2\b-boot.exe @@ -192,14 +211,14 @@ build2\b-boot --version @rem cd .. -build2\build2\b-boot configure^ +build2\build2\b-boot %verbose% configure^ config.cxx=%cxx%^ config.bin.suffix=-stage^ config.install.root=%idir%^ config.install.data_root=root\stage @if errorlevel 1 goto error -build2\build2\b-boot install +build2\build2\b-boot %verbose% install @if errorlevel 1 goto error where b-stage @@ -227,23 +246,23 @@ cd %cdir% @rem @set "cdir=%CD%" -bpkg-stage create^ +bpkg-stage %verbose% create^ cc^ config.cxx=%cxx%^ "config.cc.coptions=/O2 /Oi"^ config.install.root=%idir% @if errorlevel 1 goto error -bpkg-stage add %BUILD2_REPO% +bpkg-stage %verbose% add %BUILD2_REPO% @if errorlevel 1 goto error -bpkg-stage fetch %timeout% %trust% +bpkg-stage %verbose% fetch %timeout% %trust% @if errorlevel 1 goto error -bpkg-stage build %timeout% --yes build2 bpkg +bpkg-stage %verbose% build %timeout% --yes build2 bpkg @if errorlevel 1 goto error -bpkg-stage install build2 bpkg +bpkg-stage %verbose% install build2 bpkg @if errorlevel 1 goto error where b @@ -261,7 +280,7 @@ bpkg --version @rem Clean up stage. @rem cd %owd% -b uninstall +b %verbose% uninstall @if errorlevel 1 goto error @echo off @@ -43,7 +43,9 @@ idir= sudo= sudo_set= trust= +timeout= make= +verbose= while test $# -ne 0; do case $1 in @@ -57,6 +59,7 @@ while test $# -ne 0; do diag " --trust <fp> Repository certificate fingerprint to trust." diag " --timeout <sec> Network operations timeout in seconds." diag " --make <arg> Bootstrap using GNU make instead of script." + diag " --verbose <level> Diagnostics verbosity level between 0 and 6." diag diag "By default the script will install into /usr/local using sudo(1)." diag "To use sudo for a custom installation directory you need to specify" @@ -118,6 +121,16 @@ while test $# -ne 0; do trust="$1" shift ;; + --timeout) + shift + if test $# -eq 0; then + diag "error: value in seconds expected after --timeout" + diag "$usage" + exit 1 + fi + timeout="$1" + shift + ;; --make) shift if test $# -eq 0; then @@ -128,14 +141,14 @@ while test $# -ne 0; do make="$make $1" shift ;; - --timeout) + --verbose) shift if test $# -eq 0; then - diag "error: value in seconds expected after --timeout" + diag "error: diagnostics level between 0 and 6 expected after --verbose" diag "$usage" exit 1 fi - timeout="$1" + verbose="$1" shift ;; *) @@ -168,7 +181,7 @@ if test -f build/config.build; then fi if test -d "../$cdir"; then - diag "error: ../$cdir/ bpkg configuration directory already exists" + diag "error: ../$cdir/ bpkg configuration directory already exists, remove it" exit 1 fi @@ -195,7 +208,7 @@ case "$sys" in ;; esac -# We don't have arrays in POSIX shell but we should be ok as well as none of +# We don't have arrays in POSIX shell but we should be ok as long as none of # the option values contain spaces. Note also that the expansion must be # unquoted. # @@ -215,6 +228,10 @@ elif test -n "$trust"; then bpkg_fetch_ops="$bpkg_fetch_ops --trust $trust" fi +if test -n "$verbose"; then + verbose="--verbose $verbose" +fi + # Bootstrap, stage 1. # run cd build2 @@ -227,7 +244,7 @@ run build2/b-boot --version # Bootstrap, stage 2. # -run build2/b-boot config.cxx="$cxx" config.bin.lib=static +run build2/b-boot $verbose config.cxx="$cxx" config.bin.lib=static mv build2/b build2/b-boot run build2/b-boot --version @@ -235,7 +252,7 @@ run build2/b-boot --version # run cd .. -run build2/build2/b-boot configure \ +run build2/build2/b-boot $verbose configure \ config.cxx="$cxx" \ config.bin.suffix=-stage \ config.bin.rpath="$conf_rpath" \ @@ -243,7 +260,7 @@ config.install.root="$idir" \ config.install.data_root=root/stage \ config.install.sudo="$conf_sudo" -run build2/build2/b-boot install +run build2/build2/b-boot $verbose install run which b-stage run which bpkg-stage @@ -258,7 +275,7 @@ run mkdir "$cdir" run cd "$cdir" cdir="$(pwd)" # Save full path for later. -run bpkg-stage create \ +run bpkg-stage $verbose create \ cc \ config.cxx="$cxx" \ config.cc.coptions=-O3 \ @@ -266,10 +283,10 @@ config.bin.rpath="$conf_rpath" \ config.install.root="$idir" \ config.install.sudo="$conf_sudo" -run bpkg-stage add "$BUILD2_REPO" -run bpkg-stage $bpkg_fetch_ops fetch -run bpkg-stage $bpkg_build_ops build --yes build2 bpkg -run bpkg-stage install build2 bpkg +run bpkg-stage $verbose add "$BUILD2_REPO" +run bpkg-stage $verbose $bpkg_fetch_ops fetch +run bpkg-stage $verbose $bpkg_build_ops build --yes build2 bpkg +run bpkg-stage $verbose install build2 bpkg run which b run which bpkg @@ -280,7 +297,7 @@ run bpkg --version # Clean up. # run cd "$owd" -run b uninstall +run b $verbose uninstall diag diag "Toolchain installation: $idir/bin" |