Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to override build date with SOURCE_DATE_EPOCH #11227

Merged
merged 1 commit into from Dec 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions INSTALL
Expand Up @@ -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
Expand Down
8 changes: 7 additions & 1 deletion configure.ml
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
@@ -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).