patch 8.2.0910: Vim is not reproducibly buildable
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.
diff --git a/src/configure.ac b/src/configure.ac
index 6785180..dccf3dc 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -62,6 +62,18 @@
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)