aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmilio Jesus Gallego Arias2019-12-02 18:15:19 +0100
committerEmilio Jesus Gallego Arias2019-12-02 18:15:19 +0100
commit758df7b36d53644b9897b3594e03b5b7b730974c (patch)
tree445862903589d4ec42b31ff5820c216e0d7f2a2b
parentfcf5d724b5bd26581ecad6055ee33d2758133854 (diff)
parent80bd3766dd8f1729187ed9c8e0ad29f67cea0886 (diff)
Merge PR #11227: Allow to override build date with SOURCE_DATE_EPOCH
Reviewed-by: Zimmi48 Reviewed-by: ejgallego
-rw-r--r--INSTALL4
-rw-r--r--configure.ml8
-rw-r--r--doc/changelog/11-infrastructure-and-dependencies/11227-date.rst5
3 files changed, 16 insertions, 1 deletions
diff --git a/INSTALL b/INSTALL
index d9efd55b95..31758203fe 100644
--- a/INSTALL
+++ b/INSTALL
@@ -152,6 +152,10 @@ INSTALLATION PROCEDURE IN DETAILS (NORMAL USERS).
c.f. https://caml.inria.fr/mantis/view.php?id=7630
+ If you want your build to be reproducible, ensure that the
+ SOURCE_DATE_EPOCH environment variable is set as documented in
+ https://reproducible-builds.org/specs/source-date-epoch/
+
4- Still in the root directory, do
make
diff --git a/configure.ml b/configure.ml
index 88bc3f912b..89d9ed9d2a 100644
--- a/configure.ml
+++ b/configure.ml
@@ -194,6 +194,12 @@ let which prog =
let program_in_path prog =
try let _ = which prog in true with Not_found -> false
+let build_date =
+ try
+ float_of_string (Sys.getenv "SOURCE_DATE_EPOCH")
+ with
+ Not_found -> Unix.time ()
+
(** * Date *)
(** The short one is displayed when starting coqtop,
@@ -204,7 +210,7 @@ let months =
"July";"August";"September";"October";"November";"December" |]
let get_date () =
- let now = Unix.localtime (Unix.time ()) in
+ let now = Unix.gmtime build_date in
let year = 1900+now.Unix.tm_year in
let month = months.(now.Unix.tm_mon) in
sprintf "%s %d" month year,
diff --git a/doc/changelog/11-infrastructure-and-dependencies/11227-date.rst b/doc/changelog/11-infrastructure-and-dependencies/11227-date.rst
new file mode 100644
index 0000000000..5c08e2b0ea
--- /dev/null
+++ b/doc/changelog/11-infrastructure-and-dependencies/11227-date.rst
@@ -0,0 +1,5 @@
+- **Added:**
+ Build date can now be overriden by setting the `SOURCE_DATE_EPOCH`
+ environment variable
+ (`#11227 <https://github.com/coq/coq/pull/11227>`_,
+ by Bernhard M. Wiedemann).