]> code.delx.au - gnu-emacs/commitdiff
Deterministic build improvements
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 2 Mar 2016 18:21:45 +0000 (10:21 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 2 Mar 2016 18:24:11 +0000 (10:24 -0800)
* configure.ac (BUILD_DETAILS): Rename from DETERMINISTIC_DUMP,
and negate its sense.  Use it via AC_SUBST, not AC_DEFINE,
and have its value be either empty or --no-build-details.
All uses changed.  Change option to --disable-build-details.
* doc/lispref/cmdargs.texi (Initial Options):
Document --no-build-details.
* doc/lispref/internals.texi (Building Emacs):
* etc/NEWS:
Document --disable-build-details.
* doc/lispref/intro.texi (Version Info): Say that
emacs-build-time can be nil.
* lisp/erc/erc-compat.el (erc-emacs-build-time):
Now nil if details are omitted.
* lisp/erc/erc.el (erc-cmd-SV):
* lisp/version.el (emacs-build-time):
Now nil if no build details.
(emacs-version):
Output build time only if build details.
* src/Makefile.in (BUILD_DETAILS): New macro.
(temacs, bootstrap-emacs): Use it.
* src/emacs.c (build_details): New var.
(standard_args, main): Support --no-build-details.
(Vdeterministic_dump): Remove; all uses replaced
by !build_details.
(syms_of_emacs): Set Vbuild_details to a boolean, not
to a Lisp_Object.
* src/lisp.h (build_details): New decl.
* src/sysdep.c (init_system_name): When !build_details,
set system-name to nil, not to "elided".

12 files changed:
configure.ac
doc/emacs/cmdargs.texi
doc/lispref/internals.texi
doc/lispref/intro.texi
etc/NEWS
lisp/erc/erc-compat.el
lisp/erc/erc.el
lisp/version.el
src/Makefile.in
src/emacs.c
src/lisp.h
src/sysdep.c

index ad90ce8b6cca487e923782f8d303b65e44ec2c5e..0de6736aee1f066a39573459b4fb207d14290f8b 100644 (file)
@@ -546,18 +546,13 @@ AC_ARG_ENABLE(gtk-deprecation-warnings,
                [Show Gtk+/Gdk deprecation warnings for Gtk+ >= 3.0])],
 [ac_enable_gtk_deprecation_warnings="${enableval}"],[])
 
-AC_ARG_ENABLE(deterministic-dump,
-[AS_HELP_STRING([--enable-deterministic-dump],
-                [Make dumping deterministic by removing system-specific
-                information from the dump, such as host names and
-                timestamps.])])
-if test "x${enableval}" = xno ; then
-   AC_DEFINE(DETERMINISTIC_DUMP, false,
-   [Set this to true to make dumping deterministic.])
-else
-   AC_DEFINE(DETERMINISTIC_DUMP, true,
-   [Set this to true to make dumping deterministic.])
-fi
+BUILD_DETAILS=
+AC_ARG_ENABLE([build-details],
+  [AS_HELP_STRING([--disable-build-details],
+                 [Make the build more deterministic by omitting host
+                  names, time stamps, etc. from the output.])],
+  [test "$enableval" = no && BUILD_DETAILS=--no-build-details])
+AC_SUBST([BUILD_DETAILS])
 
 dnl This used to use changequote, but, apart from 'changequote is evil'
 dnl per the autoconf manual, we can speed up autoconf somewhat by quoting
