aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-04-16 10:26:01 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-04-16 10:26:01 +0200
commitf092670a89ce4eb213cf295406996fe97d257d21 (patch)
treeae349358453b2b40b9b3560914a3029dc06903a7
parent14addc7e868d298f7399d20ac54a42d34151c07c (diff)
Handle hermetic configurations in ~host and ~build2
Specifically, we keep config.config.environment but strip config.config.hermetic. Also update the INSTALL file.
-rw-r--r--INSTALL.cli20
-rw-r--r--libbuild2/buildfile23
2 files changed, 29 insertions, 14 deletions
diff --git a/INSTALL.cli b/INSTALL.cli
index 7150edc..dd29c17 100644
--- a/INSTALL.cli
+++ b/INSTALL.cli
@@ -2,9 +2,10 @@
// license : MIT; see accompanying LICENSE file
"
-Unless you specifically only need the \c{build2} build system and not the
-complete \c{build2} toolchain, you should use the \c{build2-toolchain}
-distribution instead.
+Unless you specifically only need the \c{build2} build system, you should
+install the entire \c{build2} toolchain instead, either using the
+\l{https://build2.org/install.xhtml install script} or the
+\c{build2-toolchain} distribution.
The instructions outlined below are essentially a summary of the first three
steps of the manual bootstrap process described in \c{build2-toolchain} with a
@@ -12,7 +13,7 @@ few extra examples that would primarily be useful for distribution packaging.
Also, below we only show commands for UNIX-like operating systems. For other
operating systems and for more details on each step, refer to the
-\c{build2-toolchain} documentation.
+\c{build2-toolchain} installation documentation.
\c{build2} requires a C++14 compiler. GCC 4.9, Clang 3.7, and MSVC 14 (2015)
Update 3 or any later versions of these compilers are known to work. The build
@@ -106,6 +107,7 @@ using shared libraries:
\
$ build2/b-boot configure \
+ config.config.hermetic=true \
config.cxx=g++ \
config.cc.coptions=-O3 \
config.bin.rpath=/usr/local/lib \
@@ -115,6 +117,13 @@ $ build2/b-boot configure \
$ build2/b-boot
\
+\N|The \c{config.config.hermetic=true} configuration variable in the first
+command makes sure the embedded \c{~host} and \c{~build2} configurations
+include the current environment. This is especially important for \c{~build2}
+which is used to dynamically build and load ad hoc recipes and build system
+modules and must therefore match the environment that was used to build the
+build system itself.|
+
If you are only interested in installing the result, then you can avoid
building tests by specifying the \c{update-for-install} operation in the last
command:
@@ -126,7 +135,6 @@ $ build2/b-boot update-for-install
On the other hand, if I you are not planning to install the result, then you
can omit the \c{config.install.*} values as well as \c{.rpath}.
-
To install:
\
@@ -146,6 +154,7 @@ Or, alternatively, for an out of tree build:
\
$ build2-static/build2/b configure: build2-X.Y.Z/@build2-shared/ \
+ config.config.hermetic=true \
config.cxx=g++ \
config.cc.coptions=-O3 \
config.bin.rpath=/usr/local/lib \
@@ -167,6 +176,7 @@ configuration variable, for example:
\
$ build2-static/build2/b configure: build2-X.Y.Z/@build2-shared/ \
+ config.config.hermetic=true \
config.cxx=g++ \
config.cc.coptions=-O3 \
config.install.root=/usr \
diff --git a/libbuild2/buildfile b/libbuild2/buildfile
index 28adbdd..96fcfd2 100644
--- a/libbuild2/buildfile
+++ b/libbuild2/buildfile
@@ -66,18 +66,23 @@ config/cxx{host-config}: config/in{host-config}
# For ~build2 also filter out config.install.chroot -- we definitely don't
# want it carried through.
#
- build2_config = $regex.replace_lines( \
- $config.save(), \
- '^ *(#|config\.dist\.|config\.install\.chroot).*$', \
- [null], \
+ # Finally, for both ~host and ~build2 we keep config.config.environment
+ # but strip config.config.hermetic* (we shouldn't be forcing hermiticity
+ # on the users of ~host/~build2; they can decide for themselves if they
+ # want it).
+ #
+ build2_config = $regex.replace_lines( \
+ $config.save(), \
+ '^ *(#|(config\.(dist\.|install\.chroot|config\.hermetic))).*$', \
+ [null], \
return_lines)
- # Also preserve blank lines between groups of options.
+ # Also preserve config.version and blank lines between groups of options.
#
- host_config = $regex.replace_lines( \
- $build2_config, \
- '^( *config\.(c[. ]|cxx[. ]|cc[.]|bin[.]).*|)$', \
- '$&', \
+ host_config = $regex.replace_lines( \
+ $build2_config, \
+ '^( *config\.(c[. ]|cxx[. ]|cc[.]|bin[.]|config.environment |version ).*|)$', \
+ '$&', \
format_no_copy return_lines)
}