diff --git a/make.sh b/make.sh index 452a7f29..e32783c3 100755 --- a/make.sh +++ b/make.sh @@ -15,4 +15,7 @@ done shift `expr $OPTIND - 1` OPTIND=1 +# Unix timestamp of the commit we are building +export SOURCE_DATE_EPOCH=$(git show -s --format=%ct HEAD) + sbcl --load "$BASE/jscl.lisp" --eval "(jscl:bootstrap $VERBOSE)" --eval '(quit)' diff --git a/src/toplevel.lisp b/src/toplevel.lisp index 3898c6a2..8b9365b5 100644 --- a/src/toplevel.lisp +++ b/src/toplevel.lisp @@ -255,16 +255,27 @@ (defun compilation-notice () - #.(multiple-value-bind (second minute hour date month year) - (get-decoded-time) - (declare (ignore second minute hour)) - (format nil "built on ~d ~a ~d" - date - (elt #("" "January" "February" "March" "April" "May" "June" - "July" "August" "September" "October" "November" - "December") - month) - year))) + #.(let ((build-time + ;; The variable SOURCE_DATE_EPOCH specifies the point in + ;; time of the project. It is usually set to the unix + ;; timestamp of the GIT commit being built, to make the + ;; build artifact reproducible. Variable is specified at + ;; + ;; https://reproducible-builds.org/specs/source-date-epoch/ + ;; + (if (sb-posix:getenv "SOURCE_DATE_EPOCH") + (+ (parse-integer (sb-posix:getenv "SOURCE_DATE_EPOCH")) 2208988800) + (get-universal-time)))) + (multiple-value-bind (second minute hour date month year) + (decode-universal-time build-time) + (declare (ignore second minute hour)) + (format nil "built on ~d ~a ~d" + date + (elt #("" "January" "February" "March" "April" "May" "June" + "July" "August" "September" "October" "November" + "December") + month) + year)))) (when (and (string/= (%js-typeof |module|) "undefined") (string= (%js-typeof |phantom|) "undefined"))