diff options
| author | Bernhard M. Wiedemann | 2019-12-02 11:43:18 +0100 |
|---|---|---|
| committer | Bernhard M. Wiedemann | 2019-12-02 17:07:38 +0100 |
| commit | 80bd3766dd8f1729187ed9c8e0ad29f67cea0886 (patch) | |
| tree | b7c48e8e47e8920d45dad76022d0ea0bd933bc65 | |
| parent | 003512ecebae24bd518155f5a92b851a8f9bcd08 (diff) | |
Allow to override build date with SOURCE_DATE_EPOCH
in order to make builds reproducible.
See https://reproducible-builds.org/ for why this is good
and https://reproducible-builds.org/specs/source-date-epoch/
for the definition of this variable.
Fixes #11037
| -rw-r--r-- | INSTALL | 4 | ||||
| -rw-r--r-- | configure.ml | 8 | ||||
| -rw-r--r-- | doc/changelog/11-infrastructure-and-dependencies/11227-date.rst | 5 |
3 files changed, 16 insertions, 1 deletions
@@ -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). |
