On Fri, Jun 5, 2020 at 11:17 PM Bram Moolenaar <[email protected]> wrote:
>
>
> Patch 8.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.
Does this mean that incremental compiles done without reconfiguring
will all get the same "compiled" date at top of their :version text if
this option is used? From the foregoing discussion, I would have
expected this environment variable to be set at compile-time, which is
when version.c gets the __DATE__ and __TIME__ settings when it uses
them. IIUC anyone who wants to use $SOURCE_DATE_EPOCH will have to run
"make reconfig" (or configure then make then make install) whenever a
new value of the "reproducible build date" is desired.
> Files: src/config.h.in, src/config.mk.in, src/configure.ac,
> src/auto/configure, src/version.c, src/Makefile
>
>
> *** ../vim-8.2.0909/src/config.h.in 2020-05-07 18:37:00.124512605 +0200
> --- src/config.h.in 2020-06-05 22:48:47.863212338 +0200
> ***************
> *** 30,35 ****
> --- 30,38 ----
> /* Define when __DATE__ " " __TIME__ can be used */
> #undef HAVE_DATE_TIME
>
> + /* Defined from $SOURCE_DATE_EPOCH, used as the build date */
> + #undef BUILD_DATE
> +
> /* Define when __attribute__((unused)) can be used */
> #undef HAVE_ATTRIBUTE_UNUSED
>
> *** ../vim-8.2.0909/src/config.mk.in 2019-11-21 17:03:28.000000000 +0100
> --- src/config.mk.in 2020-06-05 22:53:31.026107842 +0200
> ***************
> *** 169,174 ****
> --- 169,178 ----
> MSGFMT = @MSGFMT@
> MSGFMT_DESKTOP = @MSGFMT_DESKTOP@
>
> + ### set if $SOURCE_DATE_EPOCH was set when running configure
> + BUILD_DATE_MSG = @BUILD_DATE_MSG@
> +
> +
> # Make sure that "make first" will run "make all" once configure has done
> its
> # work. This is needed when using the Makefile in the top directory.
> first: all
> *** ../vim-8.2.0909/src/configure.ac 2020-05-30 18:14:37.824521074 +0200
> --- src/configure.ac 2020-06-05 23:14:42.985737574 +0200
> ***************
> *** 62,67 ****
> --- 62,79 ----
> 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)
> *** ../vim-8.2.0909/src/auto/configure 2020-05-30 18:14:37.824521074 +0200
> --- src/auto/configure 2020-06-05 23:14:48.093721505 +0200
> ***************
> *** 721,726 ****
> --- 721,727 ----
> XCODE_SELECT
> CPP_MM
> CROSS_COMPILING
> + BUILD_DATE_MSG
> STRIP
> AWK
> FGREP
> ***************
> *** 4455,4460 ****
> --- 4456,4472 ----
> fi
> fi
>
> + 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")
> + cat >>confdefs.h <<_ACEOF
> + #define BUILD_DATE "$BUILD_DATE"
> + _ACEOF
> +
> + BUILD_DATE_MSG=-"echo -e
> '=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\nNOTE:
> build date/time is fixed:
> $BUILD_DATE\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-='"
> +
> + fi
> +
>
> { $as_echo "$as_me:${as_lineno-$LINENO}: checking --enable-fail-if-missing
> argument" >&5
> $as_echo_n "checking --enable-fail-if-missing argument... " >&6; }
> *** ../vim-8.2.0909/src/version.c 2020-06-05 22:33:38.409658754 +0200
> --- src/version.c 2020-06-05 22:45:50.531697794 +0200
> ***************
> *** 44,52 ****
> --- 44,56 ----
> * VAX C can't concatenate strings in the preprocessor.
> */
> strcpy(longVersion, VIM_VERSION_LONG_DATE);
> + #ifdef BUILD_DATE
> + strcat(longVersion, BUILD_DATE);
> + #else
> strcat(longVersion, __DATE__);
> strcat(longVersion, " ");
> strcat(longVersion, __TIME__);
> + #endif
> strcat(longVersion, ")");
> }
>
> ***************
> *** 56,62 ****
> --- 60,70 ----
> {
> if (longVersion == NULL)
> {
> + #ifdef BUILD_DATE
> + char *date_time = BUILD_DATE;
> + #else
> char *date_time = __DATE__ " " __TIME__;
> + #endif
> char *msg = _("%s (%s, compiled %s)");
> size_t len = strlen(msg)
> + strlen(VIM_VERSION_LONG_ONLY)
> *** ../vim-8.2.0909/src/Makefile 2020-06-02 20:25:33.164477793 +0200
> --- src/Makefile 2020-06-05 23:03:33.035904816 +0200
> ***************
> *** 2130,2135 ****
> --- 2130,2136 ----
> # A shell script is used to try linking without unnecessary libraries.
> $(VIMTARGET): auto/config.mk objects $(OBJ) version.c version.h
> $(CCC) version.c -o objects/version.o
> + @$(BUILD_DATE_MSG)
> @LINK="$(PURIFY) $(SHRPENV) $(CClink) $(ALL_LIB_DIRS) $(LDFLAGS) \
> -o $(VIMTARGET) $(OBJ) $(ALL_LIBS)" \
> MAKE="$(MAKE)" LINK_AS_NEEDED=$(LINK_AS_NEEDED) \
> +** ../vim-8.2.0909/src/version.c 2020-06-05 22:33:38.409658754 +0200
> --- src/version.c 2020-06-05 22:45:50.531697794 +0200
> **************
> */
> strcpy(longVersion, VIM_VERSION_LONG_DATE);
> + #ifdef BUILD_DATE
> + strcat(longVersion, BUILD_DATE);
> + #else
> strcat(longVersion, __DATE__);
> strcat(longVersion, " ");
> strcat(longVersion, __TIME__);
> + #endif
> strcat(longVersion, ")");
> }
> ***************
> *** 57,59 ****
> --- 61,67 ----
> if (longVersion == NULL)
> {
> + #ifdef BUILD_DATE
> + char *date_time = BUILD_DATE;
> + #else
> char *date_time = __DATE__ " " __TIME__;
> + #endif
> char *msg = _("%s (%s, compiled %s)");
> size_t len = strlen(msg)
>
> --
> They now pass three KNIGHTS impaled to a tree. With their feet off the
> ground, with one lance through the lot of them, they are skewered up
> like a barbecue.
> "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD
>
> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
> \\\ an exciting new programming language -- http://www.Zimbu.org ///
> \\\ help me help AIDS victims -- http://ICCF-Holland.org ///
Best regards,
Tony.
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/vim_dev/CAJkCKXv4qncexRnYP2aBzCGT%2B%2B9D6UCNEv8kxVih6-ytgNCdqQ%40mail.gmail.com.