index a842cb84abd9b69987faa94f49657b5820d5b82c..646c8da1bb86d8dd863f7bcc4e1bae5aa8aac6b0 100644 (file)
@@ -283,6 +283,13 @@ which will invoke Emacs with @samp{--script} and supply the name of
 the script file as @var{file}.  Emacs Lisp then treats the @samp{#!}
 on this first line as a comment delimiter.
 
+@item --no-build-details
+@opindex --no-build-details
+@cindex build details
+@cindex deterministic build
+Omit details like system name and build time from the Emacs executable,
+so that builds are more deterministic.
+
 @item -q
 @opindex -q
 @itemx --no-init-file
index 41064df5a287f6d060db59186ed53fa736bd71c0..fedef3d7f46dfc1ddda4caf115a00b0c2121ba6e 100644 (file)
@@ -66,6 +66,16 @@ into the dumped Emacs.  If you port Emacs to a new operating system,
 and are not able to implement dumping, then Emacs must load
 @file{loadup.el} each time it starts.
 
+@cindex build details
+@cindex deterministic build
+@cindex @option{--disable-build-details} option to @command{configure}
+  By default the dumped @file{emacs} executable records details such
+as the build time and host name.  Use the
+@option{--disable-build-details} option of @command{configure} to
+suppress these details, so that building and installing Emacs twice
+from the same sources is more likely to result in identical copies of
+Emacs.
+
 @cindex @file{site-load.el}
   You can specify additional files to preload by writing a library named
 @file{site-load.el} that loads them.  You may need to rebuild Emacs
index 0f42d4d8a7fd11941c7f140005815748a57fc438..2f84aeee39ee09c3ba5b0b23be26e8fe16ec1fcb 100644 (file)
@@ -494,7 +494,8 @@ giving a prefix argument makes @var{here} non-@code{nil}.
 @defvar emacs-build-time
 The value of this variable indicates the time at which Emacs was
 built.  It is a list of four integers, like the value of
-@code{current-time} (@pxref{Time of Day}).
+@code{current-time} (@pxref{Time of Day}), or is @code{nil}
+if the information is not available.
 
 @example
 @group
index a9ce26530352ed71a720bedb3aebf83794ca9fa8..cf09350d173a6e8ee83105f8daa87f469e3c2955 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -25,6 +25,15 @@ otherwise leave it unmarked.
 \f
 * Installation Changes in Emacs 25.2
 
++++
+** New configure option ‘--disable-build-details’ attempts to build an
+Emacs that is more likely to be reproducible; that is, if you build
+and install Emacs twice, the second Emacs is a copy of the first.
+Deterministic builds omit the build date from the output of the
+emacs-version and erc-cmd-SV functions, and the leave the following
+variables nil: emacs-build-system, emacs-build-time,
+erc-emacs-build-time.
+
 \f
 * Startup Changes in Emacs 25.2
 
index 5e03d30bf94d7a7f01e549877e2086f7c94439c9..e5e63092df3f06726f162f36bd0fc09a22695866 100644 (file)
@@ -54,10 +54,10 @@ See `erc-encoding-coding-alist'."
   (set (make-local-variable 'write-file-functions) new-val))
 
 (defvar erc-emacs-build-time
-  (if (stringp emacs-build-time)
+  (if (or (stringp emacs-build-time) (not emacs-build-time))
       emacs-build-time
     (format-time-string "%Y-%m-%d" emacs-build-time))
-  "Time at which Emacs was dumped out.")
+  "Time at which Emacs was dumped out, or nil if not available.")
 
 ;; Emacs 21 and XEmacs do not have user-emacs-directory, but XEmacs
 ;; has user-init-directory.
@@ -164,4 +164,3 @@ If START or END is negative, it counts from the end."
 ;; indent-tabs-mode: t
 ;; tab-width: 8
 ;; End:
-
index 68460d15c4e77bd4df795711bebe14935bbf8b25..52adec1ce46f18433ef82b6d52cd2298c723f5c9 100644 (file)
@@ -3581,7 +3581,7 @@ the message given by REASON."
 
 (defun erc-cmd-SV ()
   "Say the current ERC and Emacs version into channel."
-  (erc-send-message (format "I'm using ERC with %s %s (%s%s) of %s."
+  (erc-send-message (format "I'm using ERC with %s %s (%s%s)%s."
                             (if (featurep 'xemacs) "XEmacs" "GNU Emacs")
                             emacs-version
                             system-configuration
@@ -3602,7 +3602,9 @@ the message given by REASON."
                                                       x-toolkit-scroll-bars)))
                                "")
                              (if (featurep 'multi-tty) ", multi-tty" ""))
-                            erc-emacs-build-time))
+                            (if erc-emacs-build-time
+                                (concat " of " erc-emacs-build-time)
+                              "")))
   t)
 
 (defun erc-cmd-SM ()
index ba24964bd2554540ba884b850d09eb45bdddf02a..dc228870d1ec8775dffb1530e93bdd0cd1f1a754 100644 (file)
@@ -38,14 +38,11 @@ This variable first existed in version 19.23.")
   "Minor version number of this version of Emacs.
 This variable first existed in version 19.23.")
 
-;; FIXME: The next variable should also be a constant if
-;; `deterministic-dump' is t.
-(defconst emacs-build-time (current-time)
-  "Time at which Emacs was dumped out.")
+(defconst emacs-build-system (system-name)
+  "Name of the system on which Emacs was built, or nil if not available.")
 
-(defconst emacs-build-system
-  (if deterministic-dump "elided" (system-name))
-  "Name of the system on which Emacs was built.")
+(defconst emacs-build-time (if emacs-build-system (current-time))
+  "Time at which Emacs was dumped out, or nil if not available.")
 
 (defvar motif-version-string)
 (defvar gtk-version-string)
@@ -59,9 +56,7 @@ Don't use this function in programs to choose actions according
 to the system configuration; look at `system-configuration' instead."
   (interactive "P")
   (let ((version-string
-         (format (if (not (called-interactively-p 'interactive))
-                    "GNU Emacs %s (%s%s%s%s)\n of %s"
-                  "GNU Emacs %s (%s%s%s%s) of %s")
+         (format "GNU Emacs %s (%s%s%s%s)%s"
                  emacs-version
                 system-configuration
                 (cond ((featurep 'motif)
@@ -80,7 +75,14 @@ to the system configuration; look at `system-configuration' instead."
                     (format ", %s scroll bars"
                             (capitalize (symbol-name x-toolkit-scroll-bars)))
                   "")
