From aa54c708b2f667260d654658d380dd47d05d7001 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Wed, 4 Nov 2020 17:54:17 +0300 Subject: Add libbuild2-kconfig to installation/upgrade documentation and build scripts --- BOOTSTRAP-UNIX.cli | 71 +++++++++++++++++++++---- BOOTSTRAP-WINDOWS-CLANG.cli | 75 ++++++++++++++++++++++----- BOOTSTRAP-WINDOWS-MINGW.cli | 77 ++++++++++++++++++++++----- BOOTSTRAP-WINDOWS-MSVC.cli | 75 ++++++++++++++++++++++----- UPGRADE.cli | 66 ++++++++++++++--------- build-clang.bat.in | 120 +++++++++++++++++++++++++++++++++++++----- build-mingw.bat.in | 124 ++++++++++++++++++++++++++++++++++++++------ build-msvc.bat.in | 118 ++++++++++++++++++++++++++++++++++++----- build.sh.in | 86 +++++++++++++++++++++++++++++- buildfile | 31 +++++++---- 10 files changed, 717 insertions(+), 126 deletions(-) diff --git a/BOOTSTRAP-UNIX.cli b/BOOTSTRAP-UNIX.cli index f0ff600..8f75cc2 100644 --- a/BOOTSTRAP-UNIX.cli +++ b/BOOTSTRAP-UNIX.cli @@ -97,7 +97,7 @@ versions. It can also be used to uninstall the toolchain: \ $ cd build2-toolchain-X.Y -$ bpkg uninstall build2 bpkg bdep +$ bpkg uninstall --all \ \N|Note that in both cases (manual or scripted bootstrap), if something goes @@ -215,10 +215,15 @@ subdirectory is in \c{PATH}. At the next step we will use \c{bpkg} to build and install the entire toolchain. If for some reason you prefer not to build from packages (for example, because the machine is offline), then you can convert this step into -a local installation and skip the rest. For this you will need to change -the \c{configure} and \c{install} command lines above along these lines (see -also notes on the following step about only building shared libraries and -private installation subdirectory): +a local installation and skip the rest of the steps. + +\N|To perform a local installation with the \c{build.sh} script, pass the +\c{--local} option.| + +To perform a local installation you will need to change the \c{configure} and +\c{install} command lines above along these lines (see also notes on the +following step about only building shared libraries and private installation +subdirectory): \ $ build2/build2/b-boot configure \ @@ -233,13 +238,25 @@ $ build2/build2/b-boot configure \ $ build2/build2/b-boot install: build2/ bpkg/ bdep/ \ -\N|To perform a local installation with the \c{build.sh} script, pass the -\c{--local} option.| +You will also need to build and install the standard build system modules: + +\ +$ b install: libbuild2-*/ +\ + +\N|To verify the build system modules installation you can load them with the +following command: + +\ +$ b noop: tests/libbuild2-*/ +\ + +| To uninstall such a local installation, run: \ -$ b uninstall: build2/ bpkg/ bdep/ +$ b uninstall: build2/ bpkg/ bdep/ libbuild2-*/ \ | @@ -286,10 +303,20 @@ Next, we add the package repository, build, and install: $ bpkg-stage add https://pkg.cppget.org/1/alpha $ bpkg-stage fetch $ bpkg-stage build --for install build2 bpkg bdep -$ bpkg-stage install build2 bpkg bdep +$ bpkg-stage install --all \ -Finally, we verify the result: +\N|By default \c{bpkg} will build the latest available version of each +package. You can, however, specify the desired versions explicitly, for +example: + +\ +$ bpkg-stage build --for install build2/X.Y.Z bpkg/X.Y.Z bdep/X.Y.Z +\ + +| + +To verify the result, run: \ $ which b @@ -306,8 +333,32 @@ $ bpkg --version $ bdep --version \ +Finally, we build and install the standard build system modules: + +\ +$ bpkg build --for install libbuild2-kconfig +$ bpkg install libbuild2-kconfig +\ + +\N|To get a list of the standard pre-installed build system modules in a +specific version of the toolchain, run: + +\ +$ cd ../build2-toolchain-X.Y.Z +$ ls -d libbuild2-* +\ + | +\N|To verify the build system modules installation you can load them with the +following command: + +\ +$ b noop: ../build2-toolchain-X.Y.Z/tests/libbuild2-*/ +\ + +|| + \li|\n\b{5. Clean}\n The last thing we need to do is uninstall the staged tools: diff --git a/BOOTSTRAP-WINDOWS-CLANG.cli b/BOOTSTRAP-WINDOWS-CLANG.cli index 507b9ce..7f44b9d 100644 --- a/BOOTSTRAP-WINDOWS-CLANG.cli +++ b/BOOTSTRAP-WINDOWS-CLANG.cli @@ -48,7 +48,7 @@ versions. It can also be used to uninstall the toolchain: \ > cd build2-toolchain-X.Y -> bpkg uninstall build2 bpkg bdep +> bpkg uninstall --all \ \N|Note that in both cases (manual or scripted bootstrap), if something goes @@ -121,7 +121,7 @@ libraries and then staged: config.install.root=C:\build2 ^ config.install.data_root=root\stage -> build2\build2\b-boot install: build2/ bpkg/ +> build2\build2\b-boot install: build2\ bpkg\ \ The strange-looking \c{config.install.data_root=root\\stage} means install @@ -147,9 +147,14 @@ C:\build2\bin\bpkg-stage.exe At the next step we will use \c{bpkg} to build and install the entire toolchain. If for some reason you prefer not to build from packages (for example, because the machine is offline), then you can convert this step into -a local installation and skip the rest. For this you will need to change -the \c{configure} and \c{install} command lines above along these lines (see -also a note on the following step about only building shared libraries): +a local installation and skip the rest of the steps. + +\N|To perform a local installation with the \c{build-clang.bat} batch file, +pass the \c{--local} option.| + +To perform a local installation you will need to change the \c{configure} and +\c{install} command lines above along these lines (see also a note on the +following step about only building shared libraries): \ > build2\build2\b-boot configure ^ @@ -158,16 +163,28 @@ also a note on the following step about only building shared libraries): config.bin.lib=shared ^ config.install.root=C:\build2 -> build2\build2\b-boot install: build2/ bpkg/ bdep/ +> build2\build2\b-boot install: build2\ bpkg\ bdep\ \ -\N|To perform a local installation with the \c{build-clang.bat} batch file, -pass the \c{--local} option.| +You will also need to build and install the standard build system modules: + +\ +> b install: libbuild2-*\ +\ + +\N|To verify the build system modules installation you can load them with the +following command: + +\ +> b noop: tests\libbuild2-*\ +\ + +| To uninstall such a local installation, run: \ -> b uninstall: build2/ bpkg/ bdep/ +> b uninstall: build2\ bpkg\ bdep\ libbuild2-*\ \ | @@ -201,10 +218,20 @@ Next, we add the package repository, build, and install: > bpkg-stage add https://pkg.cppget.org/1/alpha > bpkg-stage fetch > bpkg-stage build --for install build2 bpkg bdep -> bpkg-stage install build2 bpkg bdep +> bpkg-stage install --all \ -Finally, we verify the result: +\N|By default \c{bpkg} will build the latest available version of each +package. You can, however, specify the desired versions explicitly, for +example: + +\ +> bpkg-stage build --for install build2/X.Y.Z bpkg/X.Y.Z bdep/X.Y.Z +\ + +| + +To verify the result, run: \ > where b @@ -221,15 +248,39 @@ C:\build2\bin\bdep.exe > bdep --version \ +Finally, we build and install the standard build system modules: + +\ +> bpkg build --for install libbuild2-kconfig +> bpkg install libbuild2-kconfig +\ + +\N|To get a list of the standard pre-installed build system modules in a +specific version of the toolchain, run: + +\ +> cd ..\build2-toolchain-X.Y.Z +> dir /B libbuild2-* +\ + | +\N|To verify the build system modules installation you can load them with the +following command: + +\ +> b noop: ..\build2-toolchain-X.Y.Z\tests\libbuild2-*\ +\ + +|| + \li|\n\b{5. Clean}\n The last thing we need to do is uninstall the staged tools: \ > cd ..\build2-toolchain-X.Y.Z # Back to bootstrap. -> b uninstall: build2/ bpkg/ +> b uninstall: build2\ bpkg\ \ || diff --git a/BOOTSTRAP-WINDOWS-MINGW.cli b/BOOTSTRAP-WINDOWS-MINGW.cli index 852b80b..834e4a3 100644 --- a/BOOTSTRAP-WINDOWS-MINGW.cli +++ b/BOOTSTRAP-WINDOWS-MINGW.cli @@ -56,7 +56,7 @@ versions. It can also be used to uninstall the toolchain: \ > cd build2-toolchain-X.Y -> bpkg uninstall build2 bpkg bdep +> bpkg uninstall --all \ \N|Note that in both cases (manual or scripted bootstrap), if something goes @@ -123,7 +123,7 @@ libraries and then staged: config.install.root=C:\build2 ^ config.install.data_root=root\stage -> build2\build2\b-boot install: build2/ bpkg/ +> build2\build2\b-boot install: build2\ bpkg\ \ The strange-looking \c{config.install.data_root=root\\stage} means install @@ -149,9 +149,14 @@ C:\build2\bin\bpkg-stage.exe At the next step we will use \c{bpkg} to build and install the entire toolchain. If for some reason you prefer not to build from packages (for example, because the machine is offline), then you can convert this step into -a local installation and skip the rest. For this you will need to change -the \c{configure} and \c{install} command lines above along these lines (see -also a note on the following step about only building shared libraries): +a local installation and skip the rest of the steps. + +\N|To perform a local installation with the \c{build-mingw.bat} batch file, +pass the \c{--local} option.| + +To perform a local installation you will need to change the \c{configure} and +\c{install} command lines above along these lines (see also a note on the +following step about only building shared libraries): \ > build2\build2\b-boot configure ^ @@ -160,16 +165,28 @@ also a note on the following step about only building shared libraries): config.bin.lib=shared ^ config.install.root=C:\build2 -> build2\build2\b-boot install: build2/ bpkg/ bdep/ +> build2\build2\b-boot install: build2\ bpkg\ bdep\ \ -\N|To perform a local installation with the \c{build-mingw.bat} batch file, -pass the \c{--local} option.| +You will also need to build and install the standard build system modules: + +\ +> b install: libbuild2-*\ +\ + +\N|To verify the build system modules installation you can load them with the +following command: + +\ +> b noop: tests\libbuild2-*\ +\ + +| To uninstall such a local installation, run: \ -> b uninstall: build2/ bpkg/ bdep/ +> b uninstall: build2\ bpkg\ bdep\ libbuild2-*\ \ | @@ -203,11 +220,21 @@ Next, we add the package repository, build, and install: > bpkg-stage add https://pkg.cppget.org/1/alpha > bpkg-stage fetch > bpkg-stage build --for install build2 bpkg bdep -> bpkg-stage install build2 bpkg bdep +> bpkg-stage install --all \ -Finally, we verify the result (note that the \c{where} command is not -available on Windows XP without the Resource Kit installed): +\N|By default \c{bpkg} will build the latest available version of each +package. You can, however, specify the desired versions explicitly, for +example: + +\ +> bpkg-stage build --for install build2/X.Y.Z bpkg/X.Y.Z bdep/X.Y.Z +\ + +| + +To verify the result, run (note that the \c{where} command is not available on +Windows XP without the Resource Kit installed): \ > where b @@ -224,15 +251,39 @@ C:\build2\bin\bdep.exe > bdep --version \ +Finally, we build and install the standard build system modules: + +\ +> bpkg build --for install libbuild2-kconfig +> bpkg install libbuild2-kconfig +\ + +\N|To get a list of the standard pre-installed build system modules in a +specific version of the toolchain, run: + +\ +> cd ..\build2-toolchain-X.Y.Z +> dir /B libbuild2-* +\ + | +\N|To verify the build system modules installation you can load them with the +following command: + +\ +> b noop: ..\build2-toolchain-X.Y.Z\tests\libbuild2-*\ +\ + +|| + \li|\n\b{5. Clean}\n The last thing we need to do is uninstall the staged tools: \ > cd ..\build2-toolchain-X.Y.Z # Back to bootstrap. -> b uninstall: build2/ bpkg/ +> b uninstall: build2\ bpkg\ \ || diff --git a/BOOTSTRAP-WINDOWS-MSVC.cli b/BOOTSTRAP-WINDOWS-MSVC.cli index b162ad9..9e54c59 100644 --- a/BOOTSTRAP-WINDOWS-MSVC.cli +++ b/BOOTSTRAP-WINDOWS-MSVC.cli @@ -38,7 +38,7 @@ versions. It can also be used to uninstall the toolchain: \ > cd build2-toolchain-X.Y -> bpkg uninstall build2 bpkg bdep +> bpkg uninstall --all \ \N|Note that in both cases (manual or scripted bootstrap), if something goes @@ -95,7 +95,7 @@ libraries and then staged: config.install.root=C:\build2 ^ config.install.data_root=root\stage -> build2\build2\b-boot install: build2/ bpkg/ +> build2\build2\b-boot install: build2\ bpkg\ \ The strange-looking \c{config.install.data_root=root\\stage} means install @@ -121,9 +121,14 @@ C:\build2\bin\bpkg-stage.exe At the next step we will use \c{bpkg} to build and install the entire toolchain. If for some reason you prefer not to build from packages (for example, because the machine is offline), then you can convert this step into -a local installation and skip the rest. For this you will need to change -the \c{configure} and \c{install} command lines above along these lines (see -also a note on the following step about only building shared libraries): +a local installation and skip the rest of the steps. + +\N|To perform a local installation with the \c{build-msvc.bat} batch file, +pass the \c{--local} option.| + +To perform a local installation you will need to change the \c{configure} and +\c{install} command lines above along these lines (see also a note on the +following step about only building shared libraries): \ > build2\build2\b-boot configure ^ @@ -132,16 +137,28 @@ also a note on the following step about only building shared libraries): config.bin.lib=shared ^ config.install.root=C:\build2 -> build2\build2\b-boot install: build2/ bpkg/ bdep/ +> build2\build2\b-boot install: build2\ bpkg\ bdep\ \ -\N|To perform a local installation with the \c{build-msvc.bat} batch file, -pass the \c{--local} option.| +You will also need to build and install the standard build system modules: + +\ +> b install: libbuild2-*\ +\ + +\N|To verify the build system modules installation you can load them with the +following command: + +\ +> b noop: tests\libbuild2-*\ +\ + +| To uninstall such a local installation, run: \ -> b uninstall: build2/ bpkg/ bdep/ +> b uninstall: build2\ bpkg\ bdep\ libbuild2-*\ \ | @@ -175,10 +192,20 @@ Next, we add the package repository, build, and install: > bpkg-stage add https://pkg.cppget.org/1/alpha > bpkg-stage fetch > bpkg-stage build --for install build2 bpkg bdep -> bpkg-stage install build2 bpkg bdep +> bpkg-stage install --all \ -Finally, we verify the result: +\N|By default \c{bpkg} will build the latest available version of each +package. You can, however, specify the desired versions explicitly, for +example: + +\ +> bpkg-stage build --for install build2/X.Y.Z bpkg/X.Y.Z bdep/X.Y.Z +\ + +| + +To verify the result, run: \ > where b @@ -195,15 +222,39 @@ C:\build2\bin\bdep.exe > bdep --version \ +Finally, we build and install the standard build system modules: + +\ +> bpkg build --for install libbuild2-kconfig +> bpkg install libbuild2-kconfig +\ + +\N|To get a list of the standard pre-installed build system modules in a +specific version of the toolchain, run: + +\ +> cd ..\build2-toolchain-X.Y.Z +> dir /B libbuild2-* +\ + | +\N|To verify the build system modules installation you can load them with the +following command: + +\ +> b noop: ..\build2-toolchain-X.Y.Z\tests\libbuild2-*\ +\ + +|| + \li|\n\b{5. Clean}\n The last thing we need to do is uninstall the staged tools: \ > cd ..\build2-toolchain-X.Y.Z # Back to bootstrap. -> b uninstall: build2/ bpkg/ +> b uninstall: build2\ bpkg\ \ || diff --git a/UPGRADE.cli b/UPGRADE.cli index 7b15afd..066153f 100644 --- a/UPGRADE.cli +++ b/UPGRADE.cli @@ -23,9 +23,9 @@ toolchain (similar to what we did during bootstrap), test it, uninstall the old toolchain, install the new toolchain as \"final\", and finally uninstall \c{-stage}. -We recommend that you use a dirty upgrade for patch releases with the same -\c{X.Y} (\c{MAJOR.MINOR}) version and a staged upgrade otherwise. With patch -releases we guarantee not to alter the installation file set. +We recommend that you use a dirty upgrade for toolchain patch releases with +the same \c{X.Y} (\c{MAJOR.MINOR}) version and a staged upgrade otherwise. +With patch releases we guarantee not to alter the installation file set. \N|Without periodic upgrades your version of the toolchain may become too old to be able to upgrade itself. In this case you will have to fall back onto the @@ -42,26 +42,25 @@ The dirty upgrade is straightforward: \ $ cd build2-toolchain-X.Y $ bpkg fetch -$ bpkg build --for install -ur build2 bpkg bdep -$ bpkg install build2 bpkg bdep +$ bpkg build --for install -pr +$ bpkg install --all \ -\N|The \c{-ur} options stands for \c{--upgrade} and \c{--recursive} \- upgrade -the listed packages and their dependencies, recursively. See -\l{bpkg-pkg-build(1)} for details.| +\N|The \c{-pr} options stands for \c{--patch} and \c{--recursive} \- upgrade +the built packages and their dependencies to the latest patch version, +recursively. See \l{bpkg-pkg-build(1)} for details.| -You may also want to issue the \c{status} command after \c{fetch} to examine -which versions are available. By default \c{bpkg} will upgrade to the latest -available but you can override this by specifying the desired version -explicitly, for example: +You can also issue the \c{status} command after \c{fetch} to examine which +versions are available. The above \c{build} command will upgrade all the +packages to the latest available patch versions but you can override this by +specifying the desired packages and/or versions explicitly, for example: \ -$ bpkg status build2 bpkg bdep -!build2 configured 1.0.0 available 1.0.1 2.0.0 -!bpkg configured 1.0.0 available 1.0.1 2.0.0 -!bdep configured 1.0.0 available 1.0.1 2.0.0 +$ bpkg status +!build2 configured 1.0.0 available 1.0.1 1.0.2 2.0.0 +... -$ bpkg build --for install build2/1.0.1 bpkg/1.0.1 bdep/1.0.1 +$ bpkg build --for install build2/1.0.1 \ The staged upgrade consists of several steps: @@ -106,19 +105,36 @@ Or, using Windows command prompt: \li|\n\b{2. Build and Install as \c{-stage}}\n -This step is similar to the dirty upgrade except we use the copied -configuration and install the new toolchain with the \c{-stage} suffix: +This step is similar to the dirty upgrade except that we use the copied +configuration, upgrade (\c{--upgrade|-u}) instead of patching +(\c{--patch|-p}), and install the new toolchain with the \c{-stage} suffix: \ $ cd build2-toolchain-X.Z -$ bpkg build --for install -ur build2 bpkg bdep +$ bpkg build --for install -ur +\ + +In addition to upgrading existing packages, we may also need to build packages +that were added in the new version (listed after the command for a number of +previous releases): + +\ +$ bpkg build --for install ... + +# new in 0.14.0: libbuild2-kconfig +\ + +Once this is done, we can proceed to installing: + +\ $ bpkg install \ config.bin.suffix=-stage \ config.install.data_root=root/stage \ - build2 bpkg bdep + --all \ -| +You can also specify the desired packages and/or versions explicitly, again, +similar to the dirty upgrade.| \li|\n\b{3. Test Staged}\n @@ -141,10 +157,10 @@ one and install the new one: \ $ cd ../build2-toolchain-X.Y -$ bpkg uninstall build2 bpkg bdep +$ bpkg uninstall --all $ cd ../build2-toolchain-X.Z -$ bpkg-stage install build2 bpkg bdep +$ bpkg-stage install --all \ | @@ -159,7 +175,7 @@ line history to find the corresponding \c{install} command and change it to $ bpkg uninstall \ config.bin.suffix=-stage \ config.install.data_root=root/stage \ - build2 bpkg bdep + --all \ You can also remove the old configuration in \c{build2-toolchain-X.Y/} if you diff --git a/build-clang.bat.in b/build-clang.bat.in index 1a69072..fe7e26d 100644 --- a/build-clang.bat.in +++ b/build-clang.bat.in @@ -10,15 +10,17 @@ goto start echo. echo Usage: %0 [/?] [^] [^] echo Options: -echo --local Don't build from packages, only from local source. -echo --no-bpkg Don't install bpkg nor bdep (requires --local). -echo --no-bdep Don't install bdep. -echo --install-dir ^ Alternative installation directory. -echo --repo ^ Alternative package repository location. -echo --trust ^ Repository certificate fingerprint to trust. -echo --timeout ^ Network operations timeout in seconds. -echo --make ^ Bootstrap using GNU make instead of batch file. -echo --verbose ^ Diagnostics verbosity level between 0 and 6. +echo --local Don't build from packages, only from local source. +echo --no-bpkg Don't install bpkg nor bdep (requires --local). +echo --no-bdep Don't install bdep. +echo --no-modules Don't install standard build system modules. +echo --modules "" Install only specified standard build system modules. +echo --install-dir ^ Alternative installation directory. +echo --repo ^ Alternative package repository location. +echo --trust ^ Repository certificate fingerprint to trust. +echo --timeout ^ Network operations timeout in seconds. +echo --make ^ Bootstrap using GNU make instead of batch file. +echo --verbose ^ Diagnostics verbosity level between 0 and 6. echo. echo By default the batch file will use clang++.exe as the C++ compiler and echo install into C:\build2. It also expects to find the base utilities in the @@ -34,6 +36,14 @@ echo additional make options, for example: echo. echo %0 --make mingw32-make --make -j8 echo. +echo The script by default installs the following standard build system +echo modules: +echo. +echo %standard_modules% +echo. +echo Use --no-modules to suppress installing build system modules or +echo --modules "" to specify a comma-separated subset to install. +echo. echo See the BOOTSTRAP-WINDOWS-CLANG file for details. echo. goto end @@ -54,6 +64,14 @@ set "build2_ver=@BUILD2_VERSION@" set "bpkg_ver=@BPKG_VERSION@" set "bdep_ver=@BDEP_VERSION@" +rem Standard modules comma-separated list and versions. +rem +rem NOTE: we currently print the list as a single line and will need to +rem somehow change that when it becomes too long. +rem +set "standard_modules=kconfig" +set "kconfig_ver=@KCONFIG_VERSION@" + rem The bpkg configuration directory. rem set "cver=@CONFIG_VER@" @@ -64,6 +82,7 @@ rem set "local=" set "bpkg=true" set "bdep=true" +set "modules=%standard_modules%" set "idir=C:\build2" set "trust=" set "timeout=" @@ -93,6 +112,19 @@ if "_%~1_" == "_--no-bdep_" ( goto options ) +if "_%~1_" == "_--no-modules_" ( + set "modules=" + shift + goto options +) + +if "_%~1_" == "_--modules_" ( + set "modules=%~2" + shift + shift + goto options +) + if "_%~1_" == "_--install-dir_" ( if "_%~2_" == "__" ( echo error: installation directory expected after --install-dir @@ -187,6 +219,14 @@ if "_%bpkg%_" == "__" ( set "bdep=" ) +for %%m in (%modules%) do ( + if "_!%%m_ver!_" == "__" ( + echo error: unknown standard build system module '%%m' + echo info: available standard modules: %standard_modules% + goto error + ) +) + rem Convert a relative path to an absolute. rem for /F "delims=|" %%D in ("%idir%") do set "idir=%%~dpnxD" @@ -299,14 +339,16 @@ build2\build2\b-boot %verbose% configure^ config.install.root=%idir% @if errorlevel 1 goto error -@set "projects=build2/" +@rem Install toolchain. +@rem +@set "projects=build2\" @if "_%bpkg%_" == "_true_" ( - set "projects=%projects% bpkg/" + set "projects=%projects% bpkg\" ) @if "_%bdep%_" == "_true_" ( - set "projects=%projects% bdep/" + set "projects=%projects% bdep\" ) build2\build2\b-boot %verbose% install: %projects% @@ -338,6 +380,26 @@ bdep --version :bdep_vle +@rem Install modules. +@rem +@set "projects=" +@set "tests=" + +@for %%m in (%modules%) do @( + set "projects=!projects! libbuild2-%%m\" + set "tests=!tests! tests\libbuild2-%%m-tests\" +) + +@if "_%projects%_" == "__" goto mods_ile + +b install: %projects:~1% +@if errorlevel 1 goto error + +b noop: %tests:~1% +@if errorlevel 1 goto error + +:mods_ile + @echo off echo. @@ -436,10 +498,40 @@ bdep --version :bdep_vpe -@rem Clean up stage. +@rem Build, install, and verify the build system modules. @rem +@set "packages=" +@set "package_versions=" +@set "tests=" + +@for %%m in (%modules%) do @( + set "packages=!packages! libbuild2-%%m" + set "package_versions=!package_versions! libbuild2-%%m/!%%m_ver!" + set "tests=!tests! tests\libbuild2-%%m-tests\" +) + +@if "_%packages%_" == "__" goto mods_ipe + +bpkg build --for install %package_versions:~1% +@if errorlevel 1 goto error + +bpkg install %packages:~1% +@if errorlevel 1 goto error + +:mods_ipe + cd %owd% -b %verbose% uninstall: build2/ bpkg/ + +@if "_%tests%_" == "__" goto mods_lpe + +b noop: %tests:~1% +@if errorlevel 1 goto error + +:mods_lpe + +@rem Clean up stage. +@rem +b %verbose% uninstall: build2\ bpkg\ @if errorlevel 1 goto error @echo off diff --git a/build-mingw.bat.in b/build-mingw.bat.in index caf3a51..86c35bf 100644 --- a/build-mingw.bat.in +++ b/build-mingw.bat.in @@ -10,15 +10,17 @@ goto start echo. echo Usage: %0 [/?] [^] ^ echo Options: -echo --local Don't build from packages, only from local source. -echo --no-bpkg Don't install bpkg nor bdep (requires --local). -echo --no-bdep Don't install bdep. -echo --install-dir ^ Alternative installation directory. -echo --repo ^ Alternative package repository location. -echo --trust ^ Repository certificate fingerprint to trust. -echo --timeout ^ Network operations timeout in seconds. -echo --make ^ Bootstrap using GNU make instead of batch file. -echo --verbose ^ Diagnostics verbosity level between 0 and 6. +echo --local Don't build from packages, only from local source. +echo --no-bpkg Don't install bpkg nor bdep (requires --local). +echo --no-bdep Don't install bdep. +echo --no-modules Don't install standard build system modules. +echo --modules "" Install only specified standard build system modules. +echo --install-dir ^ Alternative installation directory. +echo --repo ^ Alternative package repository location. +echo --trust ^ Repository certificate fingerprint to trust. +echo --timeout ^ Network operations timeout in seconds. +echo --make ^ Bootstrap using GNU make instead of batch file. +echo --verbose ^ 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 @@ -33,6 +35,14 @@ echo additional make options, for example: echo. echo %0 --make mingw32-make --make -j8 g++ echo. +echo The script by default installs the following standard build system +echo modules: +echo. +echo %standard_modules% +echo. +echo Use --no-modules to suppress installing build system modules or +echo --modules "" to specify a comma-separated subset to install. +echo. echo See the BOOTSTRAP-WINDOWS-MINGW file for details. echo. goto end @@ -53,6 +63,14 @@ set "build2_ver=@BUILD2_VERSION@" set "bpkg_ver=@BPKG_VERSION@" set "bdep_ver=@BDEP_VERSION@" +rem Standard modules comma-separated list and versions. +rem +rem NOTE: we currently print the list as a single line and will need to somehow +rem change that when it becomes too long. +rem +set "standard_modules=kconfig" +set "kconfig_ver=@KCONFIG_VERSION@" + rem The bpkg configuration directory. rem set "cver=@CONFIG_VER@" @@ -63,6 +81,7 @@ rem set "local=" set "bpkg=true" set "bdep=true" +set "modules=%standard_modules%" set "idir=C:\build2" set "trust=" set "timeout=" @@ -92,6 +111,19 @@ if "_%~1_" == "_--no-bdep_" ( goto options ) +if "_%~1_" == "_--no-modules_" ( + set "modules=" + shift + goto options +) + +if "_%~1_" == "_--modules_" ( + set "modules=%~2" + shift + shift + goto options +) + if "_%~1_" == "_--install-dir_" ( if "_%~2_" == "__" ( echo error: installation directory expected after --install-dir @@ -196,6 +228,14 @@ if "_%bpkg%_" == "__" ( set "bdep=" ) +for %%m in (%modules%) do ( + if "_!%%m_ver!_" == "__" ( + echo error: unknown standard build system module '%%m' + echo info: available standard modules: %standard_modules% + goto error + ) +) + rem Convert a relative path to an absolute. rem for /F "delims=|" %%D in ("%idir%") do set "idir=%%~dpnxD" @@ -308,14 +348,16 @@ build2\build2\b-boot %verbose% configure^ config.install.root=%idir% @if errorlevel 1 goto error -@set "projects=build2/" +@rem Install toolchain. +@rem +@set "projects=build2\" @if "_%bpkg%_" == "_true_" ( - set "projects=%projects% bpkg/" + set "projects=%projects% bpkg\" ) @if "_%bdep%_" == "_true_" ( - set "projects=%projects% bdep/" + set "projects=%projects% bdep\" ) build2\build2\b-boot %verbose% install: %projects% @@ -324,7 +366,7 @@ build2\build2\b-boot %verbose% install: %projects% @rem The where command is not available on XP without the resource kit. @rem where b -rem @if errorlevel 1 goto error +@rem @if errorlevel 1 goto error b --version @if errorlevel 1 goto error @@ -332,7 +374,7 @@ b --version @if "_%bpkg%_" == "__" goto bpkg_vle where bpkg -rem @if errorlevel 1 goto error +@rem @if errorlevel 1 goto error bpkg --version @if errorlevel 1 goto error @@ -342,13 +384,33 @@ bpkg --version @if "_%bdep%_" == "__" goto bdep_vle where bdep -rem @if errorlevel 1 goto error +@rem @if errorlevel 1 goto error bdep --version @if errorlevel 1 goto error :bdep_vle +@rem Install modules. +@rem +@set "projects=" +@set "tests=" + +@for %%m in (%modules%) do @( + set "projects=!projects! libbuild2-%%m\" + set "tests=!tests! tests\libbuild2-%%m-tests\" +) + +@if "_%projects%_" == "__" goto mods_ile + +b install: %projects:~1% +@if errorlevel 1 goto error + +b noop: %tests:~1% +@if errorlevel 1 goto error + +:mods_ile + @echo off echo. @@ -446,9 +508,39 @@ bdep --version :bdep_vpe -@rem Clean up stage. +@rem Build, install, and verify the build system modules. @rem +@set "packages=" +@set "package_versions=" +@set "tests=" + +@for %%m in (%modules%) do @( + set "packages=!packages! libbuild2-%%m" + set "package_versions=!package_versions! libbuild2-%%m/!%%m_ver!" + set "tests=!tests! tests\libbuild2-%%m-tests\" +) + +@if "_%packages%_" == "__" goto mods_ipe + +bpkg build --for install %package_versions:~1% +@if errorlevel 1 goto error + +bpkg install %packages:~1% +@if errorlevel 1 goto error + +:mods_ipe + cd %owd% + +@if "_%tests%_" == "__" goto mods_lpe + +b noop: %tests:~1% +@if errorlevel 1 goto error + +:mods_lpe + +@rem Clean up stage. +@rem b %verbose% uninstall: build2\ bpkg\ @if errorlevel 1 goto error diff --git a/build-msvc.bat.in b/build-msvc.bat.in index f94e2c2..46c5ddb 100644 --- a/build-msvc.bat.in +++ b/build-msvc.bat.in @@ -11,14 +11,16 @@ echo. rem echo Usage: %0 [/?] [^] [^] echo Usage: %0 [/?] [^] echo Options: -echo --local Don't build from packages, only from local source. -echo --no-bpkg Don't install bpkg nor bdep (requires --local). -echo --no-bdep Don't install bdep. -echo --install-dir ^ Alternative installation directory. -echo --repo ^ Alternative package repository location. -echo --trust ^ Repository certificate fingerprint to trust. -echo --timeout ^ Network operations timeout in seconds. -echo --verbose ^ Diagnostics verbosity level between 0 and 6. +echo --local Don't build from packages, only from local source. +echo --no-bpkg Don't install bpkg nor bdep (requires --local). +echo --no-bdep Don't install bdep. +echo --no-modules Don't install standard build system modules. +echo --modules "" Install only specified standard build system modules. +echo --install-dir ^ Alternative installation directory. +echo --repo ^ Alternative package repository location. +echo --trust ^ Repository certificate fingerprint to trust. +echo --timeout ^ Network operations timeout in seconds. +echo --verbose ^ 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\ @@ -27,6 +29,14 @@ echo. echo The --trust option recognizes two special values: 'yes' ^(trust everything^) echo and 'no' (trust nothing). echo. +echo The script by default installs the following standard build system +echo modules: +echo. +echo %standard_modules% +echo. +echo Use --no-modules to suppress installing build system modules or +echo --modules "" to specify a comma-separated subset to install. +echo. echo See the BOOTSTRAP-WINDOWS-MSVC file for details. echo. goto end @@ -47,6 +57,14 @@ set "build2_ver=@BUILD2_VERSION@" set "bpkg_ver=@BPKG_VERSION@" set "bdep_ver=@BDEP_VERSION@" +rem Standard modules comma-separated list and versions. +rem +rem NOTE: we currently print the list as a single line and will need to +rem somehow change that when it becomes too long. +rem +set "standard_modules=kconfig" +set "kconfig_ver=@KCONFIG_VERSION@" + rem The bpkg configuration directory. rem set "cver=@CONFIG_VER@" @@ -57,6 +75,7 @@ rem set "local=" set "bpkg=true" set "bdep=true" +set "modules=%standard_modules%" set "idir=C:\build2" set "trust=" set "timeout=" @@ -85,6 +104,19 @@ if "_%~1_" == "_--no-bdep_" ( goto options ) +if "_%~1_" == "_--no-modules_" ( + set "modules=" + shift + goto options +) + +if "_%~1_" == "_--modules_" ( + set "modules=%~2" + shift + shift + goto options +) + if "_%~1_" == "_--install-dir_" ( if "_%~2_" == "__" ( echo error: installation directory expected after --install-dir @@ -176,6 +208,14 @@ if "_%bpkg%_" == "__" ( set "bdep=" ) +for %%m in (%modules%) do ( + if "_!%%m_ver!_" == "__" ( + echo error: unknown standard build system module '%%m' + echo info: available standard modules: %standard_modules% + goto error + ) +) + rem Convert a relative path to an absolute. rem for /F "delims=|" %%D in ("%idir%") do set "idir=%%~dpnxD" @@ -274,14 +314,16 @@ build2\build2\b-boot %verbose% configure^ config.install.root=%idir% @if errorlevel 1 goto error -@set "projects=build2/" +@rem Install toolchain. +@rem +@set "projects=build2\" @if "_%bpkg%_" == "_true_" ( - set "projects=%projects% bpkg/" + set "projects=%projects% bpkg\" ) @if "_%bdep%_" == "_true_" ( - set "projects=%projects% bdep/" + set "projects=%projects% bdep\" ) build2\build2\b-boot %verbose% install: %projects% @@ -313,6 +355,26 @@ bdep --version :bdep_vle +@rem Install modules. +@rem +@set "projects=" +@set "tests=" + +@for %%m in (%modules%) do @( + set "projects=!projects! libbuild2-%%m\" + set "tests=!tests! tests\libbuild2-%%m-tests\" +) + +@if "_%projects%_" == "__" goto mods_ile + +b install: %projects:~1% +@if errorlevel 1 goto error + +b noop: %tests:~1% +@if errorlevel 1 goto error + +:mods_ile + @echo off echo. @@ -410,10 +472,40 @@ bdep --version :bdep_vpe -@rem Clean up stage. +@rem Build, install, and verify the build system modules. @rem +@set "packages=" +@set "package_versions=" +@set "tests=" + +@for %%m in (%modules%) do @( + set "packages=!packages! libbuild2-%%m" + set "package_versions=!package_versions! libbuild2-%%m/!%%m_ver!" + set "tests=!tests! tests\libbuild2-%%m-tests\" +) + +@if "_%packages%_" == "__" goto mods_ipe + +bpkg build --for install %package_versions:~1% +@if errorlevel 1 goto error + +bpkg install %packages:~1% +@if errorlevel 1 goto error + +:mods_ipe + cd %owd% -b %verbose% uninstall: build2/ bpkg/ + +@if "_%tests%_" == "__" goto mods_lpe + +b noop: %tests:~1% +@if errorlevel 1 goto error + +:mods_lpe + +@rem Clean up stage. +@rem +b %verbose% uninstall: build2\ bpkg\ @if errorlevel 1 goto error @echo off diff --git a/build.sh.in b/build.sh.in index d72b59b..613dad3 100644 --- a/build.sh.in +++ b/build.sh.in @@ -17,6 +17,14 @@ build2_ver="@BUILD2_VERSION@" bpkg_ver="@BPKG_VERSION@" bdep_ver="@BDEP_VERSION@" +# Standard modules comma-separated list and versions. +# +# NOTE: we currently print the list as a single line and will need to somehow +# change that when it becomes too long. +# +standard_modules="kconfig" +kconfig_ver="@KCONFIG_VERSION@" + # The bpkg configuration directory. # cver="@CONFIG_VER@" @@ -44,6 +52,7 @@ owd="$(pwd)" local= bpkg=true bdep=true +modules="$standard_modules" private= idir= jobs= @@ -65,6 +74,8 @@ while test $# -ne 0; do diag " --local Don't build from packages, only from local source." diag " --no-bpkg Don't install bpkg nor bdep (requires --local)." diag " --no-bdep Don't install bdep." + diag " --no-modules Don't install standard build system modules." + diag " --modules Install only specified standard build system modules." diag " --install-dir Alternative installation directory." diag " --sudo Optional sudo program to use (pass false to disable)." diag " --private Install shared libraries into private subdirectory." @@ -105,6 +116,14 @@ while test $# -ne 0; do diag diag "$0 g++ -g" diag + diag "The script by default installs the following standard build system" + diag "modules:" + diag + diag "$standard_modules" + diag + diag "Use --no-modules to suppress installing build system modules or" + diag "--modules to specify a comma-separated subset to install." + diag diag "See the BOOTSTRAP-UNIX file for details." diag exit 0 @@ -121,6 +140,15 @@ while test $# -ne 0; do bdep= shift ;; + --no-modules) + modules= + shift + ;; + --modules) + shift + modules="$1" + shift + ;; --private) private=config.install.private=build2 shift @@ -256,6 +284,23 @@ if test -z "$bpkg"; then bdep= fi +module_version () # +{ + eval "echo \$$1_ver" +} + +# Convert the comma-separated modules list into a space-separated list. +# +module_list="$(echo "$modules" | sed 's/,/ /g')" + +for m in $module_list; do + if test -z "$(module_version "$m")"; then + diag "error: unknown standard build system module '$m'" + diag " info: available standard modules: $standard_modules" + exit 1 + fi +done + # If the installation directory is unspecified, then assume it is /usr/local. # Otherwise, if it is a relative path, then convert it to an absolute path, # unless the realpath program is not present on the system or doesn't @@ -399,6 +444,8 @@ config.install.root="$idir" \ config.install.sudo="$conf_sudo" \ $private + # Install toolchain. + # projects="build2/" if test "$bpkg" = true; then @@ -424,6 +471,21 @@ $private run bdep --version fi + # Install modules. + # + projects= + tests= + + for m in $module_list; do + projects="$projects libbuild2-$m/" + tests="$tests tests/libbuild2-$m-tests/" + done + + if test -n "$projects"; then + run b install: $projects + run b noop: $tests + fi + diag diag "Toolchain installation: $idir/bin" diag "Build configuration: $owd" @@ -490,9 +552,31 @@ if test "$bdep" = true; then run bdep --version fi -# Clean up stage. +# Build, install, and verify the build system modules. # +packages= +package_versions= +tests= + +for m in $module_list; do + packages="$packages libbuild2-$m" + package_versions="$package_versions libbuild2-$m/$(module_version "$m")" + tests="$tests tests/libbuild2-$m-tests/" +done + +if test -n "$packages"; then + run bpkg build --for install $package_versions + run bpkg install $packages +fi + run cd "$owd" + +if test -n "$tests"; then + run b noop: $tests +fi + +# Clean up stage. +# run b $verbose $jobs uninstall: build2/ bpkg/ diag diff --git a/buildfile b/buildfile index c229dc8..bb93923 100644 --- a/buildfile +++ b/buildfile @@ -38,15 +38,25 @@ BOOTSTRAP-WINDOWS-MINGW cli{$i} \ manifest -# Obtain the build2, bpkg, bdep, and toolchain versions. +# Obtain the toolchain and standard build system modules versions. # bp = $recall($build.path) pt = '^version: (.+)$' -ver = $process.run_regex($bp 'info:' $src_root/, "$pt", '\1') -build2_ver = $process.run_regex($bp 'info:' $src_root/build2/, "$pt", '\1') -bpkg_ver = $process.run_regex($bp 'info:' $src_root/bpkg/, "$pt", '\1') -bdep_ver = $process.run_regex($bp 'info:' $src_root/bdep/, "$pt", '\1') +# When adding a new standard build system module, these are the places where +# you will need to make changes (igrep for the name of one of the existing +# modules to locate all the places): +# +# - this buildfile +# - build scripts: build.sh.in and build-*.bat.in +# - documentation: BOOTSTRAP-*.cli and UPGRADE.cli (mention as new module) +# - install scripts: prepare, build2-install.sh, and build2-install-*.bat +# +ver = $process.run_regex($bp 'info:' $src_root/, "$pt", '\1') +build2_ver = $process.run_regex($bp 'info:' $src_root/build2/, "$pt", '\1') +bpkg_ver = $process.run_regex($bp 'info:' $src_root/bpkg/, "$pt", '\1') +bdep_ver = $process.run_regex($bp 'info:' $src_root/bdep/, "$pt", '\1') +kconfig_ver = $process.run_regex($bp 'info:' $src_root/libbuild2-kconfig/, "$pt", '\1') # Generate install scripts from templates and include them into the # distribution. @@ -80,11 +90,12 @@ for s: exe{build.sh} file{build-msvc.bat build-clang.bat build-mingw.bat} cver = "$cver-$ab.$pr" end - sed -e 's%@BUILD2_REPO@%'$build2_repo'%' $p >$t - sed -e 's/@CONFIG_VER@/'$cver'/' -i $t - sed -e 's/@BUILD2_VERSION@/'$build2_ver'/' -i $t - sed -e 's/@BPKG_VERSION@/'$bpkg_ver'/' -i $t - sed -e 's/@BDEP_VERSION@/'$bdep_ver'/' -i $t + sed -e 's%@BUILD2_REPO@%'$build2_repo'%' $p >$t + sed -e 's/@CONFIG_VER@/'$cver'/' -i $t + sed -e 's/@BUILD2_VERSION@/'$build2_ver'/' -i $t + sed -e 's/@BPKG_VERSION@/'$bpkg_ver'/' -i $t + sed -e 's/@BDEP_VERSION@/'$bdep_ver'/' -i $t + sed -e 's/@KCONFIG_VERSION@/'$kconfig_ver'/' -i $t }} } -- cgit v1.1