aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/install/init.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2021-04-07 11:33:05 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2021-04-07 11:43:04 +0200
commite9f69e067da3e096e1e64be70ec2b6de30f71d2c (patch)
tree478c9f0ec86a225398424bcc9305270ca6800339 /libbuild2/install/init.cxx
parent5e51d523e71231cb190e9ed981962df527f4ee7e (diff)
Register environment variables for hermetic build configurations
Diffstat (limited to 'libbuild2/install/init.cxx')
-rw-r--r--libbuild2/install/init.cxx34
1 files changed, 34 insertions, 0 deletions
diff --git a/libbuild2/install/init.cxx b/libbuild2/install/init.cxx
index 769b106..74e9301 100644
--- a/libbuild2/install/init.cxx
+++ b/libbuild2/install/init.cxx
@@ -313,6 +313,40 @@ namespace build2
vp.insert<bool> ("install.subdirs");
}
+ // Environment.
+ //
+ // Installation may involve executing the following programs:
+ //
+ // install
+ //
+ // GNU coreutils install recognizes the SIMPLE_BACKUP_SUFFIX and
+ // VERSION_CONTROL variables but they only matter with --backup which
+ // we do not specify and assume unlikely to be specified via .options.
+ //
+ // FreeBSD install recognizes STRIPBIN and DONTSTRIP variables that
+ // only matter with -s which we do not specify but which could be
+ // specified with .options. NetBSD and OpenBSD use STRIP (Mac OS man
+ // page doesn't list anything).
+ //
+ // sudo
+ //
+ // While sudo has a bunch of SUDO_* variables, none of them appear to
+ // matter (either not used in the modes that we invoke sudo in or do
+ // not affect the result).
+ //
+ // ln, rm, rmdir
+ //
+ // GNU coreutils ln recognizes the SIMPLE_BACKUP_SUFFIX and
+ // VERSION_CONTROL variables but they only matter with --backup which
+ // we do not specify.
+ //
+#if defined(__FreeBSD__)
+ config::save_environment (rs, {"STRIPBIN", "DONTSTRIP"});
+#elif defined(__NetBSD__) || \
+ defined(__OpenBSD__)
+ config::save_environment (rs, "STRIP");
+#endif
+
// Register our rules.
//
{