-                (format-time-string "%Y-%m-%d" emacs-build-time))))
+                (if emacs-build-time
+                    (format-time-string (concat
+                                         (if (called-interactively-p
+                                              'interactive)
+                                             "" "\n")
+                                         " of %Y-%m-%d")
+                                        emacs-build-time)
+                  ""))))
     (if here
         (insert version-string)
       (if (called-interactively-p 'interactive)
index 8dcaf7e4759e55d830997b316bced43b82ad8b6b..c290a6082dae18007c26e4ada4ed7df38f93f0af 100644 (file)
@@ -313,6 +313,9 @@ GETLOADAVG_LIBS = @GETLOADAVG_LIBS@
 
 RUN_TEMACS = ./temacs
 
+# Whether builds should contain details. '--no-build-details' or empty.
+BUILD_DETAILS = @BUILD_DETAILS@
+
 UNEXEC_OBJ = @UNEXEC_OBJ@
 
 CANNOT_DUMP=@CANNOT_DUMP@
@@ -534,7 +537,7 @@ emacs$(EXEEXT): temacs$(EXEEXT) \
 ifeq ($(CANNOT_DUMP),yes)
        ln -f temacs$(EXEEXT) $@
 else
-       LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump
+       LC_ALL=C $(RUN_TEMACS) -batch $(BUILD_DETAILS) -l loadup dump
        $(PAXCTL_if_present) -zex $@
        ln -f $@ bootstrap-emacs$(EXEEXT)
 endif
@@ -740,7 +743,7 @@ bootstrap-emacs$(EXEEXT): temacs$(EXEEXT)
 ifeq ($(CANNOT_DUMP),yes)
        ln -f temacs$(EXEEXT) $@
 else
-       $(RUN_TEMACS) --batch --load loadup bootstrap
+       $(RUN_TEMACS) --batch $(BUILD_DETAILS) --load loadup bootstrap
        $(PAXCTL_if_present) -zex emacs$(EXEEXT)
        mv -f emacs$(EXEEXT) $@
 endif
index e7cb4ea4aaae083f6c837840c317842102194abc..a381da4fb8f6cd00443f3bc2cc0d7f49052c245d 100644 (file)
@@ -181,6 +181,9 @@ bool noninteractive;
 /* True means remove site-lisp directories from load-path.  */
 bool no_site_lisp;
 
+/* True means put details like time stamps into builds.  */
+bool build_details;
+
 /* Name for the server started by the daemon.*/
 static char *daemon_name;
 
@@ -222,6 +225,7 @@ Initialization options:\n\
 --display, -d DISPLAY       use X server DISPLAY\n\
 ",
     "\
+--no-build-details          do not add build details such as time stamps\n\
 --no-desktop                do not load a saved desktop\n\
 --no-init-file, -q          load neither ~/.emacs nor default.el\n\
 --no-loadup, -nl            do not load loadup.el into bare Emacs\n\
@@ -872,9 +876,6 @@ main (int argc, char **argv)
   SET_BINARY (fileno (stdout));
 #endif /* MSDOS */
 
-  if (DETERMINISTIC_DUMP)
-    Vdeterministic_dump = Qt;
-
   /* Skip initial setlocale if LC_ALL is "C", as it's not needed in that case.
      The build procedure uses this while dumping, to ensure that the
      dumped Emacs does not have its system locale tables initialized,
@@ -1192,6 +1193,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
   no_site_lisp
     = argmatch (argv, argc, "-nsl", "--no-site-lisp", 11, NULL, &skip_args);
 
+  build_details = ! argmatch (argv, argc, "-no-build-details",
+                             "--no-build-details", 7, NULL, &skip_args);
+
 #ifdef HAVE_NS
   ns_pool = ns_alloc_autorelease_pool ();
 #ifdef NS_IMPL_GNUSTEP
@@ -1641,6 +1645,7 @@ static const struct standard_args standard_args[] =
   { "-help", "--help", 90, 0 },
   { "-nl", "--no-loadup", 70, 0 },
   { "-nsl", "--no-site-lisp", 65, 0 },
+  { "-no-build-details", "--no-build-details", 63, 0 },
   /* -d must come last before the options handled in startup.el.  */
   { "-d", "--display", 60, 1 },
   { "-display", 0, 60, 1 },
@@ -2535,13 +2540,6 @@ libraries; only those already known by Emacs will be loaded.  */);
   Vdynamic_library_alist = Qnil;
   Fput (intern_c_string ("dynamic-library-alist"), Qrisky_local_variable, Qt);
 
-  DEFVAR_BOOL ("deterministic-dump", Vdeterministic_dump,
-    doc: /* If non-nil, attempt to make dumping deterministic by
-avoiding sources of nondeterminism such as absolute file names, the
-hostname, or timestamps.  */);
-  Vdeterministic_dump = DETERMINISTIC_DUMP ? Qt : Qnil;
-  XSYMBOL (intern_c_string ("deterministic-dump"))->constant = 1;
-
 #ifdef WINDOWSNT
   Vlibrary_cache = Qnil;
   staticpro (&Vlibrary_cache);
index 18d986441f0bdcec7d3a50d2135089417fb18da6..9c7955e2bc45a69c4b82c71ba26d513d7e65f2be 100644 (file)
@@ -4132,6 +4132,9 @@ extern bool noninteractive;
 /* True means remove site-lisp directories from load-path.  */
 extern bool no_site_lisp;
 
+/* True means put details like time stamps into builds.  */
+extern bool build_details;
+
 /* Pipe used to send exit notification to the daemon parent at
    startup.  On Windows, we use a kernel event instead.  */
 #ifndef WINDOWSNT
index b01c64d52ac6c86897487a45f76fc753b8add2a1..a01bf1d7c100d1066257cf458f1c2492b5ca5b6c 100644 (file)
@@ -1408,11 +1408,10 @@ setup_pty (int fd)
 void
 init_system_name (void)
 {
-  if (DETERMINISTIC_DUMP && (might_dump || ! NILP (Vpurify_flag)))
+  if (!build_details)
     {
-      /* If we're dumping, set the hostname to a literal so that the
-         dump is deterministic.  */
-      Vsystem_name = build_pure_c_string ("elided");
+      /* Set system-name to nil so that the build is deterministic.  */
+      Vsystem_name = Qnil;
       return;
     }
   char *hostname_alloc = NULL;