Honor SOURCE_DATE_EPOCH in bootstrapping 

Currently, a stamped bazel binary contains the actual timestamp at build
time. This means, that building bazel we either include no version
information at all, or the binary contains a not reproducible time
stamp. Both are not acceptable from the point of view of a downstream
maintainer of a bazel package, where the requirement is that the package
be reproducible, but the binary still provide sensible version information.
Fortunately, there is a suggested standard to solve this problem taking
the "current time" from the SOURCE_DATE_EPOCH environment variable, if
set, rather than the actual time.
See https://reproducible-builds.org/specs/source-date-epoch/.

Honor this proposed standard, so that bazel can reasonably be packaged
downstream. See issue #2240.

Note that we only use the environment variable in our bootstrap script;
for bazel itself we communicate that information via an appropriate
option.

--
Change-Id: I55409a117285b9a3446421179c20f4e8c59088f8
Reviewed-on: https://cr.bazel.build/9467
PiperOrigin-RevId: 150896326
MOS_MIGRATED_REVID=150896326
diff --git a/scripts/bootstrap/bootstrap.sh b/scripts/bootstrap/bootstrap.sh
index a9eea83..3832692 100755
--- a/scripts/bootstrap/bootstrap.sh
+++ b/scripts/bootstrap/bootstrap.sh
@@ -22,10 +22,14 @@
 
 : ${BAZELRC:="/dev/null"}
 : ${EMBED_LABEL:=""}
+: ${SOURCE_DATE_EPOCH:=""}
 
 EMBED_LABEL_ARG=()
 if [ -n "${EMBED_LABEL}" ]; then
     EMBED_LABEL_ARG=(--stamp --embed_label "${EMBED_LABEL}")
+    if [ -n "${SOURCE_DATE_EPOCH}" ]; then
+        EMBED_LABEL_ARG+=(--experimental_embed_timestamp_epoch "${SOURCE_DATE_EPOCH}")
+    fi
 fi
 
 : ${JAVA_VERSION:="1.8"}