summaryrefslogtreecommitdiffstats
path: root/src/configure.ac
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2020-06-05 23:16:29 +0200
committerBram Moolenaar <Bram@vim.org>2020-06-05 23:16:29 +0200
commit8f1dde5021d9623a951d1ccbc78cf1b1a55ccd7a (patch)
tree1a2a9aee6f224db95e60a7ba401b2087cdbdb661 /src/configure.ac
parent002bc79991286934a9593b80635c27d4238cdfc4 (diff)
patch 8.2.0910: Vim is not reproducibly buildablev8.2.0910
Problem: Vim is not reproducibly buildable. Solution: Use the $SOURCE_DATE_EPOCH environment variable in configure. (James McCoy, closes #513) Give a warning about using it.
Diffstat (limited to 'src/configure.ac')
-rw-r--r--src/configure.ac12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/configure.ac b/src/configure.ac
index 67851802bf..dccf3dce85 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -62,6 +62,18 @@ if test x"$ac_cv_prog_cc_c99" != xno; then
fi
fi
+dnl If $SOURCE_DATE_EPOCH is present in the environment, use that as the
+dnl "compiled" timestamp in :version's output. Attempt to get the formatted
+dnl date using GNU date syntax, BSD date syntax, and finally falling back to
+dnl just using the current time.
+if test -n "$SOURCE_DATE_EPOCH"; then
+ DATE_FMT="%b %d %Y %H:%M:%S"
+ BUILD_DATE=$(LC_ALL=C date -u -d "@$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || LC_ALL=C date -u -r "$SOURCE_DATE_EPOCH" "+$DATE_FMT" 2>/dev/null || LC_ALL=C date -u "+$DATE_FMT")
+ AC_DEFINE_UNQUOTED(BUILD_DATE, ["$BUILD_DATE"])
+ BUILD_DATE_MSG=-"echo -e '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\nNOTE: build date/time is fixed: $BUILD_DATE\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='"
+ AC_SUBST(BUILD_DATE_MSG)
+fi
+
dnl Check for the flag that fails if stuff are missing.
AC_MSG_CHECKING(--enable-fail-if-missing argument)