aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/buildfile80
1 files changed, 51 insertions, 29 deletions
diff --git a/libbuild2/buildfile b/libbuild2/buildfile
index b4f420c..6707b05 100644
--- a/libbuild2/buildfile
+++ b/libbuild2/buildfile
@@ -59,42 +59,64 @@ lib{build2}: cxx{utility-uninstalled}: for_install = false
libul{build2}: config/{hxx ixx txx cxx}{** -host-config -**.test...} \
config/cxx{host-config}
+# Derive ~host and ~build2 configurations from current configuration.
+#
# This will of course blow up spectacularly if we are cross-compiling. But
# let's wait and enjoy the fireworks (and get a sense of why someone would
# want to cross-compile a build system).
#
-config/cxx{host-config}: config/in{host-config}
+# For the ~host configuration we only want c/cxx/cc and bin that they load.
+# For ~build2 we want to keep everything except dist.
+#
+# We also remove comment lines which could be confused with preprocessor
+# directives by some lesser compilers and blank lines between groups of
+# options which could cause spurious rebuilds when we filter out entire
+# groups.
+#
+# For ~build2 also filter out config.install.chroot -- we definitely don't
+# want it carried through. Also filter out variables that control tests
+# execution.
+#
+# 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_lines = [strings]
+host_config_lines = [strings]
+
+for l: $regex.replace_lines( \
+ $config.save(), \
+ '^( *(#|(config\.(test[. ]|dist\.|install\.chroot|config\.hermetic))).*|)$', \
+ [null])
{
- # For the ~host configuration we only want c/cxx/cc and bin that they load.
- # For ~build2 we want to keep everything except dist.
- #
- # We also remove comment lines which could be confused with preprocessor
- # directives by some lesser compilers and blank lines between groups of
- # options which could cause spurious rebuilds when we filter out entire
- # groups.
- #
- # For ~build2 also filter out config.install.chroot -- we definitely don't
- # want it carried through. Also filter out variables that control tests
- # execution.
- #
- # 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\.(test[. ]|dist\.|install\.chroot|config\.hermetic))).*|)$', \
- [null], \
- return_lines)
+ build2_config_lines += $l
- # Also preserve config.version.
+ # Note: also preserve config.version.
#
- host_config = $regex.replace_lines( \
- $build2_config, \
- '^ *config\.(c[. ]|cxx[. ]|cc[.]|bin[.]|config.environment |version ).*$', \
- '$&', \
- format_no_copy return_lines)
+ if $regex.match( \
+ $l, \
+ ' *config\.(c[. ]|cxx[. ]|cc[.]|bin[.]|config.environment |version ).*')
+ {
+ # Filter out sanitizer options in ~host. We run the toolchain with various
+ # sanitizers on CI but sanitizers cause issues in some packages. Note that
+ # we can have both -fsanitize and -fno-sanitize forms. For example:
+ #
+ # -fsanitize=address -fsanitize=undefined -fno-sanitize-recover=all
+ #
+ if $regex.match($l, ' *config\.(c|cxx|cc)\.(coptions|loptions)[ =].*')
+ {
+ l = $regex.replace($l, ' ?-f(no-)?sanitize[=-][^ ]+', '')
+ }
+
+ host_config_lines += $l
+ }
+}
+
+config/cxx{host-config}: config/in{host-config}
+{
+ build2_config = $regex.merge($build2_config_lines, '(.+)', '\1\n')
+ host_config = $regex.merge($host_config_lines, '(.+)', '\1\n')
}
libul{build2}: dist/{hxx ixx txx cxx}{** -**.test...}